diff --git a/EAPMethods/EAPTTLSUI/EAPTTLSUI.vcxproj b/EAPMethods/EAPTTLSUI/EAPTTLSUI.vcxproj index 9fc33de..70874a4 100644 --- a/EAPMethods/EAPTTLSUI/EAPTTLSUI.vcxproj +++ b/EAPMethods/EAPTTLSUI/EAPTTLSUI.vcxproj @@ -136,6 +136,9 @@ {47399d91-7eb9-41de-b521-514ba5db0c43} + + {d3e29951-d9f5-486d-a167-20ae8e90b1fa} + diff --git a/EAPMethods/MSIBuild/Makefile b/EAPMethods/MSIBuild/Makefile index debc36e..78c823b 100644 Binary files a/EAPMethods/MSIBuild/Makefile and b/EAPMethods/MSIBuild/Makefile differ diff --git a/EventMonitor/App.cpp b/EventMonitor/App.cpp index 6fef987..53168fd 100644 --- a/EventMonitor/App.cpp +++ b/EventMonitor/App.cpp @@ -52,7 +52,7 @@ bool wxEventMonitorApp::OnInit() return false; if (wxInitializeLocale(m_locale)) { - //wxVERIFY(m_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion))); + wxVERIFY(m_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion))); wxVERIFY(m_locale.AddCatalog(wxT("EventMonitor"))); } diff --git a/EventMonitor/MSIBuild/Makefile b/EventMonitor/MSIBuild/Makefile index e099114..0a2e78b 100644 Binary files a/EventMonitor/MSIBuild/Makefile and b/EventMonitor/MSIBuild/Makefile differ diff --git a/Makefile b/Makefile index 56d67aa..1c62799 100644 Binary files a/Makefile and b/Makefile differ diff --git a/include/MSIBuildCfg.mak b/include/MSIBuildCfg.mak index df305cd..0d3139c 100644 Binary files a/include/MSIBuildCfg.mak and b/include/MSIBuildCfg.mak differ diff --git a/lib/TLS_UI/build/TLS_UI.props b/lib/TLS_UI/build/TLS_UI.props index 4997b71..fe94d27 100644 --- a/lib/TLS_UI/build/TLS_UI.props +++ b/lib/TLS_UI/build/TLS_UI.props @@ -5,7 +5,7 @@ - ..\..\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\..\WinStd\include;%(AdditionalIncludeDirectories) + ..\..\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\..\WinStd\include;..\..\wxExtend\include;%(AdditionalIncludeDirectories) diff --git a/lib/TLS_UI/include/TLS_UI.h b/lib/TLS_UI/include/TLS_UI.h index 4867708..e1a2460 100644 --- a/lib/TLS_UI/include/TLS_UI.h +++ b/lib/TLS_UI/include/TLS_UI.h @@ -24,6 +24,7 @@ #include +#include #include #include @@ -40,21 +41,6 @@ /// class wxCertificateClientData; -/// -/// Validator for host name -/// -class wxHostNameValidator; - -/// -/// Validator for FQDN -/// -class wxFQDNValidator; - -/// -/// Validator for FQDN lists -/// -class wxFQDNListValidator; - /// /// TLS credential panel /// @@ -110,144 +96,6 @@ public: }; -class wxHostNameValidator : public wxValidator -{ - wxDECLARE_DYNAMIC_CLASS(wxHostNameValidator); - wxDECLARE_NO_ASSIGN_CLASS(wxHostNameValidator); - -public: - /// - /// Construct the validator with a value to store data - /// - wxHostNameValidator(std::wstring *val = NULL); - - /// - /// Copy constructor - /// - wxHostNameValidator(const wxHostNameValidator &other); - - /// - /// Copies this validator - /// - virtual wxObject* Clone() const; - - /// - /// Validates the value - /// - virtual bool Validate(wxWindow *parent); - - /// - /// Transfers the value to the window - /// - virtual bool TransferToWindow(); - - /// - /// Transfers the value from the window - /// - virtual bool TransferFromWindow(); - - /// - /// Parses FQDN value - /// - static bool Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::wstring *val_out = NULL); - -protected: - std::wstring *m_val; ///< Pointer to variable to receive control's parsed value -}; - - -class wxFQDNValidator : public wxValidator -{ - wxDECLARE_DYNAMIC_CLASS(wxFQDNValidator); - wxDECLARE_NO_ASSIGN_CLASS(wxFQDNValidator); - -public: - /// - /// Construct the validator with a value to store data - /// - wxFQDNValidator(std::wstring *val = NULL); - - /// - /// Copy constructor - /// - wxFQDNValidator(const wxFQDNValidator &other); - - /// - /// Copies this validator - /// - virtual wxObject* Clone() const; - - /// - /// Validates the value - /// - virtual bool Validate(wxWindow *parent); - - /// - /// Transfers the value to the window - /// - virtual bool TransferToWindow(); - - /// - /// Transfers the value from the window - /// - virtual bool TransferFromWindow(); - - /// - /// Parses FQDN value - /// - static bool Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::wstring *val_out = NULL); - -protected: - std::wstring *m_val; ///< Pointer to variable to receive control's parsed value -}; - - -class wxFQDNListValidator : public wxValidator -{ - wxDECLARE_DYNAMIC_CLASS(wxFQDNListValidator); - wxDECLARE_NO_ASSIGN_CLASS(wxFQDNListValidator); - -public: - /// - /// Construct the validator with a value to store data - /// - wxFQDNListValidator(std::list *val = NULL); - - /// - /// Copy constructor - /// - wxFQDNListValidator(const wxFQDNListValidator &other); - - /// - /// Copies this validator - /// - virtual wxObject* Clone() const; - - /// - /// Validates the value - /// - virtual bool Validate(wxWindow *parent); - - /// - /// Transfers the value to the window - /// - virtual bool TransferToWindow(); - - /// - /// Transfers the value from the window - /// - virtual bool TransferFromWindow(); - - /// - /// Parses FQDN list value - /// - static bool Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::list *val_out = NULL); - -protected: - std::list *m_val; ///< Pointer to variable to receive control's parsed value -}; - - class wxTLSCredentialsPanel : public wxEAPCredentialsPanel { public: @@ -302,9 +150,9 @@ protected: bool AddRootCA(PCCERT_CONTEXT cert); protected: - const eap::config_provider &m_prov; ///< EAP provider - eap::config_method_tls &m_cfg; ///< TLS configuration - std::list m_server_names_val; ///< Acceptable authenticating server names + const eap::config_provider &m_prov; ///< EAP provider + eap::config_method_tls &m_cfg; ///< TLS configuration + wxArrayString m_server_names_val; ///< Acceptable authenticating server names }; diff --git a/lib/TLS_UI/src/StdAfx.h b/lib/TLS_UI/src/StdAfx.h index 9ed5d92..65415c4 100644 --- a/lib/TLS_UI/src/StdAfx.h +++ b/lib/TLS_UI/src/StdAfx.h @@ -26,4 +26,6 @@ #include "../include/TLS_UI.h" +#include + #include diff --git a/lib/TLS_UI/src/TLS_UI.cpp b/lib/TLS_UI/src/TLS_UI.cpp index 24b6395..b1845c5 100644 --- a/lib/TLS_UI/src/TLS_UI.cpp +++ b/lib/TLS_UI/src/TLS_UI.cpp @@ -39,274 +39,6 @@ wxCertificateClientData::~wxCertificateClientData() } -////////////////////////////////////////////////////////////////////// -// wxHostNameValidator -////////////////////////////////////////////////////////////////////// - -wxIMPLEMENT_DYNAMIC_CLASS(wxHostNameValidator, wxValidator); - - -wxHostNameValidator::wxHostNameValidator(std::wstring *val) : - m_val(val), - wxValidator() -{ -} - - -wxHostNameValidator::wxHostNameValidator(const wxHostNameValidator &other) : - m_val(other.m_val), - wxValidator(other) -{ -} - - -wxObject* wxHostNameValidator::Clone() const -{ - return new wxHostNameValidator(*this); -} - - -bool wxHostNameValidator::Validate(wxWindow *parent) -{ - wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl))); - wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow(); - if (!ctrl->IsEnabled()) return true; - - wxString val(ctrl->GetValue()); - return Parse(val, 0, val.Length(), ctrl, parent); -} - - -bool wxHostNameValidator::TransferToWindow() -{ - wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl))); - - if (m_val) - ((wxTextCtrl*)GetWindow())->SetValue(*m_val); - - return true; -} - - -bool wxHostNameValidator::TransferFromWindow() -{ - wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl))); - wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow(); - - wxString val(ctrl->GetValue()); - return Parse(val, 0, val.Length(), ctrl, NULL, m_val); -} - - -bool wxHostNameValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::wstring *val_out) -{ - const wxStringCharType *buf = val_in; - - size_t i = i_start; - for (;;) { - if (i >= i_end) { - // End of host name found. - if (val_out) val_out->assign(val_in.c_str() + i_start, i - i_start); - return true; - } else if (buf[i] == _T('-') || buf[i] == _T('_') || buf[i] == _T('*') || _istalnum(buf[i])) { - // Valid character found. - i++; - } else { - // Invalid character found. - ctrl->SetFocus(); - ctrl->SetSelection(i, i + 1); - wxMessageBox(wxString::Format(_("Invalid character in host name found: %c"), buf[i]), _("Validation conflict"), wxOK | wxICON_EXCLAMATION, parent); - return false; - } - } -} - - -////////////////////////////////////////////////////////////////////// -// wxFQDNValidator -////////////////////////////////////////////////////////////////////// - -wxIMPLEMENT_DYNAMIC_CLASS(wxFQDNValidator, wxValidator); - - -wxFQDNValidator::wxFQDNValidator(std::wstring *val) : - m_val(val), - wxValidator() -{ -} - - -wxFQDNValidator::wxFQDNValidator(const wxFQDNValidator &other) : - m_val(other.m_val), - wxValidator(other) -{ -} - - -wxObject* wxFQDNValidator::Clone() const -{ - return new wxFQDNValidator(*this); -} - - -bool wxFQDNValidator::Validate(wxWindow *parent) -{ - wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl))); - wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow(); - if (!ctrl->IsEnabled()) return true; - - wxString val(ctrl->GetValue()); - return Parse(val, 0, val.Length(), ctrl, parent); -} - - -bool wxFQDNValidator::TransferToWindow() -{ - wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl))); - - if (m_val) - ((wxTextCtrl*)GetWindow())->SetValue(*m_val); - - return true; -} - - -bool wxFQDNValidator::TransferFromWindow() -{ - wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl))); - wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow(); - - wxString val(ctrl->GetValue()); - return Parse(val, 0, val.Length(), ctrl, NULL, m_val); -} - - -bool wxFQDNValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::wstring *val_out) -{ - const wxStringCharType *buf = val_in; - - size_t i = i_start; - for (;;) { - const wxStringCharType *buf_next; - if ((buf_next = wmemchr(buf + i, L'.', i_end - i)) != NULL) { - // FQDN separator found. - if (!wxHostNameValidator::Parse(val_in, i, buf_next - buf, ctrl, parent)) - return false; - i = buf_next - buf + 1; - } else if (wxHostNameValidator::Parse(val_in, i, i_end, ctrl, parent)) { - // The rest of the FQDN parsed succesfully. - if (val_out) val_out->assign(val_in.c_str() + i_start, i_end - i_start); - return true; - } else - return false; - } -} - - -////////////////////////////////////////////////////////////////////// -// wxFQDNListValidator -////////////////////////////////////////////////////////////////////// - -wxIMPLEMENT_DYNAMIC_CLASS(wxFQDNListValidator, wxValidator); - - -wxFQDNListValidator::wxFQDNListValidator(std::list *val) : - m_val(val), - wxValidator() -{ -} - - -wxFQDNListValidator::wxFQDNListValidator(const wxFQDNListValidator &other) : - m_val(other.m_val), - wxValidator(other) -{ -} - - -wxObject* wxFQDNListValidator::Clone() const -{ - return new wxFQDNListValidator(*this); -} - - -bool wxFQDNListValidator::Validate(wxWindow *parent) -{ - wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow(); - if (!ctrl->IsEnabled()) return true; - - wxString val(ctrl->GetValue()); - return Parse(val, 0, val.Length(), ctrl, parent); -} - - -bool wxFQDNListValidator::TransferToWindow() -{ - wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl))); - - if (m_val) { - wxString str; - for (auto name = m_val->cbegin(), name_end = m_val->cend(); name != name_end; ++name) { - if (!str.IsEmpty()) str += wxT("; "); - str += *name; - } - ((wxTextCtrl*)GetWindow())->SetValue(str); - } - - return true; -} - - -bool wxFQDNListValidator::TransferFromWindow() -{ - wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl))); - wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow(); - - wxString val(ctrl->GetValue()); - return Parse(val, 0, val.Length(), ctrl, NULL, m_val); -} - - -bool wxFQDNListValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::list *val_out) -{ - const wxStringCharType *buf = val_in; - std::wstring _fqdn, *fqdn = val_out ? &_fqdn : NULL; - std::list _val_out; - - size_t i = i_start; - for (;;) { - // Skip initial white-space. - for (; i < i_end && _istspace(buf[i]); i++); - - const wxStringCharType *buf_next; - if ((buf_next = wmemchr(buf + i, L';', i_end - i)) != NULL) { - // FQDN list separator found. - - // Skip trailing white-space. - size_t i_next = buf_next - buf; - for (; i < i_next && _istspace(buf[i_next - 1]); i_next--); - - if (!wxFQDNValidator::Parse(val_in, i, i_next, ctrl, parent, fqdn)) - return false; - if (fqdn && !fqdn->empty()) _val_out.push_back(std::move(*fqdn)); - - i = buf_next - buf + 1; - } else { - // Skip trailing white-space. - for (; i < i_end && _istspace(buf[i_end - 1]); i_end--); - - if (wxFQDNValidator::Parse(val_in, i, i_end, ctrl, parent, fqdn)) { - // The rest of the FQDN list parsed succesfully. - if (fqdn && !fqdn->empty()) _val_out.push_back(std::move(*fqdn)); - if (val_out) *val_out = std::move(_val_out); - return true; - } else - return false; - } - } -} - - ////////////////////////////////////////////////////////////////////// // wxTLSCredentialsPanel ////////////////////////////////////////////////////////////////////// @@ -425,7 +157,9 @@ bool wxTLSServerTrustPanel::TransferDataToWindow() m_root_ca->Append(wxString(eap::get_cert_title(*cert)), new wxCertificateClientData(cert->duplicate())); // Set server acceptable names. The edit control will get populated by validator. - m_server_names_val = m_cfg.m_server_names; + m_server_names_val.clear(); + for (auto name = m_cfg.m_server_names.cbegin(), name_end = m_cfg.m_server_names.cend(); name != name_end; ++name) + m_server_names_val.push_back(*name); return wxTLSServerTrustPanelBase::TransferDataToWindow(); } @@ -447,7 +181,9 @@ bool wxTLSServerTrustPanel::TransferDataFromWindow() } // Save acceptable server names. - m_cfg.m_server_names = m_server_names_val; + m_cfg.m_server_names.clear(); + for (wxArrayString::const_iterator name = m_server_names_val.begin(), name_end = m_server_names_val.end(); name != name_end; ++name) + m_cfg.m_server_names.push_back(std::wstring(*name)); } return true; diff --git a/lib/TTLS_UI/src/Module.cpp b/lib/TTLS_UI/src/Module.cpp index 98b6abd..04d606b 100644 --- a/lib/TTLS_UI/src/Module.cpp +++ b/lib/TTLS_UI/src/Module.cpp @@ -344,7 +344,7 @@ wxInitializerPeer::wxInitializerPeer(_In_ HINSTANCE instance) // Do our wxWidgets configuration and localization initialization. wxInitializeConfig(); if (wxInitializeLocale(s_locale)) { - //s_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion)); + s_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion)); s_locale.AddCatalog(wxT("EAPTTLSUI")); } } diff --git a/lib/wxExtend b/lib/wxExtend index 385528c..1c527e1 160000 --- a/lib/wxExtend +++ b/lib/wxExtend @@ -1 +1 @@ -Subproject commit 385528cf23b9a27d31502865e13652a253d7e228 +Subproject commit 1c527e114c1f5d4c682123086093be1f450e5e27 diff --git a/output/locale/.gitignore b/output/locale/.gitignore index 98f8aa9..f17e7e7 100644 --- a/output/locale/.gitignore +++ b/output/locale/.gitignore @@ -1,4 +1,4 @@ */EAPTTLSUI.mo */EventMonitor.mo -*/wxExtend13.mo +*/wxExtend14.mo */wxstd.mo