Password and certificate output to log is no longer conditioned by _DEBUG

This commit is contained in:
Simon Rozman 2016-11-07 10:17:47 +01:00
parent f197c0c937
commit ebe12e5157
4 changed files with 49 additions and 3 deletions

View File

@ -225,7 +225,8 @@ namespace eap
///
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_z_ LPCWSTR value) const
{
#ifdef _DEBUG
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
#pragma message (__FILE__ "(" STRING(__LINE__) "): Warning: !!! DANGER !!! Passwords and certificates will be logged as a clear-text. Please, consider undefining __DANGEROUS__LOG_CONFIDENTIAL_DATA.")
log_config(name, value);
#else
log_config(name, value ? value[0] ? L"********" : L"" : NULL);
@ -239,7 +240,8 @@ namespace eap
///
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_bytecount_(size) const void *data, _In_ ULONG size) const
{
#ifdef _DEBUG
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
#pragma message (__FILE__ "(" STRING(__LINE__) "): Warning: !!! DANGER !!! Passwords and certificates will be logged as a clear-text. Please, consider undefining __DANGEROUS__LOG_CONFIDENTIAL_DATA.")
log_config(name, data, size);
#else
log_config(name, data ? size ? L"********" : L"" : NULL);

View File

@ -67,6 +67,13 @@ class wxEAPProviderLockedPanel;
///
class wxEAPCredentialWarningPanel;
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
///
/// EAP credential logging enabled warning note
///
class wxEAPCredentialLogWarningPanel;
#endif
///
/// EAP Configuration window
///
@ -445,6 +452,18 @@ public:
};
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
class wxEAPCredentialLogWarningPanel : public wxEAPNotePanel
{
public:
///
/// Constructs a notice pannel and set the title text
///
wxEAPCredentialLogWarningPanel(wxWindow* parent);
};
#endif
class wxEAPConfigWindow : public wxScrolledWindow
{
public:

View File

@ -97,6 +97,10 @@ wxEAPCredentialsDialog::wxEAPCredentialsDialog(const eap::config_provider &prov,
{
// Set banner title.
m_banner->m_title->SetLabel(wxString::Format(_("%s Credentials"), wxEAPGetProviderName(prov.m_name)));
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
AddContent(new wxEAPCredentialLogWarningPanel(this));
#endif
}
@ -263,6 +267,27 @@ wxEAPCredentialWarningPanel::wxEAPCredentialWarningPanel(const eap::config_provi
}
//////////////////////////////////////////////////////////////////////
// wxEAPCredentialWarningPanel
//////////////////////////////////////////////////////////////////////
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
wxEAPCredentialLogWarningPanel::wxEAPCredentialLogWarningPanel(wxWindow* parent) : wxEAPNotePanel(parent)
{
// Load and set icon.
winstd::library lib_shell32;
if (lib_shell32.load(_T("imageres.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(105)));
m_note_label->SetLabel(wxString::Format(_("The %s version installed on this computer logs credentials in easy to read visible way."), wxT(PRODUCT_NAME_STR)) + " " +
_("Please, reconsider necessity to enter your credentials."));
m_note_label->Wrap(449);
this->Layout();
}
#endif
//////////////////////////////////////////////////////////////////////
// wxEAPConfigWindow
//////////////////////////////////////////////////////////////////////

@ -1 +1 @@
Subproject commit 6acc318f87980080a95b032156ef8d5f91fdc04c
Subproject commit 6be8e5ee549a51146782ab6f24a7439292a307e4