eap::config::m_module reference again
This commit is contained in:
parent
b0323d894a
commit
2aa4bce8cc
@ -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);
|
||||
|
@ -287,7 +287,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;
|
||||
|
@ -104,7 +104,7 @@ namespace eap
|
||||
///
|
||||
/// \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; ///< EAP module
|
||||
module &m_module; ///< EAP module
|
||||
};
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
config_method(_In_ module *mod);
|
||||
config_method(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
@ -268,7 +268,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
config_method_with_cred(_In_ module *mod);
|
||||
config_method_with_cred(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
@ -373,7 +373,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
config_provider(_In_ module *mod);
|
||||
config_provider(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
@ -492,7 +492,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
config_providers(_In_ module *mod);
|
||||
config_providers(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
|
@ -60,7 +60,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
credentials(_In_ module *mod);
|
||||
credentials(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
@ -209,7 +209,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
credentials_pass(_In_ module *mod);
|
||||
credentials_pass(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
|
@ -62,7 +62,7 @@ namespace eap
|
||||
///
|
||||
/// \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),
|
||||
@ -263,7 +263,7 @@ namespace eap
|
||||
_Out_ DWORD *pdwUIContextDataSize,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
return m_module->pack(m_intreq, ppUIContextData, pdwUIContextDataSize, ppEapError);
|
||||
return m_module.pack(m_intreq, ppUIContextData, pdwUIContextDataSize, ppEapError);
|
||||
}
|
||||
|
||||
|
||||
@ -289,7 +289,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;
|
||||
}
|
||||
|
||||
@ -312,7 +312,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;
|
||||
}
|
||||
|
||||
@ -332,14 +332,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; ///< 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
|
||||
|
@ -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,7 +41,7 @@ eap::config::config(_In_ const config &other) :
|
||||
|
||||
|
||||
eap::config::config(_Inout_ config &&other) :
|
||||
m_module(std::move(other.m_module))
|
||||
m_module(other.m_module)
|
||||
{
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ eap::config::config(_Inout_ config &&other) :
|
||||
eap::config& eap::config::operator=(_In_ const config &other)
|
||||
{
|
||||
if (this != &other)
|
||||
m_module = other.m_module;
|
||||
assert(&m_module == &other.m_module);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -58,7 +58,7 @@ eap::config& eap::config::operator=(_In_ const config &other)
|
||||
eap::config& eap::config::operator=(_Inout_ config &&other)
|
||||
{
|
||||
if (this != &other)
|
||||
m_module = std::move(other.m_module);
|
||||
assert(&m_module == &other.m_module);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -105,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)
|
||||
{
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ eap::config_method& eap::config_method::operator=(_Inout_ config_method &&other)
|
||||
// eap::config_method_with_cred
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::config_method_with_cred::config_method_with_cred(_In_ module *mod) :
|
||||
eap::config_method_with_cred::config_method_with_cred(_In_ module &mod) :
|
||||
m_allow_save(true),
|
||||
m_use_preshared(false),
|
||||
config_method(mod)
|
||||
@ -206,13 +206,13 @@ bool eap::config_method_with_cred::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOM
|
||||
// <ClientSideCredential>
|
||||
winstd::com_obj<IXMLDOMElement> 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 <ClientSideCredential> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ClientSideCredential> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ClientSideCredential>/<allow-save>
|
||||
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 <allow-save> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <allow-save> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -239,14 +239,14 @@ bool eap::config_method_with_cred::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP
|
||||
|
||||
// <allow-save>
|
||||
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);
|
||||
|
||||
if (m_preshared->load(pXmlElClientSideCredential, ppEapError)) {
|
||||
m_use_preshared = true;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@ -288,7 +288,7 @@ void eap::config_method_with_cred::operator>>(_Inout_ cursor_in &cursor)
|
||||
// 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)
|
||||
{
|
||||
@ -388,84 +388,84 @@ bool eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC
|
||||
|
||||
// <read-only>
|
||||
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 <read-only> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <read-only> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ID>
|
||||
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 <ID> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ID> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ProviderInfo>
|
||||
com_obj<IXMLDOMElement> 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 <ProviderInfo> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ProviderInfo> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ProviderInfo>/<DisplayName>
|
||||
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 <DisplayName> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <DisplayName> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ProviderInfo>/<Helpdesk>
|
||||
com_obj<IXMLDOMElement> 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 <Helpdesk> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <Helpdesk> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ProviderInfo>/<Helpdesk>/<EmailAddress>
|
||||
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 <EmailAddress> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <EmailAddress> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ProviderInfo>/<Helpdesk>/<WebAddress>
|
||||
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 <WebAddress> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <WebAddress> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ProviderInfo>/<Helpdesk>/<Phone>
|
||||
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 <Phone> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <Phone> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ProviderInfo>/<CredentialPrompt>
|
||||
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 <CredentialPrompt> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <CredentialPrompt> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ProviderInfo>/<UserNameLabel>
|
||||
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 <UserNameLabel> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <UserNameLabel> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ProviderInfo>/<PasswordLabel>
|
||||
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 <PasswordLabel> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <PasswordLabel> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <AuthenticationMethods>
|
||||
com_obj<IXMLDOMElement> 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 <AuthenticationMethods> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <AuthenticationMethods> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -473,7 +473,7 @@ bool eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC
|
||||
// <AuthenticationMethod>
|
||||
com_obj<IXMLDOMElement> pXmlElAuthenticationMethod;
|
||||
if ((dwResult = eapxml::create_element(pDoc, bstr(L"AuthenticationMethod"), bstrNamespace, &pXmlElAuthenticationMethod))) {
|
||||
*ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <AuthenticationMethod> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <AuthenticationMethod> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -482,7 +482,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 <AuthenticationMethod> element."));
|
||||
*ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending <AuthenticationMethod> element."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -504,12 +504,12 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR *
|
||||
// <read-only>
|
||||
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);
|
||||
|
||||
// <ID>
|
||||
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());
|
||||
|
||||
// <ProviderInfo>
|
||||
m_name.clear();
|
||||
@ -522,12 +522,12 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR *
|
||||
com_obj<IXMLDOMElement> 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");
|
||||
|
||||
// <DisplayName>
|
||||
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<IXMLDOMElement> pXmlElHelpdesk;
|
||||
if (eapxml::select_element(pXmlElProviderInfo, bstr(L"eap-metadata:Helpdesk"), &pXmlElHelpdesk) == ERROR_SUCCESS) {
|
||||
@ -535,35 +535,35 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR *
|
||||
|
||||
// <Helpdesk>/<EmailAddress>
|
||||
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());
|
||||
|
||||
// <Helpdesk>/<WebAddress>
|
||||
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());
|
||||
|
||||
// <Helpdesk>/<Phone>
|
||||
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());
|
||||
}
|
||||
|
||||
// <CredentialPrompt>
|
||||
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());
|
||||
|
||||
// <UserNameLabel>
|
||||
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());
|
||||
|
||||
// <PasswordLabel>
|
||||
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 (<AuthenticationMethods>).
|
||||
m_methods.clear();
|
||||
com_obj<IXMLDOMNodeList> 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 <AuthenticationMethods>/<AuthenticationMethod> 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 <AuthenticationMethods>/<AuthenticationMethod> elements."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document."));
|
||||
return false;
|
||||
}
|
||||
long lCount = 0;
|
||||
@ -572,7 +572,7 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR *
|
||||
com_obj<IXMLDOMNode> pXmlElMethod;
|
||||
pXmlListMethods->get_item(i, &pXmlElMethod);
|
||||
|
||||
unique_ptr<config_method> cfg(m_module->make_config_method());
|
||||
unique_ptr<config_method> cfg(m_module.make_config_method());
|
||||
|
||||
// Check EAP method type (<EAPMethod>).
|
||||
DWORD dwMethodID;
|
||||
@ -648,7 +648,7 @@ void eap::config_provider::operator>>(_Inout_ cursor_in &cursor)
|
||||
for (list<config_method>::size_type i = 0; i < count; i++) {
|
||||
cursor >> is_nonnull;
|
||||
if (is_nonnull) {
|
||||
unique_ptr<config_method> el(m_module->make_config_method());
|
||||
unique_ptr<config_method> el(m_module.make_config_method());
|
||||
cursor >> *el;
|
||||
m_methods.push_back(std::move(el));
|
||||
} else
|
||||
@ -661,7 +661,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)
|
||||
{
|
||||
}
|
||||
|
||||
@ -720,7 +720,7 @@ bool eap::config_providers::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p
|
||||
// Select <EAPIdentityProviderList> node.
|
||||
com_obj<IXMLDOMNode> 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 <EAPIdentityProviderList> 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 <EAPIdentityProviderList> element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -728,7 +728,7 @@ bool eap::config_providers::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p
|
||||
// <EAPIdentityProvider>
|
||||
com_obj<IXMLDOMElement> pXmlElIdentityProvider;
|
||||
if ((dwResult = eapxml::create_element(pDoc, bstr(L"EAPIdentityProvider"), bstrNamespace, &pXmlElIdentityProvider))) {
|
||||
*ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <EAPIdentityProvider> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <EAPIdentityProvider> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -737,7 +737,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 <EAPIdentityProvider> element."));
|
||||
*ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending <EAPIdentityProvider> element."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -758,7 +758,7 @@ bool eap::config_providers::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR
|
||||
// Iterate authentication providers (<EAPIdentityProvider>).
|
||||
com_obj<IXMLDOMNodeList> 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 <EAPIdentityProviderList><EAPIdentityProvider> 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 <EAPIdentityProviderList><EAPIdentityProvider> elements."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document."));
|
||||
return false;
|
||||
}
|
||||
long lCount = 0;
|
||||
|
@ -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
|
||||
|
||||
// <UserName>
|
||||
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 <UserName> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <UserName> 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 <Password> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <Password> 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 <UserName> 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 <UserName> 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 <Password> 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 <Password> 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<CREDENTIAL, CredFree_delete<CREDENTIAL> > 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
|
||||
|
@ -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."));
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
config_method_pap(_In_ module *mod);
|
||||
config_method_pap(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
|
@ -45,7 +45,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
credentials_pap(_In_ module *mod);
|
||||
credentials_pap(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
|
@ -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)
|
||||
{
|
||||
m_preshared.reset(new credentials_pap(mod));
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
config_method_tls(_In_ module *mod);
|
||||
config_method_tls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
|
@ -48,7 +48,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
credentials_tls(_In_ module *mod);
|
||||
credentials_tls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
|
@ -68,7 +68,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
session_tls(_In_ module *mod);
|
||||
session_tls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies TLS session
|
||||
|
@ -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)
|
||||
{
|
||||
m_preshared.reset(new credentials_tls(mod));
|
||||
}
|
||||
@ -134,7 +134,7 @@ bool eap::config_method_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *
|
||||
// <ServerSideCredential>
|
||||
com_obj<IXMLDOMElement> 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 <ServerSideCredential> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ServerSideCredential> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -142,25 +142,25 @@ bool eap::config_method_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *
|
||||
// <CA>
|
||||
com_obj<IXMLDOMElement> pXmlElCA;
|
||||
if ((dwResult = eapxml::create_element(pDoc, bstr(L"CA"), bstrNamespace, &pXmlElCA))) {
|
||||
*ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <CA> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <CA> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <CA>/<format>
|
||||
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 <format> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <format> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <CA>/<cert-data>
|
||||
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 <cert-data> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <cert-data> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FAILED(hr = pXmlElServerSideCredential->appendChild(pXmlElCA, NULL))) {
|
||||
*ppEapError = m_module->make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending <CA> element."));
|
||||
*ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending <CA> element."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -170,7 +170,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 <ServerName> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ServerName> element."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -228,7 +228,7 @@ bool eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR
|
||||
list<tstring> cert_names;
|
||||
for (std::list<winstd::cert_context>::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);
|
||||
}
|
||||
|
||||
// <ServerName>
|
||||
@ -249,7 +249,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
// <ClientCertificate>
|
||||
com_obj<IXMLDOMElement> pXmlElClientCertificate;
|
||||
if ((dwResult = eapxml::create_element(pDoc, bstr(L"ClientCertificate"), bstrNamespace, &pXmlElClientCertificate))) {
|
||||
*ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ClientCertificate> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ClientCertificate> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_cert) {
|
||||
// <ClientCertificate>/<format>
|
||||
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 <format> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <format> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ClientCertificate>/<cert-data>
|
||||
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 <cert-data> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <cert-data> element."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILED(hr = pConfigRoot->appendChild(pXmlElClientCertificate, NULL))) {
|
||||
*ppEapError = m_module->make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending <ClientCertificate> element."));
|
||||
*ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending <ClientCertificate> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ bool eap::credentials_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR *
|
||||
// <ClientCertificate>
|
||||
com_obj<IXMLDOMElement> 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 <ClientCertificate> 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 <ClientCertificate> 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<CREDENTIAL, CredFree_delete<CREDENTIAL> > 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;
|
||||
}
|
||||
|
@ -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<credentials_tls, bool, bool>(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<version_t>(ver_remote, version_0);
|
||||
//m_module->log_event(&EAPMETHOD_HANDSHAKE_START1, event_data((DWORD)pReceivedPacket->Data[0]), event_data((unsigned char)m_version), event_data((unsigned char)ver_remote), event_data::blank);
|
||||
//m_module.log_event(&EAPMETHOD_HANDSHAKE_START1, event_data((DWORD)pReceivedPacket->Data[0]), 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;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace eap {
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
config_method_ttls(_In_ module *mod);
|
||||
config_method_ttls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
|
@ -44,7 +44,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
credentials_ttls(_In_ module *mod);
|
||||
credentials_ttls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
|
@ -57,7 +57,7 @@ namespace eap
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
session_ttls(_In_ module *mod);
|
||||
session_ttls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies TTLS session
|
||||
|
@ -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
|
||||
// <ClientSideCredential>
|
||||
com_obj<IXMLDOMElement> 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 <ClientSideCredential> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ClientSideCredential> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// <ClientSideCredential>/<AnonymousIdentity>
|
||||
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 <AnonymousIdentity> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <AnonymousIdentity> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -117,14 +117,14 @@ bool eap::config_method_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode
|
||||
// <InnerAuthenticationMethod>
|
||||
com_obj<IXMLDOMElement> 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 <InnerAuthenticationMethod> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <InnerAuthenticationMethod> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dynamic_cast<const config_method_pap*>(m_inner.get())) {
|
||||
// <InnerAuthenticationMethod>/<NonEAPAuthMethod>
|
||||
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 <NonEAPAuthMethod> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <NonEAPAuthMethod> 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
|
||||
|
||||
// <AnonymousIdentity>
|
||||
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
|
||||
// <InnerAuthenticationMethod>
|
||||
com_obj<IXMLDOMElement> 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 <InnerAuthenticationMethod> 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 <InnerAuthenticationMethod> 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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
// <InnerAuthenticationMethod>
|
||||
winstd::com_obj<IXMLDOMElement> pXmlElInnerAuthenticationMethod;
|
||||
if ((dwResult = eapxml::create_element(pDoc, winstd::bstr(L"InnerAuthenticationMethod"), bstrNamespace, &pXmlElInnerAuthenticationMethod))) {
|
||||
*ppEapError = m_module->make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <InnerAuthenticationMethod> element."));
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <InnerAuthenticationMethod> 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 <InnerAuthenticationMethod> element."));
|
||||
*ppEapError = m_module.make_error(HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error appending <InnerAuthenticationMethod> element."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -149,7 +149,7 @@ bool eap::credentials_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR
|
||||
if (m_inner) {
|
||||
com_obj<IXMLDOMNode> 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 <InnerAuthenticationMethod> 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 <InnerAuthenticationMethod> element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ eap::peer_ttls::peer_ttls() : peer(eap_type_ttls)
|
||||
|
||||
eap::config_method* eap::peer_ttls::make_config_method()
|
||||
{
|
||||
return new config_method_ttls(this);
|
||||
return new config_method_ttls(*this);
|
||||
}
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ bool eap::peer_ttls::get_identity(
|
||||
assert(ppEapError);
|
||||
|
||||
// Unpack configuration.
|
||||
config_providers cfg(this);
|
||||
config_providers cfg(*this);
|
||||
if (!unpack(cfg, pConnectionData, dwConnectionDataSize, ppEapError))
|
||||
return false;
|
||||
else if (cfg.m_providers.empty() || cfg.m_providers.front().m_methods.empty()) {
|
||||
@ -91,7 +91,7 @@ bool eap::peer_ttls::get_identity(
|
||||
}
|
||||
|
||||
// Unpack cached credentials.
|
||||
credentials_ttls cred_in(this);
|
||||
credentials_ttls cred_in(*this);
|
||||
if (dwUserDataSize && !unpack(cred_in, pUserData, dwUserDataSize, ppEapError))
|
||||
return false;
|
||||
|
||||
@ -101,7 +101,7 @@ bool eap::peer_ttls::get_identity(
|
||||
assert(cfg_method);
|
||||
const config_method_pap *cfg_inner_pap = dynamic_cast<const config_method_pap*>(cfg_method->m_inner.get());
|
||||
|
||||
credentials_ttls cred_out(this);
|
||||
credentials_ttls cred_out(*this);
|
||||
|
||||
// Determine credential storage target(s). Also used as user-friendly method name for logging.
|
||||
eap_type_t type_inner;
|
||||
@ -160,7 +160,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);
|
||||
@ -174,7 +174,7 @@ bool eap::peer_ttls::get_identity(
|
||||
|
||||
if (!is_inner_set) {
|
||||
unique_ptr<credentials> 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.
|
||||
@ -302,7 +302,7 @@ bool eap::peer_ttls::credentials_xml2blob(
|
||||
UNREFERENCED_PARAMETER(dwConnectionDataSize);
|
||||
|
||||
// Load credentials from XML.
|
||||
credentials_ttls cred(this);
|
||||
credentials_ttls cred(*this);
|
||||
if (!cred.load(pConfigRoot, ppEapError))
|
||||
return false;
|
||||
|
||||
|
@ -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<credentials_ttls, bool, bool>(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;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ eap::peer_ttls_ui::peer_ttls_ui() : peer_ui(eap_type_ttls)
|
||||
|
||||
eap::config_method* eap::peer_ttls_ui::make_config_method()
|
||||
{
|
||||
return new config_method_ttls(this);
|
||||
return new config_method_ttls(*this);
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ bool eap::peer_ttls_ui::config_xml2blob(
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
|
||||
// Load configuration from XML.
|
||||
config_providers cfg(this);
|
||||
config_providers cfg(*this);
|
||||
if (!cfg.load(pConfigRoot, ppEapError))
|
||||
return false;
|
||||
|
||||
@ -69,7 +69,7 @@ bool eap::peer_ttls_ui::config_blob2xml(
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
|
||||
// Unpack configuration.
|
||||
config_providers cfg(this);
|
||||
config_providers cfg(*this);
|
||||
if (!unpack(cfg, pConnectionData, dwConnectionDataSize, ppEapError))
|
||||
return false;
|
||||
|
||||
@ -87,7 +87,7 @@ bool eap::peer_ttls_ui::invoke_config_ui(
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
// Unpack configuration.
|
||||
config_providers cfg(this);
|
||||
config_providers cfg(*this);
|
||||
if (dwConnectionDataInSize && !unpack(cfg, pConnectionDataIn, dwConnectionDataInSize, ppEapError))
|
||||
return false;
|
||||
|
||||
@ -135,7 +135,7 @@ bool eap::peer_ttls_ui::invoke_identity_ui(
|
||||
_Out_ LPWSTR *ppwszIdentity,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
config_providers cfg(this);
|
||||
config_providers cfg(*this);
|
||||
if (!unpack(cfg, pConnectionData, dwConnectionDataSize, ppEapError))
|
||||
return false;
|
||||
else if (cfg.m_providers.empty() || cfg.m_providers.front().m_methods.empty()) {
|
||||
@ -143,7 +143,7 @@ bool eap::peer_ttls_ui::invoke_identity_ui(
|
||||
return false;
|
||||
}
|
||||
|
||||
credentials_ttls cred(this);
|
||||
credentials_ttls cred(*this);
|
||||
if (dwUserDataSize && !unpack(cred, pUserData, dwUserDataSize, ppEapError))
|
||||
return false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user