Discrete output of credentials to event log centralized
# Conflicts: # lib/EapHost/src/Credentials.cpp # lib/EapHost/src/StdAfx.h # lib/Events/res/EventsETW.man
This commit is contained in:
parent
64c3837908
commit
4bbc752995
@ -159,7 +159,7 @@ namespace eap
|
|||||||
/// Logs string list config value
|
/// Logs string list config value
|
||||||
///
|
///
|
||||||
template<class _Traits, class _Ax, class _Ax_list>
|
template<class _Traits, class _Ax, class _Ax_list>
|
||||||
inline void log_config(_In_z_ LPCWSTR name, _In_z_ const std::list<std::basic_string<char, _Traits, _Ax>, _Ax_list> &value) const
|
inline void log_config(_In_z_ LPCWSTR name, _In_ const std::list<std::basic_string<char, _Traits, _Ax>, _Ax_list> &value) const
|
||||||
{
|
{
|
||||||
// Prepare a table of event data descriptors.
|
// Prepare a table of event data descriptors.
|
||||||
std::vector<EVENT_DATA_DESCRIPTOR> desc;
|
std::vector<EVENT_DATA_DESCRIPTOR> desc;
|
||||||
@ -177,7 +177,7 @@ namespace eap
|
|||||||
/// Logs Unicode string list config value
|
/// Logs Unicode string list config value
|
||||||
///
|
///
|
||||||
template<class _Traits, class _Ax, class _Ax_list>
|
template<class _Traits, class _Ax, class _Ax_list>
|
||||||
inline void log_config(_In_z_ LPCWSTR name, _In_z_ const std::list<std::basic_string<wchar_t, _Traits, _Ax>, _Ax_list> &value) const
|
inline void log_config(_In_z_ LPCWSTR name, _In_ const std::list<std::basic_string<wchar_t, _Traits, _Ax>, _Ax_list> &value) const
|
||||||
{
|
{
|
||||||
// Prepare a table of event data descriptors.
|
// Prepare a table of event data descriptors.
|
||||||
std::vector<EVENT_DATA_DESCRIPTOR> desc;
|
std::vector<EVENT_DATA_DESCRIPTOR> desc;
|
||||||
@ -204,6 +204,48 @@ namespace eap
|
|||||||
m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_BOOL, _countof(desc), desc);
|
m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_BOOL, _countof(desc), desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Logs binary config value
|
||||||
|
///
|
||||||
|
inline void log_config(_In_z_ LPCWSTR name, _In_bytecount_(size) const void *data, _In_ ULONG size) const
|
||||||
|
{
|
||||||
|
EVENT_DATA_DESCRIPTOR desc[] = {
|
||||||
|
winstd::event_data( name),
|
||||||
|
winstd::event_data( size),
|
||||||
|
winstd::event_data(data, size)
|
||||||
|
};
|
||||||
|
|
||||||
|
m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_BINARY, _countof(desc), desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Discretely logs Unicode string config value
|
||||||
|
///
|
||||||
|
/// If \c _DEBUG is set the value is masked.
|
||||||
|
///
|
||||||
|
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_z_ LPCWSTR value) const
|
||||||
|
{
|
||||||
|
#ifdef _DEBUG
|
||||||
|
log_config(name, value);
|
||||||
|
#else
|
||||||
|
log_config(name, value ? value[0] ? L"********" : L"" : NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Discretely logs binary config value
|
||||||
|
///
|
||||||
|
/// If \c _DEBUG is set the value is masked.
|
||||||
|
///
|
||||||
|
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_bytecount_(size) const void *data, _In_ ULONG size) const
|
||||||
|
{
|
||||||
|
#ifdef _DEBUG
|
||||||
|
log_config(name, data, size);
|
||||||
|
#else
|
||||||
|
log_config(name, data ? size ? L"********" : L"" : NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Logs event
|
/// Logs event
|
||||||
///
|
///
|
||||||
|
@ -319,13 +319,7 @@ void eap::credentials_pass::load(_In_ IXMLDOMNode *pConfigRoot)
|
|||||||
SecureZeroMemory((BSTR)password, sizeof(OLECHAR)*password.length());
|
SecureZeroMemory((BSTR)password, sizeof(OLECHAR)*password.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_module.log_config((xpath + L"/Password").c_str(),
|
m_module.log_config_discrete((xpath + L"/Password").c_str(), m_password.c_str());
|
||||||
#ifdef _DEBUG
|
|
||||||
m_password.c_str()
|
|
||||||
#else
|
|
||||||
L"********"
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -420,13 +414,7 @@ void eap::credentials_pass::retrieve(_In_z_ LPCTSTR pszTargetName, _In_ unsigned
|
|||||||
|
|
||||||
wstring xpath(pszTargetName);
|
wstring xpath(pszTargetName);
|
||||||
m_module.log_config((xpath + L"/Identity").c_str(), m_identity.c_str());
|
m_module.log_config((xpath + L"/Identity").c_str(), m_identity.c_str());
|
||||||
m_module.log_config((xpath + L"/Password").c_str(),
|
m_module.log_config_discrete((xpath + L"/Password").c_str(), m_password.c_str());
|
||||||
#ifdef _DEBUG
|
|
||||||
m_password.c_str()
|
|
||||||
#else
|
|
||||||
L"********"
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -140,7 +140,11 @@ void eap::credentials_tls::load(_In_ IXMLDOMNode *pConfigRoot)
|
|||||||
m_cert.create(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, aData.data(), (DWORD)aData.size());
|
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());
|
|
||||||
|
if (m_cert)
|
||||||
|
m_module.log_config_discrete((xpath + L"/ClientCertificate").c_str(), m_cert->pbCertEncoded, m_cert->cbCertEncoded);
|
||||||
|
else
|
||||||
|
m_module.log_config_discrete((xpath + L"/ClientCertificate").c_str(), NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,7 +238,10 @@ void eap::credentials_tls::retrieve(_In_z_ LPCTSTR pszTargetName, _In_ unsigned
|
|||||||
|
|
||||||
wstring xpath(pszTargetName);
|
wstring xpath(pszTargetName);
|
||||||
m_module.log_config((xpath + L"/Identity").c_str(), m_identity.c_str());
|
m_module.log_config((xpath + L"/Identity").c_str(), m_identity.c_str());
|
||||||
m_module.log_config((xpath + L"/Certificate").c_str(), get_name().c_str());
|
if (m_cert)
|
||||||
|
m_module.log_config_discrete((xpath + L"/Certificate").c_str(), m_cert->pbCertEncoded, m_cert->cbCertEncoded);
|
||||||
|
else
|
||||||
|
m_module.log_config_discrete((xpath + L"/Certificate").c_str(), NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 3872ddb4655d5925b0890da3f80b2f847f3236ed
|
Subproject commit ce1bc5951efad4d9203a24083619fa8069c30323
|
Loading…
x
Reference in New Issue
Block a user