From 460adb9858807737e37d72fe832472be7b41e486 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 5 Aug 2016 11:23:59 +0200 Subject: [PATCH] m_module is now a pointer instead of reference --- CredWrite/Main.cpp | 4 +- EAPMethods/src/Main.cpp | 12 ++--- EAPMethods/src/Main_UI.cpp | 10 ++-- lib/EAPBase/include/Config.h | 30 +++++------ lib/EAPBase/include/Credentials.h | 8 +-- lib/EAPBase/include/Module.h | 2 +- lib/EAPBase/include/Session.h | 12 ++--- lib/EAPBase/src/Config.cpp | 82 ++++++++++++++++--------------- lib/EAPBase/src/Credentials.cpp | 28 +++++------ lib/EAPBase_UI/include/EAP_UI.h | 4 +- lib/PAP/include/Config.h | 4 +- lib/PAP/include/Credentials.h | 4 +- lib/PAP/src/Config.cpp | 2 +- lib/PAP/src/Credentials.cpp | 2 +- lib/TLS/include/Config.h | 4 +- lib/TLS/include/Credentials.h | 4 +- lib/TLS/include/Session.h | 4 +- lib/TLS/src/Config.cpp | 18 +++---- lib/TLS/src/Credentials.cpp | 26 +++++----- lib/TLS/src/Session.cpp | 22 ++++----- lib/TTLS/include/Config.h | 4 +- lib/TTLS/include/Credentials.h | 4 +- lib/TTLS/include/Session.h | 4 +- lib/TTLS/src/Config.cpp | 20 ++++---- lib/TTLS/src/Credentials.cpp | 8 +-- lib/TTLS/src/Module.cpp | 4 +- lib/TTLS/src/Session.cpp | 8 +-- 27 files changed, 168 insertions(+), 166 deletions(-) diff --git a/CredWrite/Main.cpp b/CredWrite/Main.cpp index a683e93..7c9ac49 100644 --- a/CredWrite/Main.cpp +++ b/CredWrite/Main.cpp @@ -40,7 +40,7 @@ static int CredWrite() return -1; } - eap::credentials_pap cred(g_module); + eap::credentials_pap cred(&g_module); // Prepare identity (user name). { @@ -84,7 +84,7 @@ static int CredWrite() EAP_ERROR *pEapError = NULL; #ifdef _DEBUG { - eap::credentials_pap cred_stored(g_module); + eap::credentials_pap cred_stored(&g_module); if (!cred_stored.retrieve(target_name.c_str(), &pEapError)) { if (pEapError) { OutputDebugStr(_T("%ls (error %u)\n"), pEapError->pRootCauseString, pEapError->dwWinError); diff --git a/EAPMethods/src/Main.cpp b/EAPMethods/src/Main.cpp index 602d61b..3ae6860 100644 --- a/EAPMethods/src/Main.cpp +++ b/EAPMethods/src/Main.cpp @@ -237,8 +237,8 @@ DWORD APIENTRY EapPeerGetIdentity( else if (!ppwszIdentity) g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppwszIdentity is NULL."))); else { - eap::config_providers cfg(g_peer); - _EAPMETHOD_PEER::credentials_type cred_in(g_peer), cred_out(g_peer); + eap::config_providers cfg(&g_peer); + _EAPMETHOD_PEER::credentials_type cred_in(&g_peer), cred_out(&g_peer); if ( !g_peer.unpack(cfg, pConnectionData, dwConnectionDataSize, ppEapError) || dwUserDataSize && !g_peer.unpack(cred_in, pUserData, dwUserDataSize, ppEapError) || !g_peer.get_identity(dwFlags, cfg, dwUserDataSize ? &cred_in : NULL, cred_out, hTokenImpersonateUser, pfInvokeUI, ppwszIdentity, ppEapError) || @@ -295,7 +295,7 @@ DWORD APIENTRY EapPeerBeginSession( *phSession = NULL; // Allocate new session. - unique_ptr<_EAPMETHOD_SESSION> session(new _EAPMETHOD_SESSION(g_peer)); + unique_ptr<_EAPMETHOD_SESSION> session(new _EAPMETHOD_SESSION(&g_peer)); if (!session) { g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_OUTOFMEMORY, _T(__FUNCTION__) _T(" Error allocating memory for EAP session."))); return dwResult; @@ -686,8 +686,8 @@ DWORD WINAPI EapPeerGetMethodProperties( else if (!pMethodPropertyArray) g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pMethodPropertyArray is NULL."))); else { - eap::config_providers cfg(g_peer); - _EAPMETHOD_PEER::credentials_type cred(g_peer); + eap::config_providers cfg(&g_peer); + _EAPMETHOD_PEER::credentials_type cred(&g_peer); if (!g_peer.unpack(cfg, pEapConnData, dwEapConnDataSize, ppEapError) || !g_peer.unpack(cred, pUserData, dwUserDataSize, ppEapError) || !g_peer.get_method_properties( @@ -764,7 +764,7 @@ DWORD WINAPI EapPeerCredentialsXml2Blob( // Load credentials. pCredentialsDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eap-metadata=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\"")); - _EAPMETHOD_PEER::credentials_type cred(g_peer); + _EAPMETHOD_PEER::credentials_type cred(&g_peer); if (!cred.load(pXmlElCredentials, ppEapError) || !g_peer.pack(cred, ppCredentialsOut, pdwCredentialsOutSize, ppEapError)) { diff --git a/EAPMethods/src/Main_UI.cpp b/EAPMethods/src/Main_UI.cpp index 7a4891e..6f9cf9a 100644 --- a/EAPMethods/src/Main_UI.cpp +++ b/EAPMethods/src/Main_UI.cpp @@ -142,7 +142,7 @@ DWORD WINAPI EapPeerConfigXml2Blob( // Load configuration. pConfigDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eap-metadata=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\"")); - eap::config_providers cfg(g_peer); + eap::config_providers cfg(&g_peer); if (!cfg.load(pXmlElConfig, ppEapError) || !g_peer.pack(cfg, ppConfigOut, pdwConfigOutSize, ppEapError)) { @@ -198,7 +198,7 @@ DWORD WINAPI EapPeerConfigBlob2Xml( HRESULT hr; // Unpack configuration. - eap::config_providers cfg(g_peer); + eap::config_providers cfg(&g_peer); if (!g_peer.unpack(cfg, pConfigIn, dwConfigInSize, ppEapError)) { if (*ppEapError) { g_peer.log_error(*ppEapError); @@ -294,7 +294,7 @@ DWORD WINAPI EapPeerInvokeConfigUI( else if (!ppConnectionDataOut) g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppConnectionDataOut is NULL."))); else { - eap::config_providers cfg(g_peer); + eap::config_providers cfg(&g_peer); if (dwConnectionDataInSize && !g_peer.unpack(cfg, pConnectionDataIn, dwConnectionDataInSize, ppEapError) || !g_peer.invoke_config_ui(hwndParent, cfg, ppEapError) || !g_peer.pack(cfg, ppConnectionDataOut, pdwConnectionDataOutSize, ppEapError)) @@ -359,8 +359,8 @@ DWORD WINAPI EapPeerInvokeIdentityUI( else if (!ppwszIdentity) g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppwszIdentity is NULL."))); else { - eap::config_providers cfg(g_peer); - _EAPMETHOD_PEER_UI::credentials_type cred(g_peer); + eap::config_providers cfg(&g_peer); + _EAPMETHOD_PEER_UI::credentials_type cred(&g_peer); if ( !g_peer.unpack(cfg, pConnectionData, dwConnectionDataSize, ppEapError) || dwUserDataSize && !g_peer.unpack(cred, pUserData, dwUserDataSize, ppEapError) || !g_peer.invoke_identity_ui(hwndParent, dwFlags, cfg, cred, ppwszIdentity, ppEapError) || diff --git a/lib/EAPBase/include/Config.h b/lib/EAPBase/include/Config.h index 153d146..6a541da 100644 --- a/lib/EAPBase/include/Config.h +++ b/lib/EAPBase/include/Config.h @@ -102,9 +102,9 @@ namespace eap /// /// Constructs configuration /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - config(_In_ module &mod); + config(_In_ module *mod); /// /// Copies configuration @@ -202,7 +202,7 @@ namespace eap /// @} public: - module &m_module; ///< Reference of the EAP module + module *m_module; ///< EAP module }; @@ -212,9 +212,9 @@ namespace eap /// /// Constructs configuration /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - config_method(_In_ module &mod); + config_method(_In_ module *mod); /// /// Copies configuration @@ -264,9 +264,9 @@ namespace eap /// /// Constructs configuration /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - config_method_with_cred(_In_ module &mod) : + config_method_with_cred(_In_ module *mod) : m_allow_save(true), m_use_preshared(false), m_preshared(mod), @@ -369,13 +369,13 @@ namespace eap // winstd::com_obj pXmlElClientSideCredential; if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), winstd::bstr(L"ClientSideCredential"), bstrNamespace, &pXmlElClientSideCredential)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / if ((dwResult = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, winstd::bstr(L"allow-save"), bstrNamespace, m_allow_save)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -411,7 +411,7 @@ namespace eap // eapxml::get_element_value(pXmlElClientSideCredential, winstd::bstr(L"eap-metadata:allow-save"), &m_allow_save); - m_module.log_config((xpath + L"/allow-save").c_str(), m_allow_save); + m_module->log_config((xpath + L"/allow-save").c_str(), m_allow_save); _Tcred preshared(m_module); if (preshared.load(pXmlElClientSideCredential, ppEapError)) { @@ -420,7 +420,7 @@ namespace eap } else { // This is not really an error - merely an indication pre-shared credentials are unavailable. if (*ppEapError) { - m_module.free_error_memory(*ppEapError); + m_module->free_error_memory(*ppEapError); *ppEapError = NULL; } } @@ -491,9 +491,9 @@ namespace eap /// /// Constructs configuration /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - config_provider(_In_ module &mod); + config_provider(_In_ module *mod); /// /// Copies configuration @@ -610,9 +610,9 @@ namespace eap /// /// Constructs configuration /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - config_providers(_In_ module &mod); + config_providers(_In_ module *mod); /// /// Copies configuration diff --git a/lib/EAPBase/include/Credentials.h b/lib/EAPBase/include/Credentials.h index 1e9f457..ee2809d 100644 --- a/lib/EAPBase/include/Credentials.h +++ b/lib/EAPBase/include/Credentials.h @@ -58,9 +58,9 @@ namespace eap /// /// Constructs credentials /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - credentials(_In_ module &mod); + credentials(_In_ module *mod); /// /// Copies credentials @@ -203,9 +203,9 @@ namespace eap /// /// Constructs credentials /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - credentials_pass(_In_ module &mod); + credentials_pass(_In_ module *mod); /// /// Copies credentials diff --git a/lib/EAPBase/include/Module.h b/lib/EAPBase/include/Module.h index 3642150..edb8991 100644 --- a/lib/EAPBase/include/Module.h +++ b/lib/EAPBase/include/Module.h @@ -692,7 +692,7 @@ namespace eap /// virtual config_method* make_config_method() { - return new config_method_type(*this); + return new config_method_type(this); } }; diff --git a/lib/EAPBase/include/Session.h b/lib/EAPBase/include/Session.h index ee54cf4..513a7de 100644 --- a/lib/EAPBase/include/Session.h +++ b/lib/EAPBase/include/Session.h @@ -70,9 +70,9 @@ namespace eap /// /// Constructs a session /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - session(_In_ module &mod) : + session(_In_ module *mod) : m_module(mod), m_cfg(mod), m_cred(mod), @@ -299,7 +299,7 @@ namespace eap UNREFERENCED_PARAMETER(pEapOutput); assert(ppEapError); - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); return false; } @@ -322,7 +322,7 @@ namespace eap UNREFERENCED_PARAMETER(pAttribs); assert(ppEapError); - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); return false; } @@ -342,14 +342,14 @@ namespace eap UNREFERENCED_PARAMETER(pEapOutput); assert(ppEapError); - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); return false; } /// @} public: - module &m_module; ///< Reference of the EAP module + module *m_module; ///< EAP module config_providers m_cfg; ///< Providers configuration credentials_type m_cred; ///< User credentials interactive_request_type m_intreq; ///< Interactive UI request data diff --git a/lib/EAPBase/src/Config.cpp b/lib/EAPBase/src/Config.cpp index 7061b96..259dfde 100644 --- a/lib/EAPBase/src/Config.cpp +++ b/lib/EAPBase/src/Config.cpp @@ -28,7 +28,7 @@ using namespace winstd; // eap::config ////////////////////////////////////////////////////////////////////// -eap::config::config(_In_ module &mod) : +eap::config::config(_In_ module *mod) : m_module(mod) { } @@ -41,23 +41,25 @@ eap::config::config(_In_ const config &other) : eap::config::config(_Inout_ config &&other) : - m_module(other.m_module) + m_module(std::move(other.m_module)) { } eap::config& eap::config::operator=(_In_ const config &other) { - UNREFERENCED_PARAMETER(other); - assert(&m_module == &other.m_module); // Copy configuration within same module only! + if (this != &other) + m_module = other.m_module; + return *this; } eap::config& eap::config::operator=(_Inout_ config &&other) { - UNREFERENCED_PARAMETER(other); - assert(&m_module == &other.m_module); // Move configuration within same module only! + if (this != &other) + m_module = std::move(other.m_module); + return *this; } @@ -103,7 +105,7 @@ void eap::config::operator>>(_Inout_ cursor_in &cursor) // eap::config_method ////////////////////////////////////////////////////////////////////// -eap::config_method::config_method(_In_ module &mod) : config(mod) +eap::config_method::config_method(_In_ module *mod) : config(mod) { } @@ -140,7 +142,7 @@ eap::config_method& eap::config_method::operator=(_Inout_ config_method &&other) // eap::config_provider ////////////////////////////////////////////////////////////////////// -eap::config_provider::config_provider(_In_ module &mod) : +eap::config_provider::config_provider(_In_ module *mod) : m_read_only(false), config(mod) { @@ -240,84 +242,84 @@ bool eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC // if ((dwResult = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"read-only"), bstrNamespace, m_read_only)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // if (!m_id.empty()) if ((dwResult = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"ID"), bstrNamespace, bstr(m_id))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // com_obj pXmlElProviderInfo; if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ProviderInfo"), bstr(L"ProviderInfo"), bstrNamespace, &pXmlElProviderInfo)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / if (!m_name.empty()) if ((dwResult = eapxml::put_element_value(pDoc, pXmlElProviderInfo, bstr(L"DisplayName"), bstrNamespace, bstr(m_name))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / com_obj pXmlElHelpdesk; if ((dwResult = eapxml::create_element(pDoc, pXmlElProviderInfo, bstr(L"eap-metadata:Helpdesk"), bstr(L"Helpdesk"), bstrNamespace, &pXmlElHelpdesk)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // // if (!m_help_email.empty()) if ((dwResult = eapxml::put_element_value(pDoc, pXmlElHelpdesk, bstr(L"EmailAddress"), bstrNamespace, bstr(m_help_email))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // // if (!m_help_web.empty()) if ((dwResult = eapxml::put_element_value(pDoc, pXmlElHelpdesk, bstr(L"WebAddress"), bstrNamespace, bstr(m_help_web))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // // if (!m_help_phone.empty()) if ((dwResult = eapxml::put_element_value(pDoc, pXmlElHelpdesk, bstr(L"Phone"), bstrNamespace, bstr(m_help_phone))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / if (!m_lbl_alt_credential.empty()) if ((dwResult = eapxml::put_element_value(pDoc, pXmlElProviderInfo, bstr(L"CredentialPrompt"), bstrNamespace, bstr(m_lbl_alt_credential))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / if (!m_lbl_alt_identity.empty()) if ((dwResult = eapxml::put_element_value(pDoc, pXmlElProviderInfo, bstr(L"UserNameLabel"), bstrNamespace, bstr(m_lbl_alt_identity))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / if (!m_lbl_alt_password.empty()) if ((dwResult = eapxml::put_element_value(pDoc, pXmlElProviderInfo, bstr(L"PasswordLabel"), bstrNamespace, bstr(m_lbl_alt_password))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // com_obj pXmlElAuthenticationMethods; if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods"), bstr(L"AuthenticationMethods"), bstrNamespace, &pXmlElAuthenticationMethods)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -325,7 +327,7 @@ bool eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC // com_obj pXmlElAuthenticationMethod; if ((dwResult = eapxml::create_element(pDoc, bstr(L"AuthenticationMethod"), bstrNamespace, &pXmlElAuthenticationMethod))) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -334,7 +336,7 @@ bool eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC return false; if (FAILED(hr = pXmlElAuthenticationMethods->appendChild(pXmlElAuthenticationMethod, NULL))) { - *ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); + *ppEapError = m_module->make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); return false; } } @@ -356,12 +358,12 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR * // if ((dwResult = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:read-only"), &m_read_only)) != ERROR_SUCCESS) m_read_only = true; - m_module.log_config((xpath + L"/read-only").c_str(), m_read_only); + m_module->log_config((xpath + L"/read-only").c_str(), m_read_only); // m_id.clear(); eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:ID"), m_id); - m_module.log_config((xpath + L"/ID").c_str(), m_id.c_str()); + m_module->log_config((xpath + L"/ID").c_str(), m_id.c_str()); // m_name.clear(); @@ -374,12 +376,12 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR * com_obj pXmlElProviderInfo; if (eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ProviderInfo"), &pXmlElProviderInfo) == ERROR_SUCCESS) { wstring lang; - LoadString(m_module.m_instance, 2, lang); + LoadString(m_module->m_instance, 2, lang); wstring xpathProviderInfo(xpath + L"/ProviderInfo"); // eapxml::get_element_localized(pXmlElProviderInfo, bstr(L"eap-metadata:DisplayName"), lang.c_str(), m_name); - m_module.log_config((xpathProviderInfo + L"/DisplayName").c_str(), m_name.c_str()); + m_module->log_config((xpathProviderInfo + L"/DisplayName").c_str(), m_name.c_str()); com_obj pXmlElHelpdesk; if (eapxml::select_element(pXmlElProviderInfo, bstr(L"eap-metadata:Helpdesk"), &pXmlElHelpdesk) == ERROR_SUCCESS) { @@ -387,35 +389,35 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR * // / eapxml::get_element_localized(pXmlElHelpdesk, bstr(L"eap-metadata:EmailAddress"), lang.c_str(), m_help_email); - m_module.log_config((xpathHelpdesk + L"/EmailAddress").c_str(), m_help_email.c_str()); + m_module->log_config((xpathHelpdesk + L"/EmailAddress").c_str(), m_help_email.c_str()); // / eapxml::get_element_localized(pXmlElHelpdesk, bstr(L"eap-metadata:WebAddress"), lang.c_str(), m_help_web); - m_module.log_config((xpathHelpdesk + L"/WebAddress").c_str(), m_help_web.c_str()); + m_module->log_config((xpathHelpdesk + L"/WebAddress").c_str(), m_help_web.c_str()); // / eapxml::get_element_localized(pXmlElHelpdesk, bstr(L"eap-metadata:Phone"), lang.c_str(), m_help_phone); - m_module.log_config((xpathHelpdesk + L"/Phone").c_str(), m_help_phone.c_str()); + m_module->log_config((xpathHelpdesk + L"/Phone").c_str(), m_help_phone.c_str()); } // eapxml::get_element_localized(pXmlElProviderInfo, bstr(L"eap-metadata:CredentialPrompt"), lang.c_str(), m_lbl_alt_credential); - m_module.log_config((xpathProviderInfo + L"/CredentialPrompt").c_str(), m_lbl_alt_credential.c_str()); + m_module->log_config((xpathProviderInfo + L"/CredentialPrompt").c_str(), m_lbl_alt_credential.c_str()); // eapxml::get_element_localized(pXmlElProviderInfo, bstr(L"eap-metadata:UserNameLabel"), lang.c_str(), m_lbl_alt_identity); - m_module.log_config((xpathProviderInfo + L"/UserNameLabel").c_str(), m_lbl_alt_identity.c_str()); + m_module->log_config((xpathProviderInfo + L"/UserNameLabel").c_str(), m_lbl_alt_identity.c_str()); // eapxml::get_element_localized(pXmlElProviderInfo, bstr(L"eap-metadata:PasswordLabel"), lang.c_str(), m_lbl_alt_password); - m_module.log_config((xpathProviderInfo + L"/PasswordLabel").c_str(), m_lbl_alt_password.c_str()); + m_module->log_config((xpathProviderInfo + L"/PasswordLabel").c_str(), m_lbl_alt_password.c_str()); } // Iterate authentication methods (). m_methods.clear(); com_obj pXmlListMethods; if ((dwResult = eapxml::select_nodes(pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods/eap-metadata:AuthenticationMethod"), &pXmlListMethods)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting / elements."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); + *ppEapError = m_module->make_error(ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting / elements."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); return false; } long lCount = 0; @@ -424,7 +426,7 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR * com_obj pXmlElMethod; pXmlListMethods->get_item(i, &pXmlElMethod); - unique_ptr cfg(m_module.make_config_method()); + unique_ptr cfg(m_module->make_config_method()); // Check EAP method type (). DWORD dwMethodID; @@ -500,7 +502,7 @@ void eap::config_provider::operator>>(_Inout_ cursor_in &cursor) for (list::size_type i = 0; i < count; i++) { cursor >> is_nonnull; if (is_nonnull) { - unique_ptr el(m_module.make_config_method()); + unique_ptr el(m_module->make_config_method()); cursor >> *el; m_methods.push_back(std::move(el)); } else @@ -513,7 +515,7 @@ void eap::config_provider::operator>>(_Inout_ cursor_in &cursor) // eap::config_providers ////////////////////////////////////////////////////////////////////// -eap::config_providers::config_providers(_In_ module &mod) : config(mod) +eap::config_providers::config_providers(_In_ module *mod) : config(mod) { } @@ -572,7 +574,7 @@ bool eap::config_providers::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p // Select node. com_obj pXmlElIdentityProviderList; if ((dwResult = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList"), &pXmlElIdentityProviderList)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); + *ppEapError = m_module->make_error(ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); return false; } @@ -580,7 +582,7 @@ bool eap::config_providers::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p // com_obj pXmlElIdentityProvider; if ((dwResult = eapxml::create_element(pDoc, bstr(L"EAPIdentityProvider"), bstrNamespace, &pXmlElIdentityProvider))) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -589,7 +591,7 @@ bool eap::config_providers::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p return false; if (FAILED(hr = pXmlElIdentityProviderList->appendChild(pXmlElIdentityProvider, NULL))) { - *ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); + *ppEapError = m_module->make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); return false; } } @@ -610,7 +612,7 @@ bool eap::config_providers::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR // Iterate authentication providers (). com_obj pXmlListProviders; if ((dwResult = eapxml::select_nodes(pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList/eap-metadata:EAPIdentityProvider"), &pXmlListProviders)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting elements."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); + *ppEapError = m_module->make_error(ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting elements."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); return false; } long lCount = 0; diff --git a/lib/EAPBase/src/Credentials.cpp b/lib/EAPBase/src/Credentials.cpp index a5e668f..e6102d4 100644 --- a/lib/EAPBase/src/Credentials.cpp +++ b/lib/EAPBase/src/Credentials.cpp @@ -30,7 +30,7 @@ using namespace winstd; // eap::credentials ////////////////////////////////////////////////////////////////////// -eap::credentials::credentials(_In_ module &mod) : config(mod) +eap::credentials::credentials(_In_ module *mod) : config(mod) { } @@ -105,7 +105,7 @@ tstring eap::credentials::get_name() const // eap::credentials_pass ////////////////////////////////////////////////////////////////////// -eap::credentials_pass::credentials_pass(_In_ module &mod) : credentials(mod) +eap::credentials_pass::credentials_pass(_In_ module *mod) : credentials(mod) { } @@ -178,7 +178,7 @@ bool eap::credentials_pass::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p // if ((dwResult = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"UserName"), bstrNamespace, bstr(m_identity))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -187,7 +187,7 @@ bool eap::credentials_pass::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p dwResult = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"Password"), bstrNamespace, pass); SecureZeroMemory((BSTR)pass, sizeof(OLECHAR)*pass.length()); if (dwResult != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -207,21 +207,21 @@ bool eap::credentials_pass::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR std::wstring xpath(eapxml::get_xpath(pConfigRoot)); if ((dwResult = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:UserName"), m_identity)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error reading element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error reading element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); return false; } - m_module.log_config((xpath + L"/UserName").c_str(), m_identity.c_str()); + m_module->log_config((xpath + L"/UserName").c_str(), m_identity.c_str()); bstr pass; if ((dwResult = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:Password"), &pass)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error reading element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error reading element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); return false; } m_password = pass; SecureZeroMemory((BSTR)pass, sizeof(OLECHAR)*pass.length()); - m_module.log_config((xpath + L"/Password").c_str(), + m_module->log_config((xpath + L"/Password").c_str(), #ifdef _DEBUG m_password.c_str() #else @@ -272,7 +272,7 @@ bool eap::credentials_pass::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR ** DATA_BLOB entropy_blob = { sizeof(s_entropy), (LPBYTE)s_entropy }; data_blob cred_enc; if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &cred_enc)) { - *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptProtectData failed.")); + *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptProtectData failed.")); return false; } @@ -296,7 +296,7 @@ bool eap::credentials_pass::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR ** (LPTSTR)m_identity.c_str() // UserName }; if (!CredWrite(&cred, 0)) { - *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CredWrite failed.")); + *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" CredWrite failed.")); return false; } @@ -311,7 +311,7 @@ bool eap::credentials_pass::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR // Read credentials. unique_ptr > cred; if (!CredRead(target_name(pszTargetName).c_str(), CRED_TYPE_GENERIC, 0, (PCREDENTIAL*)&cred)) { - *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CredRead failed.")); + *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" CredRead failed.")); return false; } @@ -320,7 +320,7 @@ bool eap::credentials_pass::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR DATA_BLOB entropy_blob = { sizeof(s_entropy) , (LPBYTE)s_entropy }; data_blob cred_int; if (!CryptUnprotectData(&cred_enc, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN | CRYPTPROTECT_VERIFY_PROTECTION, &cred_int)) { - *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptUnprotectData failed.")); + *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptUnprotectData failed.")); return false; } @@ -334,8 +334,8 @@ bool eap::credentials_pass::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR m_identity.clear(); wstring xpath(pszTargetName); - m_module.log_config((xpath + L"/Username").c_str(), m_identity.c_str()); - m_module.log_config((xpath + L"/Password").c_str(), + m_module->log_config((xpath + L"/Username").c_str(), m_identity.c_str()); + m_module->log_config((xpath + L"/Password").c_str(), #ifdef _DEBUG m_password.c_str() #else diff --git a/lib/EAPBase_UI/include/EAP_UI.h b/lib/EAPBase_UI/include/EAP_UI.h index daec946..b8a9ac4 100644 --- a/lib/EAPBase_UI/include/EAP_UI.h +++ b/lib/EAPBase_UI/include/EAP_UI.h @@ -434,7 +434,7 @@ protected: if (pEapError) { if (pEapError->dwWinError != ERROR_NOT_FOUND) wxLogError(winstd::tstring_printf(_("Error reading credentials from Credential Manager: %ls (error %u)"), pEapError->pRootCauseString, pEapError->dwWinError).c_str()); - m_cred.m_module.free_error_memory(pEapError); + m_cred.m_module->free_error_memory(pEapError); } else wxLogError(_("Reading credentials failed.")); } @@ -455,7 +455,7 @@ protected: if (!m_cred.store(m_target.c_str(), &pEapError)) { if (pEapError) { wxLogError(winstd::tstring_printf(_("Error writing credentials to Credential Manager: %ls (error %u)"), pEapError->pRootCauseString, pEapError->dwWinError).c_str()); - m_cred.m_module.free_error_memory(pEapError); + m_cred.m_module->free_error_memory(pEapError); } else wxLogError(_("Writing credentials failed.")); } diff --git a/lib/PAP/include/Config.h b/lib/PAP/include/Config.h index 5704ba7..4e52371 100644 --- a/lib/PAP/include/Config.h +++ b/lib/PAP/include/Config.h @@ -46,9 +46,9 @@ namespace eap /// /// Constructs configuration /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - config_method_pap(_In_ module &mod); + config_method_pap(_In_ module *mod); /// /// Copies configuration diff --git a/lib/PAP/include/Credentials.h b/lib/PAP/include/Credentials.h index 401a201..1460750 100644 --- a/lib/PAP/include/Credentials.h +++ b/lib/PAP/include/Credentials.h @@ -43,9 +43,9 @@ namespace eap /// /// Constructs credentials /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - credentials_pap(_In_ module &mod); + credentials_pap(_In_ module *mod); /// /// Copies credentials diff --git a/lib/PAP/src/Config.cpp b/lib/PAP/src/Config.cpp index f28d693..4e26ea9 100644 --- a/lib/PAP/src/Config.cpp +++ b/lib/PAP/src/Config.cpp @@ -28,7 +28,7 @@ using namespace winstd; // eap::config_method_pap ////////////////////////////////////////////////////////////////////// -eap::config_method_pap::config_method_pap(_In_ module &mod) : config_method_with_cred(mod) +eap::config_method_pap::config_method_pap(_In_ module *mod) : config_method_with_cred(mod) { } diff --git a/lib/PAP/src/Credentials.cpp b/lib/PAP/src/Credentials.cpp index 1e619c9..9ab33ea 100644 --- a/lib/PAP/src/Credentials.cpp +++ b/lib/PAP/src/Credentials.cpp @@ -25,7 +25,7 @@ // eap::credentials_pap ////////////////////////////////////////////////////////////////////// -eap::credentials_pap::credentials_pap(_In_ module &mod) : credentials_pass(mod) +eap::credentials_pap::credentials_pap(_In_ module *mod) : credentials_pass(mod) { } diff --git a/lib/TLS/include/Config.h b/lib/TLS/include/Config.h index 55ad4f2..1729240 100644 --- a/lib/TLS/include/Config.h +++ b/lib/TLS/include/Config.h @@ -60,9 +60,9 @@ namespace eap /// /// Constructs configuration /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - config_method_tls(_In_ module &mod); + config_method_tls(_In_ module *mod); /// /// Copies configuration diff --git a/lib/TLS/include/Credentials.h b/lib/TLS/include/Credentials.h index f19fe8f..38e1804 100644 --- a/lib/TLS/include/Credentials.h +++ b/lib/TLS/include/Credentials.h @@ -46,9 +46,9 @@ namespace eap /// /// Constructs credentials /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - credentials_tls(_In_ module &mod); + credentials_tls(_In_ module *mod); /// /// Copies credentials diff --git a/lib/TLS/include/Session.h b/lib/TLS/include/Session.h index f46d8aa..e537182 100644 --- a/lib/TLS/include/Session.h +++ b/lib/TLS/include/Session.h @@ -66,9 +66,9 @@ namespace eap /// /// Constructor /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - session_tls(_In_ module &mod); + session_tls(_In_ module *mod); /// /// Copies TLS session diff --git a/lib/TLS/src/Config.cpp b/lib/TLS/src/Config.cpp index 1b7aa2e..37af1d4 100644 --- a/lib/TLS/src/Config.cpp +++ b/lib/TLS/src/Config.cpp @@ -66,7 +66,7 @@ tstring eap::get_cert_title(PCCERT_CONTEXT cert) // eap::config_method_tls ////////////////////////////////////////////////////////////////////// -eap::config_method_tls::config_method_tls(_In_ module &mod) : config_method_with_cred(mod) +eap::config_method_tls::config_method_tls(_In_ module *mod) : config_method_with_cred(mod) { } @@ -133,7 +133,7 @@ bool eap::config_method_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode * // com_obj pXmlElServerSideCredential; if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ServerSideCredential"), bstr(L"ServerSideCredential"), bstrNamespace, &pXmlElServerSideCredential)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -141,25 +141,25 @@ bool eap::config_method_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode * // com_obj pXmlElCA; if ((dwResult = eapxml::create_element(pDoc, bstr(L"CA"), bstrNamespace, &pXmlElCA))) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / if ((dwResult = eapxml::put_element_value(pDoc, pXmlElCA, bstr(L"format"), bstrNamespace, bstr(L"PEM"))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / const cert_context &cc = *i; if ((dwResult = eapxml::put_element_base64(pDoc, pXmlElCA, bstr(L"cert-data"), bstrNamespace, cc->pbCertEncoded, cc->cbCertEncoded)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } if (FAILED(hr = pXmlElServerSideCredential->appendChild(pXmlElCA, NULL))) { - *ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); + *ppEapError = m_module->make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); return false; } } @@ -169,7 +169,7 @@ bool eap::config_method_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode * wstring str; MultiByteToWideChar(CP_UTF8, 0, i->c_str(), (int)i->length(), str); if ((dwResult = eapxml::put_element_value(pDoc, pXmlElServerSideCredential, bstr(L"ServerName"), bstrNamespace, bstr(str))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } } @@ -227,7 +227,7 @@ bool eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR list cert_names; for (std::list::const_iterator cert = m_trusted_root_ca.cbegin(), cert_end = m_trusted_root_ca.cend(); cert != cert_end; ++cert) cert_names.push_back(std::move(get_cert_title(*cert))); - m_module.log_config((xpathServerSideCredential + L"/CA").c_str(), cert_names); + m_module->log_config((xpathServerSideCredential + L"/CA").c_str(), cert_names); } // @@ -248,7 +248,7 @@ bool eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR m_server_names.push_back(str); } - m_module.log_config((xpathServerSideCredential + L"/ServerName").c_str(), m_server_names); + m_module->log_config((xpathServerSideCredential + L"/ServerName").c_str(), m_server_names); } } diff --git a/lib/TLS/src/Credentials.cpp b/lib/TLS/src/Credentials.cpp index 9a2c7b8..a11a239 100644 --- a/lib/TLS/src/Credentials.cpp +++ b/lib/TLS/src/Credentials.cpp @@ -28,7 +28,7 @@ using namespace winstd; // eap::credentials_tls ////////////////////////////////////////////////////////////////////// -eap::credentials_tls::credentials_tls(_In_ module &mod) : credentials(mod) +eap::credentials_tls::credentials_tls(_In_ module *mod) : credentials(mod) { } @@ -104,26 +104,26 @@ bool eap::credentials_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC // com_obj pXmlElClientCertificate; if ((dwResult = eapxml::create_element(pDoc, bstr(L"ClientCertificate"), bstrNamespace, &pXmlElClientCertificate))) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } if (m_cert) { // / if ((dwResult = eapxml::put_element_value(pDoc, pXmlElClientCertificate, bstr(L"format"), bstrNamespace, bstr(L"PEM"))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / if ((dwResult = eapxml::put_element_base64(pDoc, pXmlElClientCertificate, bstr(L"cert-data"), bstrNamespace, m_cert->pbCertEncoded, m_cert->cbCertEncoded)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } } if (FAILED(hr = pConfigRoot->appendChild(pXmlElClientCertificate, NULL))) { - *ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); + *ppEapError = m_module->make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); return false; } @@ -147,7 +147,7 @@ bool eap::credentials_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR * // com_obj pXmlElClientCertificate; if ((dwResult = eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ClientCertificate"), &pXmlElClientCertificate)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error reading element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error reading element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); return false; } @@ -161,7 +161,7 @@ bool eap::credentials_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR * m_cert.create(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, aData.data(), (DWORD)aData.size()); } } - m_module.log_config((xpath + L"/ClientCertificate").c_str(), get_name().c_str()); + m_module->log_config((xpath + L"/ClientCertificate").c_str(), get_name().c_str()); return true; } @@ -199,7 +199,7 @@ bool eap::credentials_tls::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **p DATA_BLOB entropy_blob = { sizeof(s_entropy) , (LPBYTE)s_entropy }; data_blob cred_enc; if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &cred_enc)) { - *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptProtectData failed.")); + *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptProtectData failed.")); return false; } @@ -224,7 +224,7 @@ bool eap::credentials_tls::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **p (LPTSTR)name.c_str() // UserName }; if (!CredWrite(&cred, 0)) { - *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CredWrite failed.")); + *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" CredWrite failed.")); return false; } @@ -239,7 +239,7 @@ bool eap::credentials_tls::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR // Read credentials. unique_ptr > cred; if (!CredRead(target_name(pszTargetName).c_str(), CRED_TYPE_GENERIC, 0, (PCREDENTIAL*)&cred)) { - *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CredRead failed.")); + *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" CredRead failed.")); return false; } @@ -248,18 +248,18 @@ bool eap::credentials_tls::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR DATA_BLOB entropy_blob = { sizeof(s_entropy) , (LPBYTE)s_entropy }; data_blob cred_int; if (!CryptUnprotectData(&cred_enc, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN | CRYPTPROTECT_VERIFY_PROTECTION, &cred_int)) { - *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptUnprotectData failed.")); + *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptUnprotectData failed.")); return false; } bool bResult = m_cert.create(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, cred_int.pbData, cred_int.cbData); SecureZeroMemory(cred_int.pbData, cred_int.cbData); if (!bResult) { - *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" Error loading certificate.")); + *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" Error loading certificate.")); return false; } - m_module.log_config((wstring(pszTargetName) + L"/Certificate").c_str(), get_name().c_str()); + m_module->log_config((wstring(pszTargetName) + L"/Certificate").c_str(), get_name().c_str()); return true; } diff --git a/lib/TLS/src/Session.cpp b/lib/TLS/src/Session.cpp index 24dbcd9..3b93f87 100644 --- a/lib/TLS/src/Session.cpp +++ b/lib/TLS/src/Session.cpp @@ -28,7 +28,7 @@ using namespace winstd; // eap::session_tls ////////////////////////////////////////////////////////////////////// -eap::session_tls::session_tls(_In_ module &mod) : +eap::session_tls::session_tls(_In_ module *mod) : m_phase(phase_handshake_start), session(mod) { @@ -152,7 +152,7 @@ bool eap::session_tls::begin( _Out_ EAP_ERROR **ppEapError) { if (dwMaxSendPacketSize <= 10) { - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" Maximum send packet size too small (expected: >%u, received: %u)."), 10, dwMaxSendPacketSize).c_str()); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" Maximum send packet size too small (expected: >%u, received: %u)."), 10, dwMaxSendPacketSize).c_str()); return false; } @@ -176,10 +176,10 @@ bool eap::session_tls::process_request_packet( // Is this a valid EAP-TLS packet? if (dwReceivedPacketSize < 6) { - *ppEapError = m_module.make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, _T(__FUNCTION__) _T(" Packet is too small. EAP-%s packets should be at least 6B.")); + *ppEapError = m_module->make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, _T(__FUNCTION__) _T(" Packet is too small. EAP-%s packets should be at least 6B.")); return false; }/* else if (pReceivedPacket->Data[0] != eap_type_tls) { - *ppEapError = m_module.make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, wstring_printf(_T(__FUNCTION__) _T(" Packet is not EAP-TLS (expected: %u, received: %u)."), eap_type_tls, pReceivedPacket->Data[0]).c_str()); + *ppEapError = m_module->make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, wstring_printf(_T(__FUNCTION__) _T(" Packet is not EAP-TLS (expected: %u, received: %u)."), eap_type_tls, pReceivedPacket->Data[0]).c_str()); return false; }*/ @@ -187,7 +187,7 @@ bool eap::session_tls::process_request_packet( if (pReceivedPacket->Data[1] & tls_flags_length_incl) { // First fragment received. if (dwReceivedPacketSize < 10) { - *ppEapError = m_module.make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, _T(__FUNCTION__) _T(" Packet is too small. EAP-TLS first fragmented packet should be at least 10B.")); + *ppEapError = m_module->make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, _T(__FUNCTION__) _T(" Packet is too small. EAP-TLS first fragmented packet should be at least 10B.")); return false; } @@ -232,17 +232,17 @@ bool eap::session_tls::process_request_packet( case phase_handshake_start: { // Is this an EAP-TLS Start packet? if (m_packet_req.m_code != EapCodeRequest) { - *ppEapError = m_module.make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, wstring_printf(_T(__FUNCTION__) _T(" Packet is not a request (expected: %x, received: %x)."), EapCodeRequest, m_packet_req.m_code).c_str()); + *ppEapError = m_module->make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, wstring_printf(_T(__FUNCTION__) _T(" Packet is not a request (expected: %x, received: %x)."), EapCodeRequest, m_packet_req.m_code).c_str()); return false; } else if (!(m_packet_req.m_flags & tls_flags_start)) { - *ppEapError = m_module.make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, wstring_printf(_T(__FUNCTION__) _T(" Packet is not EAP-TLS Start (expected: %x, received: %x)."), tls_flags_start, m_packet_req.m_flags).c_str()); + *ppEapError = m_module->make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, wstring_printf(_T(__FUNCTION__) _T(" Packet is not EAP-TLS Start (expected: %x, received: %x)."), tls_flags_start, m_packet_req.m_flags).c_str()); return false; } //// Determine minimum EAP-TLS version supported by server and us. //version_t ver_remote = (version_t)(m_packet_req.m_flags & tls_flags_ver_mask); //m_version = std::min(ver_remote, version_0); - //m_module.log_event(&EAPMETHOD_HANDSHAKE_START, event_data(m_cred.target_suffix()), event_data((unsigned char)m_version), event_data((unsigned char)ver_remote), event_data::blank); + //m_module->log_event(&EAPMETHOD_HANDSHAKE_START, event_data(m_cred.target_suffix()), event_data((unsigned char)m_version), event_data((unsigned char)ver_remote), event_data::blank); // Build response packet. m_packet_res.m_code = EapCodeResponse; @@ -251,14 +251,14 @@ bool eap::session_tls::process_request_packet( //if (!m_packet_res.create(EapCodeResponse, pReceivedPacket->Id, eap_type_tls, (BYTE)m_version)) { - // *ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" Error creating packet.")); + // *ppEapError = m_module->make_error(GetLastError(), _T(__FUNCTION__) _T(" Error creating packet.")); // return false; //} break; } default: - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); return false; } @@ -330,6 +330,6 @@ bool eap::session_tls::get_result( UNREFERENCED_PARAMETER(ppResult); assert(ppEapError); - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); return false; } diff --git a/lib/TTLS/include/Config.h b/lib/TTLS/include/Config.h index 3f079d4..8fd64fe 100644 --- a/lib/TTLS/include/Config.h +++ b/lib/TTLS/include/Config.h @@ -46,9 +46,9 @@ namespace eap { /// /// Constructs configuration /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - config_method_ttls(_In_ module &mod); + config_method_ttls(_In_ module *mod); /// /// Copies configuration diff --git a/lib/TTLS/include/Credentials.h b/lib/TTLS/include/Credentials.h index d34c42c..388abea 100644 --- a/lib/TTLS/include/Credentials.h +++ b/lib/TTLS/include/Credentials.h @@ -42,9 +42,9 @@ namespace eap /// /// Constructs credentials /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - credentials_ttls(_In_ module &mod); + credentials_ttls(_In_ module *mod); /// /// Copies credentials diff --git a/lib/TTLS/include/Session.h b/lib/TTLS/include/Session.h index efec1f6..b00621a 100644 --- a/lib/TTLS/include/Session.h +++ b/lib/TTLS/include/Session.h @@ -55,9 +55,9 @@ namespace eap /// /// Constructor /// - /// \param[in] mod Reference of the EAP module to use for global services + /// \param[in] mod EAP module to use for global services /// - session_ttls(_In_ module &mod); + session_ttls(_In_ module *mod); /// /// Copies TTLS session diff --git a/lib/TTLS/src/Config.cpp b/lib/TTLS/src/Config.cpp index 6745fc5..35a8422 100644 --- a/lib/TTLS/src/Config.cpp +++ b/lib/TTLS/src/Config.cpp @@ -28,7 +28,7 @@ using namespace winstd; // eap::config_method_ttls ////////////////////////////////////////////////////////////////////// -eap::config_method_ttls::config_method_ttls(_In_ module &mod) : +eap::config_method_ttls::config_method_ttls(_In_ module *mod) : m_outer(mod), config_method(mod) { @@ -100,14 +100,14 @@ bool eap::config_method_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode // com_obj pXmlElClientSideCredential; if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), bstr(L"ClientSideCredential"), bstrNamespace, &pXmlElClientSideCredential)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } // / if (!m_anonymous_identity.empty()) if ((dwResult = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, bstr(L"AnonymousIdentity"), bstrNamespace, bstr(m_anonymous_identity))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -117,14 +117,14 @@ bool eap::config_method_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode // com_obj pXmlElInnerAuthenticationMethod; if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), bstr(L"InnerAuthenticationMethod"), bstrNamespace, &pXmlElInnerAuthenticationMethod)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } if (dynamic_cast(m_inner.get())) { // / if ((dwResult = eapxml::put_element_value(pDoc, pXmlElInnerAuthenticationMethod, bstr(L"NonEAPAuthMethod"), bstrNamespace, bstr(L"PAP"))) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -132,7 +132,7 @@ bool eap::config_method_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode if (!m_inner->save(pDoc, pXmlElInnerAuthenticationMethod, ppEapError)) return false; } else { - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Unsupported inner authentication method.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Unsupported inner authentication method.")); return false; } @@ -160,7 +160,7 @@ bool eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERRO // eapxml::get_element_value(pXmlElClientSideCredential, bstr(L"eap-metadata:AnonymousIdentity"), m_anonymous_identity); - m_module.log_config((xpathClientSideCredential + L"/AnonymousIdentity").c_str(), m_anonymous_identity.c_str()); + m_module->log_config((xpathClientSideCredential + L"/AnonymousIdentity").c_str(), m_anonymous_identity.c_str()); } if (!m_outer.load(pConfigRoot, ppEapError)) @@ -169,7 +169,7 @@ bool eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERRO // com_obj pXmlElInnerAuthenticationMethod; if ((dwResult = eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), &pXmlElInnerAuthenticationMethod)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error selecting element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error selecting element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); return false; } @@ -186,12 +186,12 @@ bool eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERRO CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrMethod, bstrMethod.length(), L"PAP", -1, NULL, NULL, 0) == CSTR_EQUAL) { // PAP - m_module.log_config((xpath + L"/NonEAPAuthMethod").c_str(), L"PAP"); + m_module->log_config((xpath + L"/NonEAPAuthMethod").c_str(), L"PAP"); m_inner.reset(new config_method_pap(m_module)); if (!m_inner->load(pXmlElInnerAuthenticationMethod, ppEapError)) return false; } else { - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Unsupported inner authentication method.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Unsupported inner authentication method.")); return false; } diff --git a/lib/TTLS/src/Credentials.cpp b/lib/TTLS/src/Credentials.cpp index 3adf4dd..58172b1 100644 --- a/lib/TTLS/src/Credentials.cpp +++ b/lib/TTLS/src/Credentials.cpp @@ -28,7 +28,7 @@ using namespace winstd; // eap::credentials_ttls ////////////////////////////////////////////////////////////////////// -eap::credentials_ttls::credentials_ttls(_In_ module &mod) : +eap::credentials_ttls::credentials_ttls(_In_ module *mod) : m_outer(mod), credentials(mod) { @@ -116,7 +116,7 @@ bool eap::credentials_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p // winstd::com_obj pXmlElInnerAuthenticationMethod; if ((dwResult = eapxml::create_element(pDoc, winstd::bstr(L"InnerAuthenticationMethod"), bstrNamespace, &pXmlElInnerAuthenticationMethod))) { - *ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); + *ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating element.")); return false; } @@ -124,7 +124,7 @@ bool eap::credentials_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p return false; if (FAILED(hr = pConfigRoot->appendChild(pXmlElInnerAuthenticationMethod, NULL))) { - *ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); + *ppEapError = m_module->make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending element.")); return false; } } @@ -149,7 +149,7 @@ bool eap::credentials_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR if (m_inner) { com_obj pXmlElInnerAuthenticationMethod; if ((dwResult = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), &pXmlElInnerAuthenticationMethod)) != ERROR_SUCCESS) { - *ppEapError = m_module.make_error(ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); + *ppEapError = m_module->make_error(ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")); return false; } diff --git a/lib/TTLS/src/Module.cpp b/lib/TTLS/src/Module.cpp index cde822b..4b9fd60 100644 --- a/lib/TTLS/src/Module.cpp +++ b/lib/TTLS/src/Module.cpp @@ -136,7 +136,7 @@ bool eap::peer_ttls::get_identity( bool user_ctx_changed = hTokenImpersonateUser && ImpersonateLoggedOnUser(hTokenImpersonateUser); if (!is_outer_set) { - credentials_tls cred_loaded(*this); + credentials_tls cred_loaded(this); if (cred_loaded.retrieve(cfg_prov.m_id.c_str(), ppEapError)) { // Outer TLS: Using stored credentials. cred_out.m_outer = std::move(cred_loaded); @@ -150,7 +150,7 @@ bool eap::peer_ttls::get_identity( if (!is_inner_set) { unique_ptr cred_loaded; - if (cfg_inner_pap) cred_loaded.reset(new credentials_pap(*this)); + if (cfg_inner_pap) cred_loaded.reset(new credentials_pap(this)); else assert(0); // Unsupported inner authentication method type. if (cred_loaded->retrieve(cfg_prov.m_id.c_str(), ppEapError)) { // Inner PAP: Using stored credentials. diff --git a/lib/TTLS/src/Session.cpp b/lib/TTLS/src/Session.cpp index 9855008..e702e10 100644 --- a/lib/TTLS/src/Session.cpp +++ b/lib/TTLS/src/Session.cpp @@ -28,7 +28,7 @@ using namespace winstd; // eap::session_ttls ////////////////////////////////////////////////////////////////////// -eap::session_ttls::session_ttls(_In_ module &mod) : +eap::session_ttls::session_ttls(_In_ module *mod) : m_version(version_0), session(mod) { @@ -82,7 +82,7 @@ bool eap::session_ttls::process_request_packet( UNREFERENCED_PARAMETER(pEapOutput); assert(ppEapError); - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); return false; } @@ -96,7 +96,7 @@ bool eap::session_ttls::get_response_packet( UNREFERENCED_PARAMETER(pSendPacket); assert(ppEapError); - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); return false; } @@ -110,6 +110,6 @@ bool eap::session_ttls::get_result( UNREFERENCED_PARAMETER(ppResult); assert(ppEapError); - *ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); + *ppEapError = m_module->make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported.")); return false; }