Compare commits

..

11 Commits

25 changed files with 450 additions and 143 deletions

View File

@@ -51,7 +51,7 @@ PROJECT_BRIEF = "EAP Supplicant for Windows"
# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo # and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
# to the output directory. # to the output directory.
PROJECT_LOGO = PROJECT_LOGO = include\icon_ui.ico
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is # into which the generated documentation will be written. If a relative path is
@@ -694,7 +694,7 @@ CITE_BIB_FILES =
# messages are off. # messages are off.
# The default value is: NO. # The default value is: NO.
QUIET = NO QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are # The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES # generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
@@ -718,7 +718,7 @@ WARN_IF_UNDOCUMENTED = YES
# markup commands wrongly. # markup commands wrongly.
# The default value is: YES. # The default value is: YES.
WARN_IF_DOC_ERROR = NO WARN_IF_DOC_ERROR = YES
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return # are documented, but have no documentation for their parameters or return
@@ -790,11 +790,16 @@ RECURSIVE = YES
# run. # run.
EXCLUDE = \ EXCLUDE = \
CredWrite\README.md \
EventMonitor\res \ EventMonitor\res \
lib\EAPBase_UI\res \ lib\EAPBase_UI\res \
lib\EapHost_UI\res \
lib\TLS_UI\res \ lib\TLS_UI\res \
lib\TTLS_UI\res \ lib\TTLS_UI\res \
lib\WinStd lib\WinStd \
lib\wxExtend \
MsiUseFeature\README.md \
WLANManager\README.md
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded # directories that are symbolic links (a Unix file system feature) are excluded

View File

@@ -2,14 +2,14 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: EAPMethods\n" "Project-Id-Version: EAPMethods\n"
"POT-Creation-Date: 2016-09-28 13:27+0200\n" "POT-Creation-Date: 2016-11-07 12:58+0100\n"
"PO-Revision-Date: 2016-06-02 12:27+0200\n" "PO-Revision-Date: 2016-06-02 12:27+0200\n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n" "Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n" "Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.9\n" "X-Generator: Poedit 1.8.10\n"
"X-Poedit-Basepath: ../..\n" "X-Poedit-Basepath: ../..\n"
"X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: _\n" "X-Poedit-KeywordsList: _\n"
@@ -44,7 +44,7 @@ msgstr ""
msgid "Opens dialog with provider settings" msgid "Opens dialog with provider settings"
msgstr "" msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:229 lib/EAPBase_UI/include/EAP_UI.h:581 #: lib/EAPBase_UI/res/wxEAP_UI.cpp:229 lib/EAPBase_UI/include/EAP_UI.h:605
#, c-format #, c-format
msgid "%s User Credentials" msgid "%s User Credentials"
msgstr "" msgstr ""
@@ -211,66 +211,75 @@ msgstr ""
msgid "(Warning: Once locked, you can not revert using this dialog!)" msgid "(Warning: Once locked, you can not revert using this dialog!)"
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:97 #: lib/EAPBase_UI/src/EAP_UI.cpp:99
#, c-format #, c-format
msgid "%s Credentials" msgid "%s Credentials"
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:122 lib/EAPBase_UI/include/EAP_UI.h:355 #: lib/EAPBase_UI/src/EAP_UI.cpp:128 lib/EAPBase_UI/include/EAP_UI.h:367
#: lib/EAPBase_UI/include/EAP_UI.h:365 lib/EAPBase_UI/res/wxEAP_UI.h:119 #: lib/EAPBase_UI/include/EAP_UI.h:377 lib/EAPBase_UI/res/wxEAP_UI.h:119
msgid "EAP Credentials" msgid "EAP Credentials"
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:165 #: lib/EAPBase_UI/src/EAP_UI.cpp:173
#, c-format #, c-format
msgid "For additional help and instructions, please contact %s at:" msgid "For additional help and instructions, please contact %s at:"
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:166 #: lib/EAPBase_UI/src/EAP_UI.cpp:174
msgid "your provider" msgid "your provider"
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:185 #: lib/EAPBase_UI/src/EAP_UI.cpp:193
msgid "Open the default web browser" msgid "Open the default web browser"
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:196 #: lib/EAPBase_UI/src/EAP_UI.cpp:204
msgid "Open your e-mail program" msgid "Open your e-mail program"
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:207 #: lib/EAPBase_UI/src/EAP_UI.cpp:215
msgid "Dial the phone number" msgid "Dial the phone number"
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:227 #: lib/EAPBase_UI/src/EAP_UI.cpp:235
#, c-format #, c-format
msgid "%s has pre-set parts of this configuration. Those parts are locked to prevent accidental modification." msgid "%s has pre-set parts of this configuration. Those parts are locked to prevent accidental modification."
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:228 #: lib/EAPBase_UI/src/EAP_UI.cpp:236
msgid "Your provider" msgid "Your provider"
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:249 #: lib/EAPBase_UI/src/EAP_UI.cpp:257
msgid "Previous attempt to connect reported invalid credentials." msgid "Previous attempt to connect reported invalid credentials."
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:250 #: lib/EAPBase_UI/src/EAP_UI.cpp:258
msgid "Previous attempt to connect reported your credentials expired." msgid "Previous attempt to connect reported your credentials expired."
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:251 #: lib/EAPBase_UI/src/EAP_UI.cpp:259
msgid "Previous attempt to connect reported your credentials are being changed." msgid "Previous attempt to connect reported your credentials are being changed."
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:252 #: lib/EAPBase_UI/src/EAP_UI.cpp:260
msgid "Previous attempt to connect failed." msgid "Previous attempt to connect failed."
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:253 #: lib/EAPBase_UI/src/EAP_UI.cpp:261
msgid "Please, make sure your credentials are correct, or try again later." msgid "Please, make sure your credentials are correct, or try again later."
msgstr "" msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:282
#, c-format
msgid "The %s version installed on this computer logs credentials in visible and easy to read way."
msgstr ""
#: lib/EAPBase_UI/src/EAP_UI.cpp:283
msgid "Please, reconsider necessity to enter your credentials."
msgstr ""
#: lib/MSCHAPv2_UI/src/MSCHAPv2_UI.cpp:33 #: lib/MSCHAPv2_UI/src/MSCHAPv2_UI.cpp:33
msgid "MSCHAPv2 User ID and Password" msgid "MSCHAPv2 User ID and Password"
msgstr "" msgstr ""
@@ -331,7 +340,7 @@ msgstr ""
msgid "(Example: foo.bar.com;server2.bar.com)" msgid "(Example: foo.bar.com;server2.bar.com)"
msgstr "" msgstr ""
#: lib/TLS_UI/res/wxTLS_UI.cpp:119 lib/TLS_UI/src/TLS_UI.cpp:571 #: lib/TLS_UI/res/wxTLS_UI.cpp:119 lib/TLS_UI/src/TLS_UI.cpp:317
msgid "User Certificate" msgid "User Certificate"
msgstr "" msgstr ""
@@ -351,46 +360,37 @@ msgstr ""
msgid "Your identity (username@domain) to override one from certificate; or blank to use one provided in certificate" msgid "Your identity (username@domain) to override one from certificate; or blank to use one provided in certificate"
msgstr "" msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:118 #: lib/TLS_UI/src/TLS_UI.cpp:59 lib/EAPBase_UI/include/EAP_UI.h:803
#, c-format #: lib/EAPBase_UI/include/EAP_UI.h:812
msgid "Invalid character in host name found: %c"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:118
msgid "Validation conflict"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:327 lib/EAPBase_UI/include/EAP_UI.h:769
#: lib/EAPBase_UI/include/EAP_UI.h:778
msgid "<empty>" msgid "<empty>"
msgstr "" msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:500 #: lib/TLS_UI/src/TLS_UI.cpp:246
msgid "Add Certificate" msgid "Add Certificate"
msgstr "" msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:501 #: lib/TLS_UI/src/TLS_UI.cpp:247
msgid "Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)" msgid "Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)"
msgstr "" msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:502 #: lib/TLS_UI/src/TLS_UI.cpp:248
msgid "X.509 Certificate Files (*.cer;*.crt;*.der;*.pem)" msgid "X.509 Certificate Files (*.cer;*.crt;*.der;*.pem)"
msgstr "" msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:503 #: lib/TLS_UI/src/TLS_UI.cpp:249
msgid "PKCS #7 Certificate Files (*.p7b)" msgid "PKCS #7 Certificate Files (*.p7b)"
msgstr "" msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:504 #: lib/TLS_UI/src/TLS_UI.cpp:250
msgid "All Files (*.*)" msgid "All Files (*.*)"
msgstr "" msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:520 #: lib/TLS_UI/src/TLS_UI.cpp:264
#, c-format #, c-format
msgid "Invalid or unsupported certificate file %s" msgid "Invalid or unsupported certificate file %s"
msgstr "" msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:520 #: lib/TLS_UI/src/TLS_UI.cpp:264
msgid "Error" msgid "Error"
msgstr "" msgstr ""
@@ -431,76 +431,76 @@ msgid "Custom outer identity to use"
msgstr "" msgstr ""
#: lib/TTLS_UI/src/Module.cpp:274 lib/TTLS_UI/src/Module.cpp:284 #: lib/TTLS_UI/src/Module.cpp:274 lib/TTLS_UI/src/Module.cpp:284
#: lib/EAPBase_UI/include/EAP_UI.h:696 #: lib/EAPBase_UI/include/EAP_UI.h:724
#, c-format #, c-format
msgid "Error writing credentials to Credential Manager: %hs (error %u)" msgid "Error writing credentials to Credential Manager: %hs (error %u)"
msgstr "" msgstr ""
#: lib/TTLS_UI/src/Module.cpp:276 lib/TTLS_UI/src/Module.cpp:286 #: lib/TTLS_UI/src/Module.cpp:276 lib/TTLS_UI/src/Module.cpp:286
#: lib/EAPBase_UI/include/EAP_UI.h:699 #: lib/EAPBase_UI/include/EAP_UI.h:727
msgid "Writing credentials failed." msgid "Writing credentials failed."
msgstr "" msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:36 lib/TTLS_UI/src/TTLS_UI.cpp:181 #: lib/TTLS_UI/src/TTLS_UI.cpp:36 lib/TTLS_UI/src/TTLS_UI.cpp:182
msgid "Inner Authentication" msgid "Inner Authentication"
msgstr "" msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:61 lib/TTLS_UI/src/TTLS_UI.cpp:196 #: lib/TTLS_UI/src/TTLS_UI.cpp:61 lib/TTLS_UI/src/TTLS_UI.cpp:197
msgid "Outer Authentication" msgid "Outer Authentication"
msgstr "" msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:187 #: lib/TTLS_UI/src/TTLS_UI.cpp:188
msgid "Select inner authentication method from the list" msgid "Select inner authentication method from the list"
msgstr "" msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:189 #: lib/TTLS_UI/src/TTLS_UI.cpp:190
msgid "PAP" msgid "PAP"
msgstr "" msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:191 #: lib/TTLS_UI/src/TTLS_UI.cpp:192
msgid "MSCHAPv2" msgid "MSCHAPv2"
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:292 #: lib/EAPBase_UI/include/EAP_UI.h:302
#, c-format #, c-format
msgid "Are you sure you want to permanently remove %s provider from configuration?" msgid "Are you sure you want to permanently remove %s provider from configuration?"
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:292 #: lib/EAPBase_UI/include/EAP_UI.h:302
msgid "Warning" msgid "Warning"
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:552 #: lib/EAPBase_UI/include/EAP_UI.h:576
msgid "Provider Settings" msgid "Provider Settings"
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:717 #: lib/EAPBase_UI/include/EAP_UI.h:747
#, c-format #, c-format
msgid "Deleting credentials failed (error %u)." msgid "Deleting credentials failed (error %u)."
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:754 #: lib/EAPBase_UI/include/EAP_UI.h:788
#, c-format #, c-format
msgid "<error %u>" msgid "<error %u>"
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:758 #: lib/EAPBase_UI/include/EAP_UI.h:792
msgid "<error>" msgid "<error>"
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:769 lib/EAPBase_UI/include/EAP_UI.h:778 #: lib/EAPBase_UI/include/EAP_UI.h:803 lib/EAPBase_UI/include/EAP_UI.h:812
msgid "<blank ID>" msgid "<blank ID>"
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:820 #: lib/EAPBase_UI/include/EAP_UI.h:854
msgid "&Remember" msgid "&Remember"
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:821 #: lib/EAPBase_UI/include/EAP_UI.h:855
msgid "Check if you would like to save credentials" msgid "Check if you would like to save credentials"
msgstr "" msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:964 #: lib/EAPBase_UI/include/EAP_UI.h:1000
msgid "<Your Organization>" msgid "<Your Organization>"
msgstr "" msgstr ""

View File

@@ -19,8 +19,10 @@
*/ */
/// ///
/// EventMonitor application /// \defgroup EventMonitor Event Monitor
/// Real-time log of application events
/// ///
class wxEventMonitorApp; class wxEventMonitorApp;
#pragma once #pragma once
@@ -32,6 +34,12 @@ class wxEventMonitorApp;
#include <wx/intl.h> #include <wx/intl.h>
/// \addtogroup EventMonitor
/// @{
///
/// EventMonitor application
///
class wxEventMonitorApp : public wxApp class wxEventMonitorApp : public wxApp
{ {
public: public:
@@ -57,4 +65,6 @@ public:
wxLocale m_locale; ///< Current locale wxLocale m_locale; ///< Current locale
}; };
/// @}
wxDECLARE_APP(wxEventMonitorApp); wxDECLARE_APP(wxEventMonitorApp);

View File

@@ -115,6 +115,8 @@ void wxEventTraceProcessorThread::Abort()
} }
/// \cond internal
wxThread::ExitCode wxEventTraceProcessorThread::Entry() wxThread::ExitCode wxEventTraceProcessorThread::Entry()
{ {
// Process events. // Process events.
@@ -139,6 +141,8 @@ VOID WINAPI wxEventTraceProcessorThread::EventRecordCallback(_In_ PEVENT_RECORD
_this->m_parent->QueueEvent(new wxETWEvent(wxEVT_ETW_EVENT, *pEvent)); _this->m_parent->QueueEvent(new wxETWEvent(wxEVT_ETW_EVENT, *pEvent));
} }
/// \endcond
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// wxETWListCtrl // wxETWListCtrl
@@ -228,7 +232,7 @@ wxETWListCtrl::wxETWListCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos
wxLogError(_("Access denied creating event session: you need administrative privileges (Run As Administrator) or be a member of Performance Log Users group to start event tracing session.")); wxLogError(_("Access denied creating event session: you need administrative privileges (Run As Administrator) or be a member of Performance Log Users group to start event tracing session."));
return; return;
} else if (ulResult == ERROR_ALREADY_EXISTS) { } else if (ulResult == ERROR_ALREADY_EXISTS) {
wxLogDebug(_("The %s event session already exists."), name.c_str()); wxLogDebug(_("The %s event session already exists."), name);
// Do not despair... Retry with a new session name and ID. // Do not despair... Retry with a new session name and ID.
continue; continue;
} else { } else {
@@ -460,6 +464,8 @@ void wxETWListCtrl::RebuildItems()
} }
/// \cond internal
bool wxETWListCtrl::IsVisible(const EVENT_RECORD &rec) const bool wxETWListCtrl::IsVisible(const EVENT_RECORD &rec) const
{ {
return return
@@ -561,7 +567,7 @@ wxString wxETWListCtrl::OnGetItemText(long item, long column) const
} }
wxString wxETWListCtrl::OnGetItemText(const event_rec &rec, long column) const wxString wxETWListCtrl::OnGetItemText(const winstd::event_rec &rec, long column) const
{ {
switch (column) { switch (column) {
case 0: { case 0: {
@@ -678,6 +684,8 @@ void wxETWListCtrl::OnETWEvent(wxETWEvent& event)
} }
} }
/// \endcond
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// wxPersistentETWListCtrl // wxPersistentETWListCtrl
@@ -703,7 +711,7 @@ void wxPersistentETWListCtrl::Save() const
col.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_WIDTH); col.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_WIDTH);
for (int i = 0, n = wnd->GetColumnCount(); i < n; i++) { for (int i = 0, n = wnd->GetColumnCount(); i < n; i++) {
wnd->GetColumn(i, col); wnd->GetColumn(i, col);
SaveValue(wxString::Format(wxT("Column%sWidth"), col.GetText().c_str()), col.GetWidth()); SaveValue(wxString::Format(wxT("Column%sWidth"), col.GetText()), col.GetWidth());
} }
SaveValue(wxT("ScrollAuto"), wnd->m_scroll_auto); SaveValue(wxT("ScrollAuto"), wnd->m_scroll_auto);
@@ -728,7 +736,7 @@ bool wxPersistentETWListCtrl::Restore()
wnd->GetColumn(i, col); wnd->GetColumn(i, col);
int width; int width;
if (RestoreValue(wxString::Format(wxT("Column%sWidth"), col.GetText().c_str()), &width)) if (RestoreValue(wxString::Format(wxT("Column%sWidth"), col.GetText()), &width))
wnd->SetColumnWidth(i, width); wnd->SetColumnWidth(i, width);
} }

View File

@@ -20,32 +20,23 @@
#include <wx/event.h> #include <wx/event.h>
/// \addtogroup EventMonitor
/// @{
/// ///
/// Maximum number of event records kept /// Maximum number of event records kept
/// ///
#define wxETWEVENT_RECORDS_MAX 1000000 #define wxETWEVENT_RECORDS_MAX 1000000
/// /// @}
/// ETW event
///
class wxETWEvent; class wxETWEvent;
wxDECLARE_EVENT(wxEVT_ETW_EVENT, wxETWEvent); wxDECLARE_EVENT(wxEVT_ETW_EVENT, wxETWEvent);
#define wxETWEventHandler(func) wxEVENT_HANDLER_CAST(wxETWEventFunction, func) #define wxETWEventHandler(func) wxEVENT_HANDLER_CAST(wxETWEventFunction, func)
#define EVT_ETW_EVENT(func) wx__DECLARE_EVT0(wxEVT_ETW_EVENT, wxETWEventHandler(func)) #define EVT_ETW_EVENT(func) wx__DECLARE_EVT0(wxEVT_ETW_EVENT, wxETWEventHandler(func))
///
/// Event trace processor
///
class wxEventTraceProcessorThread; class wxEventTraceProcessorThread;
///
/// Event list control
///
class wxETWListCtrl; class wxETWListCtrl;
///
/// Supports saving/restoring wxETWListCtrl state
///
class wxPersistentETWListCtrl; class wxPersistentETWListCtrl;
#pragma once #pragma once
@@ -61,47 +52,106 @@ class wxPersistentETWListCtrl;
#include <set> #include <set>
/// \addtogroup EventMonitor
/// @{
///
/// ETW event
///
class wxETWEvent : public wxEvent class wxETWEvent : public wxEvent
{ {
public: public:
///
/// Creates ETW event
///
/// \param[in] type The unique type of event
/// \param[in] record ETW event record
///
wxETWEvent(wxEventType type = wxEVT_NULL, const EVENT_RECORD &record = s_record_null); wxETWEvent(wxEventType type = wxEVT_NULL, const EVENT_RECORD &record = s_record_null);
///
/// Copies an ETW event
///
/// \param[in] event ETW event to copy from
///
wxETWEvent(const wxETWEvent& event); wxETWEvent(const wxETWEvent& event);
virtual wxEvent *Clone() const { return new wxETWEvent(*this); }
inline const winstd::event_rec& GetRecord() const { return m_record; } ///
inline winstd::event_rec& GetRecord() { return m_record; } /// Clones the ETW event
///
/// \returns Event copy
///
virtual wxEvent *Clone() const
{
return new wxETWEvent(*this);
}
protected: ///
bool DoSetExtendedData(size_t extended_data_count, const EVENT_HEADER_EXTENDED_DATA_ITEM *extended_data); /// Returns ETW event record assosiated with event
bool DoSetUserData(size_t user_data_length, const void *user_data); ///
inline const winstd::event_rec& GetRecord() const
{
return m_record;
}
///
/// Returns ETW event record assosiated with event
///
inline winstd::event_rec& GetRecord()
{
return m_record;
}
private: private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxETWEvent) DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxETWEvent)
public: public:
static const EVENT_RECORD s_record_null; static const EVENT_RECORD s_record_null; ///< Blank ETW event record
protected: protected:
winstd::event_rec m_record; ///< ETW event record winstd::event_rec m_record; ///< ETW event record
}; };
///
/// Prototype of the function consuming `wxETWEvent` events
///
typedef void (wxEvtHandler::*wxETWEventFunction)(wxETWEvent&); typedef void (wxEvtHandler::*wxETWEventFunction)(wxETWEvent&);
///
/// Monitors ETW events and forwards them as `wxETWEvent` event
///
class wxEventTraceProcessorThread : public wxThread class wxEventTraceProcessorThread : public wxThread
{ {
public: public:
///
/// A thread to process ETW events
///
/// \param[in] parent Event handler this thread will send record notifications
/// \param[in] sessions An array of sessions to monitor
///
wxEventTraceProcessorThread(wxEvtHandler *parent, const wxArrayString &sessions); wxEventTraceProcessorThread(wxEvtHandler *parent, const wxArrayString &sessions);
///
/// Destructor
///
virtual ~wxEventTraceProcessorThread(); virtual ~wxEventTraceProcessorThread();
///
/// Closes all session handles to allow graceful thread termination
///
void Abort(); void Abort();
protected: protected:
/// \cond internal
virtual ExitCode Entry(); virtual ExitCode Entry();
/// \endcond
private: private:
/// \cond internal
static VOID WINAPI EventRecordCallback(PEVENT_RECORD pEvent); static VOID WINAPI EventRecordCallback(PEVENT_RECORD pEvent);
/// \endcond
protected: protected:
std::vector<TRACEHANDLE> m_traces; ///< An array of tracing sessions this thread is monitoring std::vector<TRACEHANDLE> m_traces; ///< An array of tracing sessions this thread is monitoring
@@ -109,6 +159,9 @@ protected:
}; };
///
/// Event list control
///
class wxETWListCtrl : public wxListCtrl class wxETWListCtrl : public wxListCtrl
{ {
protected: protected:
@@ -117,6 +170,9 @@ protected:
/// ///
struct less_guid : public std::binary_function<GUID, GUID, bool> struct less_guid : public std::binary_function<GUID, GUID, bool>
{ {
///
/// Compares two GUIDs
///
bool operator()(const GUID &a, const GUID &b) const bool operator()(const GUID &a, const GUID &b) const
{ {
if (a.Data1 < b.Data1) return true; if (a.Data1 < b.Data1) return true;
@@ -136,6 +192,17 @@ protected:
typedef std::set<GUID, less_guid> guidset; typedef std::set<GUID, less_guid> guidset;
public: public:
///
/// Creates a list control for ETW log display
///
/// \param[in] parent Parent window. Must not be \c NULL.
/// \param[in] id Window identifier. The value \c wxID_ANY indicates a default value.
/// \param[in] pos Window position. If \c wxDefaultPosition is specified then a default position is chosen.
/// \param[in] size Window size. If \c wxDefaultSize is specified then the window is sized appropriately.
/// \param[in] style Window style. See \c wxListCtrl.
/// \param[in] validator Window validator
/// \param[in] name Window name
///
wxETWListCtrl( wxETWListCtrl(
wxWindow *parent, wxWindow *parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
@@ -144,21 +211,70 @@ public:
long style = wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VIRTUAL|wxNO_BORDER, long style = wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VIRTUAL|wxNO_BORDER,
const wxValidator &validator = wxDefaultValidator, const wxValidator &validator = wxDefaultValidator,
const wxString &name = wxListCtrlNameStr); const wxString &name = wxListCtrlNameStr);
///
/// Destructor
///
virtual ~wxETWListCtrl(); virtual ~wxETWListCtrl();
inline bool IsEmpty() const { return m_rec_db.empty(); } ///
/// Returns true if the list is empty
///
inline bool IsEmpty() const
{
return m_rec_db.empty();
}
///
/// Copies selected rows to clipboard
///
void CopySelected() const; void CopySelected() const;
///
/// Copies all rows (including hidden ones) to clipboard
///
void CopyAll() const; void CopyAll() const;
///
/// Empties the list
///
void ClearAll(); void ClearAll();
///
/// Selects all rows
///
void SelectAll(); void SelectAll();
///
/// Clears row selection
///
void SelectNone(); void SelectNone();
///
/// Rebuilds the list
///
void RebuildItems(); void RebuildItems();
///
/// Checks if given ETW source is enabled
///
/// \param[in] guid GUID of ETW source
///
/// \returns
/// - \c true if ETW source with \p guid GUID is enabled;
/// - \c false otherwise.
///
inline bool IsSourceEnabled(const GUID &guid) const inline bool IsSourceEnabled(const GUID &guid) const
{ {
return m_sources.find(guid) != m_sources.end(); return m_sources.find(guid) != m_sources.end();
} }
///
/// Enables/Disables ETW source
///
/// \param[in] guid GUID of ETW source
/// \param[in] enable \c true to enable, \c false to disable
///
inline void EnableSource(const GUID &guid, bool enable = true) inline void EnableSource(const GUID &guid, bool enable = true)
{ {
auto s = m_sources.find(guid); auto s = m_sources.find(guid);
@@ -178,6 +294,7 @@ public:
friend class wxPersistentETWListCtrl; // Allow saving/restoring window state. friend class wxPersistentETWListCtrl; // Allow saving/restoring window state.
protected: protected:
/// \cond internal
bool IsVisible(const EVENT_RECORD &rec) const; bool IsVisible(const EVENT_RECORD &rec) const;
void FormatRow(const winstd::event_rec &rec, std::string &rowA, std::wstring &rowW) const; void FormatRow(const winstd::event_rec &rec, std::string &rowA, std::wstring &rowW) const;
bool CopyToClipboard(const std::string &dataA, const std::wstring &dataW) const; bool CopyToClipboard(const std::string &dataA, const std::wstring &dataW) const;
@@ -186,6 +303,8 @@ protected:
virtual wxString OnGetItemText(long item, long column) const; virtual wxString OnGetItemText(long item, long column) const;
virtual wxString OnGetItemText(const winstd::event_rec &rec, long column) const; virtual wxString OnGetItemText(const winstd::event_rec &rec, long column) const;
void OnETWEvent(wxETWEvent& event); void OnETWEvent(wxETWEvent& event);
/// \endcond
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
public: public:
@@ -209,18 +328,48 @@ protected:
}; };
///
/// Supports saving/restoring `wxETWListCtrl` state
///
class wxPersistentETWListCtrl : public wxPersistentWindow<wxETWListCtrl> class wxPersistentETWListCtrl : public wxPersistentWindow<wxETWListCtrl>
{ {
public: public:
///
/// Constructor for a persistent window object
///
/// \param[in] wnd Window this object will save/restore
///
wxPersistentETWListCtrl(wxETWListCtrl *wnd); wxPersistentETWListCtrl(wxETWListCtrl *wnd);
///
/// Returns the string uniquely identifying the objects supported by this adapter.
///
/// \returns This implementation always returns `wxT(wxPERSIST_TLW_KIND)`
///
virtual wxString GetKind() const; virtual wxString GetKind() const;
///
/// Saves the object properties
///
virtual void Save() const; virtual void Save() const;
///
/// Restores the object properties
///
/// \returns
/// - \c true if the properties were successfully restored;
/// - \c false otherwise.
///
virtual bool Restore(); virtual bool Restore();
}; };
///
/// Creates persistent window object for `wxETWListCtrl` class window
///
inline wxPersistentObject *wxCreatePersistentObject(wxETWListCtrl *wnd) inline wxPersistentObject *wxCreatePersistentObject(wxETWListCtrl *wnd)
{ {
return new wxPersistentETWListCtrl(wnd); return new wxPersistentETWListCtrl(wnd);
} }
/// @}

View File

@@ -261,6 +261,8 @@ wxEventMonitorFrame::~wxEventMonitorFrame()
} }
/// \cond internal
void wxEventMonitorFrame::OnExit(wxCommandEvent& event) void wxEventMonitorFrame::OnExit(wxCommandEvent& event)
{ {
Close(); Close();
@@ -408,6 +410,8 @@ void wxEventMonitorFrame::OnViewToolbar(wxCommandEvent& event)
} }
} }
/// \endcond
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// wxPersistentEventMonitorFrame // wxPersistentEventMonitorFrame

View File

@@ -18,14 +18,7 @@
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>. along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
*/ */
///
/// EventMonitor main frame
///
class wxEventMonitorFrame; class wxEventMonitorFrame;
///
/// Supports saving/restoring wxEventMonitorFrame GUI state
///
class wxPersistentEventMonitorFrame; class wxPersistentEventMonitorFrame;
#pragma once; #pragma once;
@@ -42,6 +35,12 @@ class wxPersistentEventMonitorFrame;
#include <WinStd/Win.h> #include <WinStd/Win.h>
/// \addtogroup EventMonitor
/// @{
///
/// EventMonitor main frame
///
class wxEventMonitorFrame : public wxFrame class wxEventMonitorFrame : public wxFrame
{ {
protected: protected:
@@ -62,12 +61,28 @@ protected:
}; };
public: public:
///
/// Creates an EventMonitor frame window
///
/// \param[in] parent The window parent. This may be \c NULL. If it is non-NULL, the frame will always be displayed on top of the parent window on Windows.
/// \param[in] id The window identifier. It may take a value of \c wxID_ANY to indicate a default value.
/// \param[in] title The caption to be displayed on the frame's title bar.
/// \param[in] pos The window position. The value \c wxDefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform.
/// \param[in] size The window size. The value \c wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform.
/// \param[in] style The window style. See `wxFrame` class description.
/// \param[in] name The name of the window. This parameter is used to associate a name with the item, allowing the application user to set Motif resource values for individual windows.
///
wxEventMonitorFrame(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Event Monitor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,400), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString& name = wxT("EventMonitor")); wxEventMonitorFrame(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Event Monitor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,400), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString& name = wxT("EventMonitor"));
///
/// Destructor
///
~wxEventMonitorFrame(); ~wxEventMonitorFrame();
friend class wxPersistentEventMonitorFrame; friend class wxPersistentEventMonitorFrame;
protected: protected:
/// \cond internal
void OnExit(wxCommandEvent& event); void OnExit(wxCommandEvent& event);
void OnEditCopyUpdate(wxUpdateUIEvent& event); void OnEditCopyUpdate(wxUpdateUIEvent& event);
void OnEditCopy(wxCommandEvent& event); void OnEditCopy(wxCommandEvent& event);
@@ -87,8 +102,10 @@ protected:
void OnViewLevel(wxCommandEvent& event); void OnViewLevel(wxCommandEvent& event);
void OnViewToolbarUpdate(wxUpdateUIEvent& event); void OnViewToolbarUpdate(wxUpdateUIEvent& event);
void OnViewToolbar(wxCommandEvent& event); void OnViewToolbar(wxCommandEvent& event);
/// \endcond
protected: protected:
/// \cond internal
wxMenuBar* m_menubar; wxMenuBar* m_menubar;
wxMenu* m_menuProgram; wxMenu* m_menuProgram;
wxMenu* m_menuEdit; wxMenu* m_menuEdit;
@@ -114,20 +131,45 @@ protected:
wxStatusBar* m_statusBar; wxStatusBar* m_statusBar;
wxEventMonitorLogPanel* m_panel; wxEventMonitorLogPanel* m_panel;
wxAuiManager m_mgr; wxAuiManager m_mgr;
/// \endcond
}; };
///
/// Supports saving/restoring `wxEventMonitorFrame` GUI state
///
class wxPersistentEventMonitorFrame : public wxPersistentTLW class wxPersistentEventMonitorFrame : public wxPersistentTLW
{ {
public: public:
///
/// Constructor for a persistent window object
///
/// \param[in] wnd Window this object will save/restore
///
wxPersistentEventMonitorFrame(wxEventMonitorFrame *wnd); wxPersistentEventMonitorFrame(wxEventMonitorFrame *wnd);
///
/// Saves the object properties
///
virtual void Save() const; virtual void Save() const;
///
/// Restores the object properties
///
/// \returns
/// - \c true if the properties were successfully restored;
/// - \c false otherwise.
///
virtual bool Restore(); virtual bool Restore();
}; };
///
/// Creates persistent window object for `wxETWListCtrl` class window
///
inline wxPersistentObject *wxCreatePersistentObject(wxEventMonitorFrame *wnd) inline wxPersistentObject *wxCreatePersistentObject(wxEventMonitorFrame *wnd)
{ {
return new wxPersistentEventMonitorFrame(wnd); return new wxPersistentEventMonitorFrame(wnd);
} }
/// @}

View File

@@ -18,14 +18,7 @@
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>. along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
*/ */
///
/// EventMonitor trace log panel
///
class wxEventMonitorLogPanel; class wxEventMonitorLogPanel;
///
/// Supports saving/restoring wxEventMonitorLogPanel state
///
class wxPersistentEventMonitorLogPanel; class wxPersistentEventMonitorLogPanel;
#pragma once #pragma once
@@ -34,27 +27,68 @@ class wxPersistentEventMonitorLogPanel;
#include <wx/persist/window.h> #include <wx/persist/window.h>
/// \addtogroup EventMonitor
/// @{
///
/// EventMonitor trace log panel
///
class wxEventMonitorLogPanel : public wxEventMonitorLogPanelBase class wxEventMonitorLogPanel : public wxEventMonitorLogPanelBase
{ {
public: public:
///
/// Constructs EventMonitor log panel
///
/// \param[in] parent Parent window. Must not be \c NULL.
///
wxEventMonitorLogPanel(wxWindow* parent); wxEventMonitorLogPanel(wxWindow* parent);
friend class wxPersistentEventMonitorLogPanel; // Allow saving/restoring window state. friend class wxPersistentEventMonitorLogPanel; // Allow saving/restoring window state.
}; };
///
/// Supports saving/restoring `wxEventMonitorLogPanel` state
///
class wxPersistentEventMonitorLogPanel : public wxPersistentWindow<wxEventMonitorLogPanel> class wxPersistentEventMonitorLogPanel : public wxPersistentWindow<wxEventMonitorLogPanel>
{ {
public: public:
///
/// Constructor for a persistent window object
///
/// \param[in] wnd Window this object will save/restore
///
wxPersistentEventMonitorLogPanel(wxEventMonitorLogPanel *wnd); wxPersistentEventMonitorLogPanel(wxEventMonitorLogPanel *wnd);
///
/// Returns the string uniquely identifying the objects supported by this adapter.
///
/// \returns This implementation always returns `wxT(wxPERSIST_TLW_KIND)`
///
virtual wxString GetKind() const; virtual wxString GetKind() const;
///
/// Saves the object properties
///
virtual void Save() const; virtual void Save() const;
///
/// Restores the object properties
///
/// \returns
/// - \c true if the properties were successfully restored;
/// - \c false otherwise.
///
virtual bool Restore(); virtual bool Restore();
}; };
///
/// Creates persistent window object for `wxEventMonitorLogPanel` class window
///
inline wxPersistentObject *wxCreatePersistentObject(wxEventMonitorLogPanel *wnd) inline wxPersistentObject *wxCreatePersistentObject(wxEventMonitorLogPanel *wnd)
{ {
return new wxPersistentEventMonitorLogPanel(wnd); return new wxPersistentEventMonitorLogPanel(wnd);
} }
/// @}

View File

@@ -8,22 +8,22 @@ Suite of EAP supplicants for Windows - IEEE 802.1X plug-ins for enterprise netwo
- Microsoft Windows Vista or later - Microsoft Windows Vista or later
- Microsoft Visual Studio 2010 SP1 - Microsoft Visual Studio 2010 SP1
- _msgfmt.exe_ from [gettext](https://www.gnu.org/software/gettext/); - _msgfmt.exe_ from [gettext](https://www.gnu.org/software/gettext/);
Hint: [Poedit](https://poedit.net/) contains up-to-date binary Win32 compiled gettext-utilities. Install it and add _GettextTools\bin_ folder to path. Hint: [Poedit](https://poedit.net/) contains up-to-date binary Win32 compiled gettext-utilities. Install it and add `GettextTools\bin` folder to the system path.
- _sed.exe_ and _grep.exe_ - _sed.exe_ and _grep.exe_
- _MsiDb.Exe_ and other command line utilities for MSI packaging distributed as a part of Microsoft Windows SDK (installed with Visual Studio). Add SDK's _Bin_ folder to path. - _MsiDb.Exe_ and other command line utilities for MSI packaging distributed as a part of Microsoft Windows SDK (installed with Visual Studio). Add SDK's `Bin` folder to the system path.
### wxWidgets ### wxWidgets
GÉANTLink is using wxWidgets v3.0.2 static libraries. Unfortunately, only dynamic libraries (DLL) variant is available as a binary download. Therefore static libraries needs to be compiled from [source](https://github.com/wxWidgets/wxWidgets). GÉANTLink is using wxWidgets v3.0.2 static libraries. Unfortunately, only dynamic libraries (DLL) variant is available as a binary download. Therefore static libraries needs to be compiled from [source](https://github.com/wxWidgets/wxWidgets).
#### Compiling wxWidgets Win32 static libraries #### Compiling wxWidgets Win32 static libraries
1. Start _Visual Studio Command Prompt (2010)_ 1. Start _Visual Studio Command Prompt (2010)_
2. Change working directory to _build\msw_ 2. Change working folder to `build\msw`
3. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0` 3. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0`
4. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0 BUILD=release` 4. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0 BUILD=release`
#### Compiling wxWidgets x64 static libraries #### Compiling wxWidgets x64 static libraries
1. Start _Visual Studio x64 Cross Tools Command Prompt (2010)_ 1. Start _Visual Studio x64 Cross Tools Command Prompt (2010)_
2. Change working directory to _build\msw_ 2. Change working folder to `build\msw`
3. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0 TARGET_CPU=X64` 3. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0 TARGET_CPU=X64`
4. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0 TARGET_CPU=X64 BUILD=release` 4. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0 TARGET_CPU=X64 BUILD=release`
@@ -43,6 +43,9 @@ Please note that only Release builds are configured for timestamp signing. Debug
### Building ### Building
#### Building in Visual Studio IDE #### Building in Visual Studio IDE
GÉANTLink has some submodules. When cloning Git repository, make sure to use `--recursive` Git switch to clone submodules too. Example:
`git clone --recursive "https://github.com/Amebis/GEANTLink.git" "C:\Projects\GEANTLink"`
GÉANTLink can be build and debugged opening _VS10Solution.sln_ in Visual C++ 2010 IDE. GÉANTLink can be build and debugged opening _VS10Solution.sln_ in Visual C++ 2010 IDE.
Before one can attempt to debug EAP DLLs, you should run `nmake register` from an elevated command prompt. See _Building in command line_ chapter below. Before one can attempt to debug EAP DLLs, you should run `nmake register` from an elevated command prompt. See _Building in command line_ chapter below.
@@ -66,7 +69,7 @@ A few seconds after desired function call has finished, _DllHost.exe_ terminates
To debug early life of our GUI DLL, uncomment `Sleep(10000)` in `DllMain()` of the module, and set breakpoints. This should give you plenty of time to attach the debugger to _DllHost.exe_ process before our DLL starts. To debug early life of our GUI DLL, uncomment `Sleep(10000)` in `DllMain()` of the module, and set breakpoints. This should give you plenty of time to attach the debugger to _DllHost.exe_ process before our DLL starts.
#### Building in command line #### Building in command line
Use of standard command prompt is recommended, providing that Microsoft Visual Studio 2010 folders containing _nmake.exe_ and _devenv.com_ are added to the path. Use of standard command prompt is recommended, providing that Microsoft Visual Studio 2010 folders containing _nmake.exe_ and _devenv.com_ are added to the system path.
Use Microsoft NMAKE to build the project. Use Microsoft NMAKE to build the project.
@@ -75,7 +78,7 @@ Command | Explanation
`nmake Clean` | Deletes all intermediate and output files. `nmake Clean` | Deletes all intermediate and output files.
`nmake Register` | Builds a debug version of project, registers DLLs, and adds Start Menu shortcuts. For testing and development purposes only! Requires elevated command prompt. `nmake Register` | Builds a debug version of project, registers DLLs, and adds Start Menu shortcuts. For testing and development purposes only! Requires elevated command prompt.
`nmake Unregister` | Removes Start Menu shortcuts, unregisters DLLs. For testing development purposes only! Requires elevated command prompt. `nmake Unregister` | Removes Start Menu shortcuts, unregisters DLLs. For testing development purposes only! Requires elevated command prompt.
`nmake Setup` | Builds a release version of project and release MSI setup files. The resulting files can be found in _output\Setup_ folder. `nmake Setup` | Builds a release version of project and release MSI setup files. The resulting files can be found in `output\Setup` folder.
`nmake SetupDebug` | Builds a debug version of project and debug MSI setup files. The resulting files can be found in _output\Setup_ folder. `nmake SetupDebug` | Builds a debug version of project and debug MSI setup files. The resulting files can be found in `output\Setup` folder.
The `/ls` flag can be appended to the commands above to reduce NMAKEs verbosity. You can combine multiple targets (i.e. nmake Unregister Clean). Please, see NMAKE reference for further reading. The `/ls` flag can be appended to the commands above to reduce NMAKEs verbosity. You can combine multiple targets (i.e. nmake Unregister Clean). Please, see NMAKE reference for further reading.

View File

@@ -29,7 +29,7 @@
// Product version as a single DWORD // Product version as a single DWORD
// Note: Used for version comparison within C/C++ code. // Note: Used for version comparison within C/C++ code.
// //
#define PRODUCT_VERSION 0x01001a00 #define PRODUCT_VERSION 0x01001b00
// //
// Product version by components // Product version by components
@@ -39,26 +39,26 @@
// //
#define PRODUCT_VERSION_MAJ 1 #define PRODUCT_VERSION_MAJ 1
#define PRODUCT_VERSION_MIN 0 #define PRODUCT_VERSION_MIN 0
#define PRODUCT_VERSION_REV 26 #define PRODUCT_VERSION_REV 27
#define PRODUCT_VERSION_BUILD 0 #define PRODUCT_VERSION_BUILD 0
// //
// Human readable product version and build year for UI // Human readable product version and build year for UI
// //
#define PRODUCT_VERSION_STR "1.0-beta8" #define PRODUCT_VERSION_STR "1.0"
#define PRODUCT_BUILD_YEAR_STR "2016" #define PRODUCT_BUILD_YEAR_STR "2016"
// //
// Numerical version presentation for ProductVersion propery in // Numerical version presentation for ProductVersion propery in
// MSI packages (syntax: N.N[.N[.N]]) // MSI packages (syntax: N.N[.N[.N]])
// //
#define PRODUCT_VERSION_INST "1.0.26" #define PRODUCT_VERSION_INST "1.0.27"
// //
// The product code for ProductCode property in MSI packages // The product code for ProductCode property in MSI packages
// Replace with new on every version change, regardless how minor it is. // Replace with new on every version change, regardless how minor it is.
// //
#define PRODUCT_VERSION_GUID "{710D80D0-D104-4A2A-872C-A5C7BF0FB9D8}" #define PRODUCT_VERSION_GUID "{8589167A-BEE3-4C2D-9B18-444699E95F42}"
// //
// Product vendor // Product vendor

View File

@@ -855,7 +855,7 @@ template<class _Traits, class _Ax>
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val)
{ {
std::string val_utf8; std::string val_utf8;
WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), val_utf8, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, val, val_utf8, NULL, NULL);
cursor << val_utf8; cursor << val_utf8;
} }
@@ -872,7 +872,7 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<w
{ {
std::string val_utf8; std::string val_utf8;
cursor >> val_utf8; cursor >> val_utf8;
MultiByteToWideChar(CP_UTF8, 0, val_utf8.c_str(), (int)val_utf8.length(), val); MultiByteToWideChar(CP_UTF8, 0, val_utf8, val);
} }

View File

@@ -225,7 +225,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);
@@ -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 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);
@@ -305,7 +307,7 @@ namespace eap
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val, _Out_opt_ HCRYPTHASH hHash = NULL) const std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val, _Out_opt_ HCRYPTHASH hHash = NULL) const
{ {
winstd::sanitizing_string val_utf8; winstd::sanitizing_string val_utf8;
WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), val_utf8, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, val, val_utf8, NULL, NULL);
return encrypt(hProv, val_utf8, hHash); return encrypt(hProv, val_utf8, hHash);
} }
@@ -349,7 +351,7 @@ namespace eap
std::vector<unsigned char> encrypt_md5(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val) const std::vector<unsigned char> encrypt_md5(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val) const
{ {
winstd::sanitizing_string val_utf8; winstd::sanitizing_string val_utf8;
WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), val_utf8, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, val, val_utf8, NULL, NULL);
return encrypt_md5(hProv, val_utf8); return encrypt_md5(hProv, val_utf8);
} }
@@ -430,7 +432,7 @@ namespace eap
{ {
winstd::sanitizing_string buf(std::move(decrypt_str(hProv, data, size, hHash))); winstd::sanitizing_string buf(std::move(decrypt_str(hProv, data, size, hHash)));
std::basic_string<wchar_t, _Traits, _Ax> dec; std::basic_string<wchar_t, _Traits, _Ax> dec;
MultiByteToWideChar(CP_UTF8, 0, buf.data(), (int)buf.size(), dec); MultiByteToWideChar(CP_UTF8, 0, buf, dec);
return dec; return dec;
} }
@@ -502,7 +504,7 @@ namespace eap
{ {
winstd::sanitizing_string buf(std::move(decrypt_str_md5<char, std::char_traits<char>, sanitizing_allocator<char> >(hProv, data, size))); winstd::sanitizing_string buf(std::move(decrypt_str_md5<char, std::char_traits<char>, sanitizing_allocator<char> >(hProv, data, size)));
std::basic_string<wchar_t, _Traits, _Ax> dec; std::basic_string<wchar_t, _Traits, _Ax> dec;
MultiByteToWideChar(CP_UTF8, 0, buf.data(), (int)buf.size(), dec); MultiByteToWideChar(CP_UTF8, 0, buf, dec);
return dec; return dec;
} }

View File

@@ -251,7 +251,7 @@ void eap::credentials_pass::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p
switch (m_enc_alg) { switch (m_enc_alg) {
case enc_alg_kph: { case enc_alg_kph: {
sanitizing_string password_utf8; sanitizing_string password_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_password.c_str(), -1, password_utf8, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, m_password, password_utf8, NULL, NULL);
wstring password_enc(std::move(kph_encrypt<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >(cp, password_utf8.c_str()))); wstring password_enc(std::move(kph_encrypt<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >(cp, password_utf8.c_str())));
com_obj<IXMLDOMElement> pXmlElPassword; com_obj<IXMLDOMElement> pXmlElPassword;
if (FAILED(hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"Password"), namespace_eapmetadata, bstr(password_enc), std::addressof(pXmlElPassword)))) if (FAILED(hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"Password"), namespace_eapmetadata, bstr(password_enc), std::addressof(pXmlElPassword))))
@@ -308,7 +308,7 @@ void eap::credentials_pass::load(_In_ IXMLDOMNode *pConfigRoot)
} else if (encryption && CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, encryption, encryption.length(), _L("KPH"), -1, NULL, NULL, 0) == CSTR_EQUAL) { } else if (encryption && CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, encryption, encryption.length(), _L("KPH"), -1, NULL, NULL, 0) == CSTR_EQUAL) {
// Decrypt password. // Decrypt password.
sanitizing_string password_utf8(std::move(kph_decrypt<OLECHAR>(password))); sanitizing_string password_utf8(std::move(kph_decrypt<OLECHAR>(password)));
MultiByteToWideChar(CP_UTF8, 0, password_utf8.c_str(), -1, m_password); MultiByteToWideChar(CP_UTF8, 0, password_utf8, m_password);
m_enc_alg = enc_alg_kph; m_enc_alg = enc_alg_kph;
} else if (encryption && encryption[0]) { } else if (encryption && encryption[0]) {
// Encryption is defined but unrecognized. // Encryption is defined but unrecognized.
@@ -354,13 +354,13 @@ void eap::credentials_pass::store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned in
// Convert password to UTF-8. // Convert password to UTF-8.
sanitizing_string cred_utf8; sanitizing_string cred_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_password.c_str(), (int)m_password.length(), cred_utf8, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, m_password, cred_utf8, NULL, NULL);
// Encrypt the password using user's key. // Encrypt the password using user's key.
DATA_BLOB cred_blob = { (DWORD)cred_utf8.size() , const_cast<LPBYTE>(reinterpret_cast<LPCBYTE>(cred_utf8.data())) }; DATA_BLOB cred_blob = { (DWORD)cred_utf8.size() , const_cast<LPBYTE>(reinterpret_cast<LPCBYTE>(cred_utf8.data())) };
DATA_BLOB entropy_blob = { sizeof(s_entropy), const_cast<LPBYTE>( s_entropy ) }; DATA_BLOB entropy_blob = { sizeof(s_entropy), const_cast<LPBYTE>( s_entropy ) };
data_blob cred_enc; data_blob cred_enc;
if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &cred_enc)) if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN | CRYPTPROTECT_AUDIT, &cred_enc))
throw win_runtime_error(__FUNCTION__ " CryptProtectData failed."); throw win_runtime_error(__FUNCTION__ " CryptProtectData failed.");
tstring target(target_name(pszTargetName, level)); tstring target(target_name(pszTargetName, level));
@@ -650,14 +650,14 @@ void eap::credentials_connection::load(_In_ IXMLDOMNode *pConfigRoot)
if (match(*cfg_prov)) { if (match(*cfg_prov)) {
// Matching provider found. Create matching blank credential set, then load. // Matching provider found. Create matching blank credential set, then load.
if (cfg_prov->m_methods.empty()) if (cfg_prov->m_methods.empty())
throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()));
const config_method_with_cred *cfg_method = dynamic_cast<const config_method_with_cred*>(cfg_prov->m_methods.front().get()); const config_method_with_cred *cfg_method = dynamic_cast<const config_method_with_cred*>(cfg_prov->m_methods.front().get());
m_cred.reset(cfg_method->make_credentials()); m_cred.reset(cfg_method->make_credentials());
m_cred->load(pXmlElClientSideCredential); m_cred->load(pXmlElClientSideCredential);
break; break;
} }
} else } else
throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str()).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str()));
} }
} }
@@ -693,14 +693,14 @@ void eap::credentials_connection::operator>>(_Inout_ cursor_in &cursor)
if (match(*cfg_prov)) { if (match(*cfg_prov)) {
// Matching provider found. Create matching blank credential set, then read. // Matching provider found. Create matching blank credential set, then read.
if (cfg_prov->m_methods.empty()) if (cfg_prov->m_methods.empty())
throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()));
const config_method_with_cred *cfg_method = dynamic_cast<const config_method_with_cred*>(cfg_prov->m_methods.front().get()); const config_method_with_cred *cfg_method = dynamic_cast<const config_method_with_cred*>(cfg_prov->m_methods.front().get());
m_cred.reset(cfg_method->make_credentials()); m_cred.reset(cfg_method->make_credentials());
cursor >> *m_cred; cursor >> *m_cred;
break; break;
} }
} else } else
throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str()).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str()));
} }
} }

View File

@@ -146,7 +146,7 @@ void eap::method_noneap::get_response_packet(
size_t size_packet = m_packet_res.size(); size_t size_packet = m_packet_res.size();
if (size_packet > *pdwSendPacketSize) if (size_packet > *pdwSendPacketSize)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", size_packet, *pdwSendPacketSize).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", size_packet, *pdwSendPacketSize));
memcpy(pSendPacket, m_packet_res.data(), size_packet); memcpy(pSendPacket, m_packet_res.data(), size_packet);
*pdwSendPacketSize = (DWORD)size_packet; *pdwSendPacketSize = (DWORD)size_packet;

View File

@@ -67,6 +67,13 @@ class wxEAPProviderLockedPanel;
/// ///
class wxEAPCredentialWarningPanel; class wxEAPCredentialWarningPanel;
#ifdef __DANGEROUS__LOG_CONFIDENTIAL_DATA
///
/// EAP credential logging enabled warning note
///
class wxEAPCredentialLogWarningPanel;
#endif
/// ///
/// EAP Configuration window /// 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 class wxEAPConfigWindow : public wxScrolledWindow
{ {
public: public:

View File

@@ -97,6 +97,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
} }
@@ -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 visible and easy to read way."), wxT(PRODUCT_NAME_STR)) + " " +
_("Please, reconsider necessity to enter your credentials."));
m_note_label->Wrap(449);
this->Layout();
}
#endif
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// wxEAPConfigWindow // wxEAPConfigWindow
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@@ -101,7 +101,7 @@ void eap::method_mschapv2::process_request_packet(
case phase_init: { case phase_init: {
// Convert username to UTF-8. // Convert username to UTF-8.
sanitizing_string identity_utf8; sanitizing_string identity_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity.c_str(), (int)m_cred.m_identity.length(), identity_utf8, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity, identity_utf8, NULL, NULL);
// Randomize Peer-Challenge // Randomize Peer-Challenge
m_challenge_client.randomize(m_cp); m_challenge_client.randomize(m_cp);
@@ -178,7 +178,7 @@ void eap::method_mschapv2::process_packet(_In_bytecount_(size_pck) const void *_
if (code == 26 && vendor == 311) { if (code == 26 && vendor == 311) {
// MS-CHAP2-Success // MS-CHAP2-Success
if (msg[0] != m_ident) if (msg[0] != m_ident)
throw invalid_argument(string_printf(__FUNCTION__ " Wrong MSCHAPv2 ident (expected: %u, received: %u).", m_ident, msg[0]).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " Wrong MSCHAPv2 ident (expected: %u, received: %u).", m_ident, msg[0]));
const char *str = reinterpret_cast<const char*>(msg + 1); const char *str = reinterpret_cast<const char*>(msg + 1);
process_success(parse_response(str, (reinterpret_cast<const char*>(msg_end) - str))); process_success(parse_response(str, (reinterpret_cast<const char*>(msg_end) - str)));
} else if (code == 2 && vendor == 311) { } else if (code == 2 && vendor == 311) {
@@ -187,7 +187,7 @@ void eap::method_mschapv2::process_packet(_In_bytecount_(size_pck) const void *_
const char *str = reinterpret_cast<const char*>(msg + 1); const char *str = reinterpret_cast<const char*>(msg + 1);
process_error(parse_response(str, (reinterpret_cast<const char*>(msg_end) - str))); process_error(parse_response(str, (reinterpret_cast<const char*>(msg_end) - str)));
} else if (hdr->flags & diameter_avp_flag_mandatory) } else if (hdr->flags & diameter_avp_flag_mandatory)
throw win_runtime_error(ERROR_NOT_SUPPORTED, string_printf(__FUNCTION__ " Server sent mandatory Diameter AVP we do not support (code: %u, vendor: %u).", code, vendor).c_str()); throw win_runtime_error(ERROR_NOT_SUPPORTED, string_printf(__FUNCTION__ " Server sent mandatory Diameter AVP we do not support (code: %u, vendor: %u).", code, vendor));
pck = msg_next; pck = msg_next;
} }
@@ -209,7 +209,7 @@ void eap::method_mschapv2::process_success(_In_ const list<string> &argv)
// Calculate expected authenticator response. // Calculate expected authenticator response.
sanitizing_string identity_utf8; sanitizing_string identity_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity.c_str(), (int)m_cred.m_identity.length(), identity_utf8, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity, identity_utf8, NULL, NULL);
authenticator_response resp_exp(m_cp, m_challenge_server, m_challenge_client, identity_utf8.c_str(), m_cred.m_password.c_str(), m_nt_resp); authenticator_response resp_exp(m_cp, m_challenge_server, m_challenge_client, identity_utf8.c_str(), m_cred.m_password.c_str(), m_nt_resp);
// Compare against provided authemticator response. // Compare against provided authemticator response.
@@ -246,10 +246,10 @@ void eap::method_mschapv2::process_error(_In_ const list<string> &argv)
bool is_last; bool is_last;
dec.decode(resp, is_last, val.data() + 2, (size_t)-1); dec.decode(resp, is_last, val.data() + 2, (size_t)-1);
if (resp.size() != sizeof(m_challenge_server)) if (resp.size() != sizeof(m_challenge_server))
throw invalid_argument(string_printf(__FUNCTION__ " Incorrect MSCHAPv2 challenge length (expected: %uB, received: %uB).", sizeof(m_challenge_server), resp.size()).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " Incorrect MSCHAPv2 challenge length (expected: %uB, received: %uB).", sizeof(m_challenge_server), resp.size()));
memcpy(&m_challenge_server, resp.data(), sizeof(m_challenge_server)); memcpy(&m_challenge_server, resp.data(), sizeof(m_challenge_server));
} else if ((val[0] == 'M' || val[0] == 'm') && val[1] == '=') { } else if ((val[0] == 'M' || val[0] == 'm') && val[1] == '=') {
MultiByteToWideChar(CP_UTF8, 0, val.data() + 2, -1, m_cfg.m_last_msg); MultiByteToWideChar(CP_UTF8, 0, val.data() + 2, (int)val.length() - 2, m_cfg.m_last_msg);
m_module.log_event(&EAPMETHOD_METHOD_FAILURE_ERROR1, event_data((unsigned int)eap_type_legacy_mschapv2), event_data(m_cfg.m_last_msg), event_data::blank); m_module.log_event(&EAPMETHOD_METHOD_FAILURE_ERROR1, event_data((unsigned int)eap_type_legacy_mschapv2), event_data(m_cfg.m_last_msg), event_data::blank);
} }
} }

View File

@@ -39,6 +39,12 @@ namespace eap
namespace eap namespace eap
{ {
/// \addtogroup EAPBaseConfig
/// @{
///
/// PAP configuration
///
class config_method_pap : public config_method_with_cred class config_method_pap : public config_method_with_cred
{ {
public: public:

View File

@@ -84,8 +84,8 @@ void eap::method_pap::process_request_packet(
case phase_init: { case phase_init: {
// Convert username and password to UTF-8. // Convert username and password to UTF-8.
sanitizing_string identity_utf8, password_utf8; sanitizing_string identity_utf8, password_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity.c_str(), (int)m_cred.m_identity.length(), identity_utf8, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity, identity_utf8, NULL, NULL);
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_password.c_str(), (int)m_cred.m_password.length(), password_utf8, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, m_cred.m_password, password_utf8, NULL, NULL);
// PAP passwords must be padded to 16B boundary according to RFC 5281. Will not add random extra padding here, as length obfuscation should be done by outer transport layers. // PAP passwords must be padded to 16B boundary according to RFC 5281. Will not add random extra padding here, as length obfuscation should be done by outer transport layers.
size_t padding_password_ex = (16 - password_utf8.length()) % 16; size_t padding_password_ex = (16 - password_utf8.length()) % 16;

View File

@@ -179,7 +179,7 @@ void eap::credentials_tls::store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int
// Encrypt the certificate using user's key. // Encrypt the certificate using user's key.
DATA_BLOB cred_blob = { m_cert->cbCertEncoded, m_cert->pbCertEncoded }; DATA_BLOB cred_blob = { m_cert->cbCertEncoded, m_cert->pbCertEncoded };
DATA_BLOB entropy_blob = { sizeof(s_entropy) , const_cast<LPBYTE>(s_entropy) }; DATA_BLOB entropy_blob = { sizeof(s_entropy) , const_cast<LPBYTE>(s_entropy) };
if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &cred_enc)) if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN | CRYPTPROTECT_AUDIT, &cred_enc))
throw win_runtime_error(__FUNCTION__ " CryptProtectData failed."); throw win_runtime_error(__FUNCTION__ " CryptProtectData failed.");
} }

View File

@@ -206,7 +206,7 @@ void eap::method_tls::begin_session(
m_sc_target_name.insert(m_sc_target_name.end(), name->begin(), name->end()); m_sc_target_name.insert(m_sc_target_name.end(), name->begin(), name->end());
#else #else
string buf; string buf;
WideCharToMultiByte(CP_ACP, 0, name->c_str(), -1, buf, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, name, buf, NULL, NULL);
m_sc_target_name.insert(m_sc_target_name.end(), buf.begin(), buf.end()); m_sc_target_name.insert(m_sc_target_name.end(), buf.begin(), buf.end());
#endif #endif
} }

View File

@@ -261,7 +261,7 @@ void wxTLSServerTrustPanel::OnRootCAAddFile(wxCommandEvent& event)
for (PCCERT_CONTEXT cert = NULL; (cert = CertEnumCertificatesInStore(cs, cert)) != NULL;) for (PCCERT_CONTEXT cert = NULL; (cert = CertEnumCertificatesInStore(cs, cert)) != NULL;)
AddRootCA(cert); AddRootCA(cert);
} else } else
wxMessageBox(wxString::Format(_("Invalid or unsupported certificate file %s"), paths[i].c_str()), _("Error"), wxOK | wxICON_EXCLAMATION, this); wxMessageBox(wxString::Format(_("Invalid or unsupported certificate file %s"), paths[i]), _("Error"), wxOK | wxICON_EXCLAMATION, this);
} }
} }

View File

@@ -306,6 +306,6 @@ void eap::method_ttls::process_application_data(_In_bytecount_(size_msg) const v
} }
default: default:
throw invalid_argument(string_printf(__FUNCTION__ " Inner method returned an unsupported action (action %u).", eap_output.action).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " Inner method returned an unsupported action (action %u).", eap_output.action));
} }
} }

View File

@@ -209,12 +209,12 @@ EAP_SESSION_HANDLE eap::peer_ttls::begin_session(
if (s->m_cred.match(*cfg_prov)) { if (s->m_cred.match(*cfg_prov)) {
// Matching provider found. // Matching provider found.
if (cfg_prov->m_methods.empty()) if (cfg_prov->m_methods.empty())
throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()));
cfg_method = dynamic_cast<config_method_ttls*>(cfg_prov->m_methods.front().get()); cfg_method = dynamic_cast<config_method_ttls*>(cfg_prov->m_methods.front().get());
break; break;
} }
} else } else
throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", s->m_cred.get_id().c_str()).c_str()); throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", s->m_cred.get_id().c_str()));
} }
// We have configuration, we have credentials, create method. // We have configuration, we have credentials, create method.