Missing EapHost peer initialization added

This commit is contained in:
Simon Rozman 2016-10-10 14:31:32 +02:00
parent e94e3bdd60
commit e40ee1c34b
2 changed files with 15 additions and 2 deletions

View File

@ -20,6 +20,8 @@
#include "StdAfx.h" #include "StdAfx.h"
#pragma comment(lib, "Eappprxy.lib")
using namespace std; using namespace std;
using namespace winstd; using namespace winstd;
@ -50,11 +52,18 @@ void eap::peer_ttls::initialize()
if (MsiQueryFeatureState(_T(PRODUCT_VERSION_GUID), _T("featEAPTTLS")) != INSTALLSTATE_UNKNOWN) if (MsiQueryFeatureState(_T(PRODUCT_VERSION_GUID), _T("featEAPTTLS")) != INSTALLSTATE_UNKNOWN)
MsiUseFeature(_T(PRODUCT_VERSION_GUID), _T("featEAPTTLS")); MsiUseFeature(_T(PRODUCT_VERSION_GUID), _T("featEAPTTLS"));
#endif #endif
// Initialize EapHost for EAPMsg based inner authentication methods.
DWORD dwResult = EapHostPeerInitialize();
if (dwResult != ERROR_SUCCESS)
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerConfigBlob2Xml failed.");
} }
void eap::peer_ttls::shutdown() void eap::peer_ttls::shutdown()
{ {
// Uninitialize EapHost. It was initialized for EAPMsg based inner authentication methods.
EapHostPeerUninitialize();
} }
@ -364,8 +373,6 @@ const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
UNREFERENCED_PARAMETER(dwUserDataSize); UNREFERENCED_PARAMETER(dwUserDataSize);
#endif #endif
user_impersonator impersonating(hTokenImpersonateUser);
for (auto cfg_prov = cfg.m_providers.cbegin(), cfg_prov_end = cfg.m_providers.cend(); cfg_prov != cfg_prov_end; ++cfg_prov) { for (auto cfg_prov = cfg.m_providers.cbegin(), cfg_prov_end = cfg.m_providers.cend(); cfg_prov != cfg_prov_end; ++cfg_prov) {
wstring target_name(std::move(cfg_prov->get_id())); wstring target_name(std::move(cfg_prov->get_id()));
@ -387,6 +394,8 @@ const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
// Combine outer credentials. // Combine outer credentials.
LPCTSTR _target_name = (dwFlags & EAP_FLAG_GUEST_ACCESS) == 0 ? target_name.c_str() : NULL; LPCTSTR _target_name = (dwFlags & EAP_FLAG_GUEST_ACCESS) == 0 ? target_name.c_str() : NULL;
eap::credentials::source_t src_outer = cred->credentials_tls::combine( eap::credentials::source_t src_outer = cred->credentials_tls::combine(
dwFlags,
hTokenImpersonateUser,
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE
has_cached ? cred_in.m_cred.get() : NULL, has_cached ? cred_in.m_cred.get() : NULL,
#else #else
@ -401,6 +410,8 @@ const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
// Combine inner credentials. // Combine inner credentials.
eap::credentials::source_t src_inner = cred->m_inner->combine( eap::credentials::source_t src_inner = cred->m_inner->combine(
dwFlags,
hTokenImpersonateUser,
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE
has_cached ? dynamic_cast<credentials_ttls*>(cred_in.m_cred.get())->m_inner.get() : NULL, has_cached ? dynamic_cast<credentials_ttls*>(cred_in.m_cred.get())->m_inner.get() : NULL,
#else #else

View File

@ -41,4 +41,6 @@
#include <WinStd/EAP.h> #include <WinStd/EAP.h>
#include <EapHostError.h> #include <EapHostError.h>
#include <EapHostPeerTypes.h>
#include <eappapis.h>
#include <schannel.h> #include <schannel.h>