Issues with pre-shared credentials after being moved to heap fixed

This commit is contained in:
Simon Rozman 2016-08-05 16:28:21 +02:00
parent 42459ff16a
commit b0323d894a
2 changed files with 3 additions and 3 deletions

View File

@ -153,7 +153,7 @@ eap::config_method_with_cred::config_method_with_cred(_In_ module *mod) :
eap::config_method_with_cred::config_method_with_cred(_In_ const config_method_with_cred &other) : eap::config_method_with_cred::config_method_with_cred(_In_ const config_method_with_cred &other) :
m_allow_save(other.m_allow_save), m_allow_save(other.m_allow_save),
m_use_preshared(other.m_use_preshared), m_use_preshared(other.m_use_preshared),
m_preshared((credentials*)other.m_preshared->clone()), m_preshared(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr),
config_method(other) config_method(other)
{ {
} }
@ -174,7 +174,7 @@ eap::config_method_with_cred& eap::config_method_with_cred::operator=(_In_ const
(config_method&)*this = other; (config_method&)*this = other;
m_allow_save = other.m_allow_save; m_allow_save = other.m_allow_save;
m_use_preshared = other.m_use_preshared; m_use_preshared = other.m_use_preshared;
m_preshared.reset((credentials*)other.m_preshared->clone()); m_preshared.reset(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr);
} }
return *this; return *this;

View File

@ -136,7 +136,7 @@ bool eap::peer_ttls::get_identity(
if (!is_outer_set && cfg_method->m_outer.m_use_preshared) { if (!is_outer_set && cfg_method->m_outer.m_use_preshared) {
// Outer TLS: Using preshared credentials. // Outer TLS: Using preshared credentials.
cred_out.m_outer = (credentials_tls&)cfg_method->m_outer.m_preshared; cred_out.m_outer = *(credentials_tls*)cfg_method->m_outer.m_preshared.get();
log_event(&EAPMETHOD_TRACE_EVT_CRED_PRESHARED1, event_data((DWORD)eap_type_tls), event_data(cred_out.m_outer.get_name()), event_data::blank); log_event(&EAPMETHOD_TRACE_EVT_CRED_PRESHARED1, event_data((DWORD)eap_type_tls), event_data(cred_out.m_outer.get_name()), event_data::blank);
is_outer_set = true; is_outer_set = true;
} }