EAP_USE_NATIVE_CREDENTIAL_CACHE is now 0/1 #defined

This commit is contained in:
Simon Rozman 2017-02-02 13:25:24 +01:00
parent 964bf4032a
commit 6f049d2692
5 changed files with 27 additions and 17 deletions

View File

@ -45,10 +45,7 @@ namespace eap
namespace eap namespace eap
{ {
/// /// \addtogroup EAPBaseCred
/// \defgroup EAPBaseCred Credentials
/// Credential management
///
/// @{ /// @{
/// ///

View File

@ -28,12 +28,25 @@
/// @{ /// @{
#ifndef EAP_ENCRYPT_BLOBS #ifndef EAP_ENCRYPT_BLOBS
/// ///
/// Compiler variable to control whether BLOBs leaving our module get encrypted /// BLOBs leaving our module are encrypted
/// ///
#define EAP_ENCRYPT_BLOBS 1 #define EAP_ENCRYPT_BLOBS 1
#endif #endif
/// @} /// @}
///
/// \defgroup EAPBaseCred Credentials
/// Credential management
///
/// @{
#ifndef EAP_USE_NATIVE_CREDENTIAL_CACHE
///
/// Using EapHost credential cache
///
#define EAP_USE_NATIVE_CREDENTIAL_CACHE 0
#endif
/// @}
#define _HOST_LOW_ENDIAN #define _HOST_LOW_ENDIAN
#if !defined(RC_INVOKED) && !defined(MIDL_PASS) #if !defined(RC_INVOKED) && !defined(MIDL_PASS)

View File

@ -198,7 +198,7 @@ namespace eap
// The following members are required to avoid memory leakage in get_result() and get_ui_context(). // The following members are required to avoid memory leakage in get_result() and get_ui_context().
BYTE *m_blob_cfg; ///< Configuration BLOB BYTE *m_blob_cfg; ///< Configuration BLOB
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
BYTE *m_blob_cred; ///< Credentials BLOB BYTE *m_blob_cred; ///< Credentials BLOB
#endif #endif
BYTE *m_blob_ui_ctx; ///< User Interface context data BYTE *m_blob_ui_ctx; ///< User Interface context data

View File

@ -346,7 +346,7 @@ void eap::peer_ttls::get_result(
s->m_blob_cfg = pResult->pConnectionData; s->m_blob_cfg = pResult->pConnectionData;
} }
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
pResult->fSaveUserData = TRUE; pResult->fSaveUserData = TRUE;
pack(s->m_cred, &pResult->pUserData, &pResult->dwSizeofUserData); pack(s->m_cred, &pResult->pUserData, &pResult->dwSizeofUserData);
if (s->m_blob_cred) if (s->m_blob_cred)
@ -430,7 +430,7 @@ const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
_Out_ credentials_connection& cred_out, _Out_ credentials_connection& cred_out,
_In_ HANDLE hTokenImpersonateUser) _In_ HANDLE hTokenImpersonateUser)
{ {
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
// Unpack cached credentials. // Unpack cached credentials.
credentials_connection cred_in(*this, cfg); credentials_connection cred_in(*this, cfg);
if (dwUserDataSize) if (dwUserDataSize)
@ -455,7 +455,7 @@ const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
// Combine credentials. We could use eap::credentials_ttls() to do all the work, but we would not know which credentials is missing then. // Combine credentials. We could use eap::credentials_ttls() to do all the work, but we would not know which credentials is missing then.
credentials_ttls *cred = dynamic_cast<credentials_ttls*>(cfg_method->make_credentials()); credentials_ttls *cred = dynamic_cast<credentials_ttls*>(cfg_method->make_credentials());
cred_out.m_cred.reset(cred); cred_out.m_cred.reset(cred);
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
bool has_cached = cred_in.m_cred && cred_in.match(*cfg_prov); bool has_cached = cred_in.m_cred && cred_in.match(*cfg_prov);
#endif #endif
@ -464,7 +464,7 @@ const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
eap::credentials::source_t src_outer = cred->credentials_tls::combine( eap::credentials::source_t src_outer = cred->credentials_tls::combine(
dwFlags, dwFlags,
hTokenImpersonateUser, hTokenImpersonateUser,
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
has_cached ? cred_in.m_cred.get() : NULL, has_cached ? cred_in.m_cred.get() : NULL,
#else #else
NULL, NULL,
@ -480,7 +480,7 @@ const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
eap::credentials::source_t src_inner = cred->m_inner->combine( eap::credentials::source_t src_inner = cred->m_inner->combine(
dwFlags, dwFlags,
hTokenImpersonateUser, hTokenImpersonateUser,
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if 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
NULL, NULL,
@ -526,7 +526,7 @@ eap::peer_ttls::session::session(_In_ module &mod) :
m_cfg(mod), m_cfg(mod),
m_cred(mod, m_cfg), m_cred(mod, m_cfg),
m_blob_cfg(NULL), m_blob_cfg(NULL),
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
m_blob_cred(NULL), m_blob_cred(NULL),
#endif #endif
m_blob_ui_ctx(NULL) m_blob_ui_ctx(NULL)
@ -538,7 +538,7 @@ eap::peer_ttls::session::~session()
if (m_blob_cfg) if (m_blob_cfg)
m_module.free_memory(m_blob_cfg); m_module.free_memory(m_blob_cfg);
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
if (m_blob_cred) if (m_blob_cred)
m_module.free_memory(m_blob_cred); m_module.free_memory(m_blob_cred);
#endif #endif

View File

@ -159,7 +159,7 @@ void eap::peer_ttls_ui::invoke_identity_ui(
config_connection cfg(*this); config_connection cfg(*this);
unpack(cfg, pConnectionData, dwConnectionDataSize); unpack(cfg, pConnectionData, dwConnectionDataSize);
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
// Unpack cached credentials. // Unpack cached credentials.
credentials_connection cred_in(*this, cfg); credentials_connection cred_in(*this, cfg);
if (dwUserDataSize) if (dwUserDataSize)
@ -214,7 +214,7 @@ void eap::peer_ttls_ui::invoke_identity_ui(
cred_out.m_id = cfg_prov->m_id; cred_out.m_id = cfg_prov->m_id;
auto cred = dynamic_cast<credentials_ttls*>(cfg_method->make_credentials()); auto cred = dynamic_cast<credentials_ttls*>(cfg_method->make_credentials());
cred_out.m_cred.reset(cred); cred_out.m_cred.reset(cred);
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
bool has_cached = cred_in.m_cred && cred_in.match(*cfg_prov); bool has_cached = cred_in.m_cred && cred_in.match(*cfg_prov);
#endif #endif
@ -229,7 +229,7 @@ void eap::peer_ttls_ui::invoke_identity_ui(
eap::credentials::source_t src_outer = cred->credentials_tls::combine( eap::credentials::source_t src_outer = cred->credentials_tls::combine(
dwFlags, dwFlags,
NULL, NULL,
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if EAP_USE_NATIVE_CREDENTIAL_CACHE
has_cached ? cred_in.m_cred.get() : NULL, has_cached ? cred_in.m_cred.get() : NULL,
#else #else
NULL, NULL,
@ -273,7 +273,7 @@ void eap::peer_ttls_ui::invoke_identity_ui(
eap::credentials::source_t src_inner = cred->m_inner->combine( eap::credentials::source_t src_inner = cred->m_inner->combine(
dwFlags, dwFlags,
NULL, NULL,
#ifdef EAP_USE_NATIVE_CREDENTIAL_CACHE #if 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
NULL, NULL,