Stop using internal unique_ptr::_Myptr member
This commit is contained in:
parent
b3e5c93f4b
commit
1fe80bd0e0
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2015-2016 Amebis
|
Copyright 2015-2018 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of GÉANTLink.
|
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).
|
// Convert configuration BLOB to XML using EapHost (and ultimately method peer's EapPeerConfigBlob2Xml).
|
||||||
com_obj<IXMLDOMDocument2> pConfigDoc;
|
com_obj<IXMLDOMDocument2> pConfigDoc;
|
||||||
eap_error error;
|
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) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ void eap::config_method_eaphost::load(_In_ IXMLDOMNode *pConfigRoot)
|
|||||||
DWORD cfg_data_size = 0;
|
DWORD cfg_data_size = 0;
|
||||||
eap_blob cfg_data;
|
eap_blob cfg_data;
|
||||||
eap_error error;
|
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) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
update_type();
|
update_type();
|
||||||
const BYTE *_cfg_data = cfg_data.get();
|
const BYTE *_cfg_data = cfg_data.get();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2015-2016 Amebis
|
Copyright 2015-2018 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of GÉANTLink.
|
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,
|
src != source_unknown ? (DWORD)m_cred_blob.size() : 0, src != source_unknown ? m_cred_blob.data() : NULL,
|
||||||
hTokenImpersonateUser,
|
hTokenImpersonateUser,
|
||||||
&fInvokeUI,
|
&fInvokeUI,
|
||||||
&cred_data_size, &cred_data._Myptr,
|
&cred_data_size, get_ptr(cred_data),
|
||||||
&identity._Myptr,
|
get_ptr(identity),
|
||||||
&error._Myptr,
|
get_ptr(error),
|
||||||
NULL);
|
NULL);
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
if (identity && !fInvokeUI) {
|
if (identity && !fInvokeUI) {
|
||||||
// Inner EAP method provided identity and does not require additional UI prompt.
|
// Inner EAP method provided identity and does not require additional UI prompt.
|
||||||
m_identity = identity.get();
|
m_identity = identity.get();
|
||||||
m_cred_blob.assign(cred_data.get(), cred_data.get() + cred_data_size);
|
BYTE *_cred_data = cred_data.get();
|
||||||
SecureZeroMemory(cred_data.get(), cred_data_size);
|
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);
|
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;
|
return source_lower;
|
||||||
} else
|
} else
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2015-2016 Amebis
|
Copyright 2015-2018 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of GÉANTLink.
|
This file is part of GÉANTLink.
|
||||||
@ -86,7 +86,7 @@ void eap::method_eaphost::begin_session(
|
|||||||
dwMaxSendPacketSize,
|
dwMaxSendPacketSize,
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
&m_session_id,
|
&m_session_id,
|
||||||
&error._Myptr);
|
get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// Session succesfully created.
|
// Session succesfully created.
|
||||||
} else if (error)
|
} else if (error)
|
||||||
@ -100,7 +100,7 @@ void eap::method_eaphost::end_session()
|
|||||||
{
|
{
|
||||||
// End EapHost peer session.
|
// End EapHost peer session.
|
||||||
eap_error_runtime error;
|
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) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// Session successfuly ended.
|
// Session successfuly ended.
|
||||||
} else if (error)
|
} else if (error)
|
||||||
@ -126,7 +126,7 @@ EapPeerMethodResponseAction eap::method_eaphost::process_request_packet(
|
|||||||
dwReceivedPacketSize,
|
dwReceivedPacketSize,
|
||||||
reinterpret_cast<const BYTE*>(pReceivedPacket),
|
reinterpret_cast<const BYTE*>(pReceivedPacket),
|
||||||
&action,
|
&action,
|
||||||
&error._Myptr);
|
get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// Packet successfuly processed.
|
// Packet successfuly processed.
|
||||||
return action_h2p(action);
|
return action_h2p(action);
|
||||||
@ -147,11 +147,12 @@ void eap::method_eaphost::get_response_packet(
|
|||||||
DWORD dwResult = EapHostPeerGetSendPacket(
|
DWORD dwResult = EapHostPeerGetSendPacket(
|
||||||
m_session_id,
|
m_session_id,
|
||||||
&size_max,
|
&size_max,
|
||||||
&_packet._Myptr,
|
get_ptr(_packet),
|
||||||
&error._Myptr);
|
get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// Packet successfuly prepared.
|
// 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)
|
} else if (error)
|
||||||
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerGetSendPacket failed.");
|
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerGetSendPacket failed.");
|
||||||
else
|
else
|
||||||
@ -170,7 +171,7 @@ void eap::method_eaphost::get_result(
|
|||||||
m_session_id,
|
m_session_id,
|
||||||
EapHostPeerMethodResultFromMethod,
|
EapHostPeerMethodResultFromMethod,
|
||||||
&result,
|
&result,
|
||||||
&error._Myptr);
|
get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// Result successfuly returned.
|
// Result successfuly returned.
|
||||||
method::get_result(reason, pResult);
|
method::get_result(reason, pResult);
|
||||||
@ -219,7 +220,7 @@ void eap::method_eaphost::get_ui_context(_Out_ sanitizing_blob &context_data)
|
|||||||
m_session_id,
|
m_session_id,
|
||||||
&dwUIContextDataSize,
|
&dwUIContextDataSize,
|
||||||
&pUIContextData,
|
&pUIContextData,
|
||||||
&error._Myptr);
|
get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// UI context data successfuly returned.
|
// UI context data successfuly returned.
|
||||||
context_data.assign(pUIContextData, pUIContextData + dwUIContextDataSize);
|
context_data.assign(pUIContextData, pUIContextData + dwUIContextDataSize);
|
||||||
@ -245,7 +246,7 @@ EapPeerMethodResponseAction eap::method_eaphost::set_ui_context(
|
|||||||
dwUIContextDataSize,
|
dwUIContextDataSize,
|
||||||
pUIContextData,
|
pUIContextData,
|
||||||
&action,
|
&action,
|
||||||
&error._Myptr);
|
get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// UI context data successfuly returned.
|
// UI context data successfuly returned.
|
||||||
return action_h2p(action);
|
return action_h2p(action);
|
||||||
@ -263,7 +264,7 @@ void eap::method_eaphost::get_response_attributes(_Inout_ EapAttributes *pAttrib
|
|||||||
DWORD dwResult = EapHostPeerGetResponseAttributes(
|
DWORD dwResult = EapHostPeerGetResponseAttributes(
|
||||||
m_session_id,
|
m_session_id,
|
||||||
pAttribs,
|
pAttribs,
|
||||||
&error._Myptr);
|
get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// Response attributes successfuly returned.
|
// Response attributes successfuly returned.
|
||||||
} else if (error)
|
} else if (error)
|
||||||
@ -282,7 +283,7 @@ EapPeerMethodResponseAction eap::method_eaphost::set_response_attributes(_In_ co
|
|||||||
m_session_id,
|
m_session_id,
|
||||||
pAttribs,
|
pAttribs,
|
||||||
&action,
|
&action,
|
||||||
&error._Myptr);
|
get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// Response attributes successfuly set.
|
// Response attributes successfuly set.
|
||||||
return action_h2p(action);
|
return action_h2p(action);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2015-2016 Amebis
|
Copyright 2015-2018 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of GÉANTLink.
|
This file is part of GÉANTLink.
|
||||||
@ -51,7 +51,7 @@ wxEapHostMethodConfigPanel::wxEapHostMethodConfigPanel(const eap::config_provide
|
|||||||
|
|
||||||
winstd::eap_method_info_array methods;
|
winstd::eap_method_info_array methods;
|
||||||
winstd::eap_error error;
|
winstd::eap_error error;
|
||||||
DWORD dwResult = EapHostPeerGetMethods(&methods, &error._Myptr);
|
DWORD dwResult = EapHostPeerGetMethods(&methods, get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
for (DWORD i = 0; i < methods.dwNumberOfMethods; i++)
|
for (DWORD i = 0; i < methods.dwNumberOfMethods; i++)
|
||||||
m_method->Append(methods.pEapMethods[i].pwszFriendlyName, new wxEAPMethodTypeClientData(methods.pEapMethods[i].eaptype, methods.pEapMethods[i].eapProperties));
|
m_method->Append(methods.pEapMethods[i].pwszFriendlyName, new wxEAPMethodTypeClientData(methods.pEapMethods[i].eaptype, methods.pEapMethods[i].eapProperties));
|
||||||
@ -126,7 +126,7 @@ void wxEapHostMethodConfigPanel::OnSettings(wxCommandEvent& event)
|
|||||||
DWORD cfg_data_size = 0;
|
DWORD cfg_data_size = 0;
|
||||||
winstd::eap_blob cfg_data;
|
winstd::eap_blob cfg_data;
|
||||||
winstd::eap_error error;
|
winstd::eap_error error;
|
||||||
DWORD dwResult = EapHostPeerInvokeConfigUI(GetHWND(), 0, data->m_type, (DWORD)data->m_cfg_blob.size(), data->m_cfg_blob.data(), &cfg_data_size, &cfg_data._Myptr, &error._Myptr);
|
DWORD dwResult = EapHostPeerInvokeConfigUI(GetHWND(), 0, data->m_type, (DWORD)data->m_cfg_blob.size(), data->m_cfg_blob.data(), &cfg_data_size, get_ptr(cfg_data), get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
const BYTE *_cfg_data = cfg_data.get();
|
const BYTE *_cfg_data = cfg_data.get();
|
||||||
data->m_cfg_blob.assign(_cfg_data, _cfg_data + cfg_data_size);
|
data->m_cfg_blob.assign(_cfg_data, _cfg_data + cfg_data_size);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2015-2016 Amebis
|
Copyright 2015-2018 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of GÉANTLink.
|
This file is part of GÉANTLink.
|
||||||
@ -376,16 +376,17 @@ void eap::peer_ttls_ui::invoke_identity_ui(
|
|||||||
hwndParent,
|
hwndParent,
|
||||||
(DWORD)cfg_inner_eaphost->m_cfg_blob.size(), cfg_inner_eaphost->m_cfg_blob.data(),
|
(DWORD)cfg_inner_eaphost->m_cfg_blob.size(), cfg_inner_eaphost->m_cfg_blob.data(),
|
||||||
(DWORD)cred_inner->m_cred_blob.size(), cred_inner->m_cred_blob.data(),
|
(DWORD)cred_inner->m_cred_blob.size(), cred_inner->m_cred_blob.data(),
|
||||||
&cred_data_size, &cred_data._Myptr,
|
&cred_data_size, get_ptr(cred_data),
|
||||||
&identity._Myptr,
|
get_ptr(identity),
|
||||||
&error._Myptr,
|
get_ptr(error),
|
||||||
NULL);
|
NULL);
|
||||||
result = dwResult == ERROR_SUCCESS ? wxID_OK : wxID_CANCEL;
|
result = dwResult == ERROR_SUCCESS ? wxID_OK : wxID_CANCEL;
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// Inner EAP method provided credentials.
|
// Inner EAP method provided credentials.
|
||||||
cred_inner->m_identity = identity.get();
|
cred_inner->m_identity = identity.get();
|
||||||
cred_inner->m_cred_blob.assign(cred_data.get(), cred_data.get() + cred_data_size);
|
BYTE *_cred_data = cred_data.get();
|
||||||
SecureZeroMemory(cred_data.get(), cred_data_size);
|
cred_inner->m_cred_blob.assign(_cred_data, _cred_data + cred_data_size);
|
||||||
|
SecureZeroMemory(_cred_data, cred_data_size);
|
||||||
|
|
||||||
// TODO: If we ever choose to store EapHost credentials to Windows Credential Manager, add a "Save credentials? Yes/No" prompt here and write them to Credential Manager.
|
// TODO: If we ever choose to store EapHost credentials to Windows Credential Manager, add a "Save credentials? Yes/No" prompt here and write them to Credential Manager.
|
||||||
} else if (dwResult == ERROR_CANCELLED) {
|
} else if (dwResult == ERROR_CANCELLED) {
|
||||||
@ -521,7 +522,7 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
|
|||||||
ctx.m_data.data(),
|
ctx.m_data.data(),
|
||||||
&dwSizeofDataFromInteractiveUI,
|
&dwSizeofDataFromInteractiveUI,
|
||||||
&pDataFromInteractiveUI,
|
&pDataFromInteractiveUI,
|
||||||
&error._Myptr);
|
get_ptr(error));
|
||||||
if (dwResult == ERROR_SUCCESS) {
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
// Inner EAP method provided response.
|
// Inner EAP method provided response.
|
||||||
ctx.m_data.assign(pDataFromInteractiveUI, pDataFromInteractiveUI + dwSizeofDataFromInteractiveUI);
|
ctx.m_data.assign(pDataFromInteractiveUI, pDataFromInteractiveUI + dwSizeofDataFromInteractiveUI);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user