Stop using internal unique_ptr::_Myptr member

This commit is contained in:
2018-09-05 13:59:09 +02:00
parent b3e5c93f4b
commit 1fe80bd0e0
5 changed files with 34 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright 2015-2016 Amebis
Copyright 2015-2018 Amebis
Copyright 2016 GÉANT
This file is part of GÉANTLink.
@@ -96,7 +96,7 @@ void eap::config_method_eaphost::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNo
// Convert configuration BLOB to XML using EapHost (and ultimately method peer's EapPeerConfigBlob2Xml).
com_obj<IXMLDOMDocument2> pConfigDoc;
eap_error error;
DWORD dwResult = EapHostPeerConfigBlob2Xml(0, m_type, (DWORD)m_cfg_blob.size(), const_cast<BYTE*>(m_cfg_blob.data()), &pConfigDoc, &error._Myptr);
DWORD dwResult = EapHostPeerConfigBlob2Xml(0, m_type, (DWORD)m_cfg_blob.size(), const_cast<BYTE*>(m_cfg_blob.data()), &pConfigDoc, get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
HRESULT hr;
@@ -127,7 +127,7 @@ void eap::config_method_eaphost::load(_In_ IXMLDOMNode *pConfigRoot)
DWORD cfg_data_size = 0;
eap_blob cfg_data;
eap_error error;
DWORD dwResult = EapHostPeerConfigXml2Blob(0, pXmlElEapHostConfig, &cfg_data_size, &cfg_data._Myptr, &m_type, &error._Myptr);
DWORD dwResult = EapHostPeerConfigXml2Blob(0, pXmlElEapHostConfig, &cfg_data_size, get_ptr(cfg_data), &m_type, get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
update_type();
const BYTE *_cfg_data = cfg_data.get();

View File

@@ -1,5 +1,5 @@
/*
Copyright 2015-2016 Amebis
Copyright 2015-2018 Amebis
Copyright 2016 GÉANT
This file is part of GÉANTLink.
@@ -283,16 +283,17 @@ eap::credentials::source_t eap::credentials_eaphost::combine(
src != source_unknown ? (DWORD)m_cred_blob.size() : 0, src != source_unknown ? m_cred_blob.data() : NULL,
hTokenImpersonateUser,
&fInvokeUI,
&cred_data_size, &cred_data._Myptr,
&identity._Myptr,
&error._Myptr,
&cred_data_size, get_ptr(cred_data),
get_ptr(identity),
get_ptr(error),
NULL);
if (dwResult == ERROR_SUCCESS) {
if (identity && !fInvokeUI) {
// Inner EAP method provided identity and does not require additional UI prompt.
m_identity = identity.get();
m_cred_blob.assign(cred_data.get(), cred_data.get() + cred_data_size);
SecureZeroMemory(cred_data.get(), cred_data_size);
BYTE *_cred_data = cred_data.get();
m_cred_blob.assign(_cred_data, _cred_data + cred_data_size);
SecureZeroMemory(_cred_data, cred_data_size);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_EAPHOST, event_data((unsigned int)cfg.get_method_id()), event_data(get_name()), event_data(pszTargetName), event_data::blank);
return source_lower;
} else

View File

@@ -1,5 +1,5 @@
/*
Copyright 2015-2016 Amebis
Copyright 2015-2018 Amebis
Copyright 2016 GÉANT
This file is part of GÉANTLink.
@@ -86,7 +86,7 @@ void eap::method_eaphost::begin_session(
dwMaxSendPacketSize,
NULL, NULL, NULL,
&m_session_id,
&error._Myptr);
get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
// Session succesfully created.
} else if (error)
@@ -100,7 +100,7 @@ void eap::method_eaphost::end_session()
{
// End EapHost peer session.
eap_error_runtime error;
DWORD dwResult = EapHostPeerEndSession(m_session_id, &error._Myptr);
DWORD dwResult = EapHostPeerEndSession(m_session_id, get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
// Session successfuly ended.
} else if (error)
@@ -126,7 +126,7 @@ EapPeerMethodResponseAction eap::method_eaphost::process_request_packet(
dwReceivedPacketSize,
reinterpret_cast<const BYTE*>(pReceivedPacket),
&action,
&error._Myptr);
get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
// Packet successfuly processed.
return action_h2p(action);
@@ -147,11 +147,12 @@ void eap::method_eaphost::get_response_packet(
DWORD dwResult = EapHostPeerGetSendPacket(
m_session_id,
&size_max,
&_packet._Myptr,
&error._Myptr);
get_ptr(_packet),
get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
// Packet successfuly prepared.
packet.assign(_packet.get(), _packet.get() + size_max);
const BYTE *__packet = _packet.get();
packet.assign(__packet, __packet + size_max);
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerGetSendPacket failed.");
else
@@ -170,7 +171,7 @@ void eap::method_eaphost::get_result(
m_session_id,
EapHostPeerMethodResultFromMethod,
&result,
&error._Myptr);
get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
// Result successfuly returned.
method::get_result(reason, pResult);
@@ -219,7 +220,7 @@ void eap::method_eaphost::get_ui_context(_Out_ sanitizing_blob &context_data)
m_session_id,
&dwUIContextDataSize,
&pUIContextData,
&error._Myptr);
get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
// UI context data successfuly returned.
context_data.assign(pUIContextData, pUIContextData + dwUIContextDataSize);
@@ -245,7 +246,7 @@ EapPeerMethodResponseAction eap::method_eaphost::set_ui_context(
dwUIContextDataSize,
pUIContextData,
&action,
&error._Myptr);
get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
// UI context data successfuly returned.
return action_h2p(action);
@@ -263,7 +264,7 @@ void eap::method_eaphost::get_response_attributes(_Inout_ EapAttributes *pAttrib
DWORD dwResult = EapHostPeerGetResponseAttributes(
m_session_id,
pAttribs,
&error._Myptr);
get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
// Response attributes successfuly returned.
} else if (error)
@@ -282,7 +283,7 @@ EapPeerMethodResponseAction eap::method_eaphost::set_response_attributes(_In_ co
m_session_id,
pAttribs,
&action,
&error._Myptr);
get_ptr(error));
if (dwResult == ERROR_SUCCESS) {
// Response attributes successfuly set.
return action_h2p(action);