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 3a653be368
commit 3b6d2b2c14
4 changed files with 47 additions and 3 deletions

View File

@ -236,7 +236,8 @@ namespace eap
/// ///
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_z_ LPCWSTR value) const 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); log_config(name, value);
#else #else
log_config(name, value ? value[0] ? L"********" : L"" : NULL); log_config(name, value ? value[0] ? L"********" : L"" : NULL);
@ -254,7 +255,8 @@ namespace eap
/// ///
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_bytecount_(size) const void *data, _In_ ULONG size) const 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); log_config(name, data, size);
#else #else
log_config(name, data ? size ? L"********" : L"" : NULL); log_config(name, data ? size ? L"********" : L"" : NULL);

View File

@ -34,6 +34,9 @@ class wxEAPCredentialsDialog;
class wxEAPNotePanel; class wxEAPNotePanel;
class wxEAPProviderLockedPanel; class wxEAPProviderLockedPanel;
class wxEAPCredentialWarningPanel; class wxEAPCredentialWarningPanel;
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
class wxEAPCredentialLogWarningPanel;
#endif
class wxEAPConfigWindow; class wxEAPConfigWindow;
class wxEAPProviderContactInfoPanel; class wxEAPProviderContactInfoPanel;
class wxEAPProviderIDPanel; class wxEAPProviderIDPanel;
@ -470,6 +473,20 @@ public:
}; };
///
/// EAP credential logging enabled warning note
///
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
class wxEAPCredentialLogWarningPanel : public wxEAPNotePanel
{
public:
///
/// Constructs a notice pannel and set the title text
///
wxEAPCredentialLogWarningPanel(wxWindow* parent);
};
#endif
/// ///
/// EAP Configuration window /// EAP Configuration window
/// ///

View File

@ -101,6 +101,10 @@ wxEAPCredentialsDialog::wxEAPCredentialsDialog(const eap::config_provider &prov,
{ {
// Set banner title. // Set banner title.
m_banner->m_title->SetLabel(wxString::Format(_("%s Credentials"), wxEAPGetProviderName(prov.m_name))); m_banner->m_title->SetLabel(wxString::Format(_("%s Credentials"), wxEAPGetProviderName(prov.m_name)));
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
AddContent(new wxEAPCredentialLogWarningPanel(this));
#endif
} }
@ -231,6 +235,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 // wxEAPConfigWindow
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

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