Host name and FQDN validators moved to wxExtend; Incorrect FeatureComponent mappings of EventMonitor localization components fixed
This commit is contained in:
parent
9aacbb2fef
commit
e4758faba3
@ -136,6 +136,9 @@
|
||||
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\wxExtend\build\wxExtendLib.vcxproj">
|
||||
<Project>{d3e29951-d9f5-486d-a167-20ae8e90b1fa}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\build\EAPMethodUI.def" />
|
||||
|
Binary file not shown.
@ -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")));
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -5,7 +5,7 @@
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\..\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\..\WinStd\include;..\..\wxExtend\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <WinStd/Common.h>
|
||||
|
||||
#include <wx/arrstr.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
@ -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<std::wstring> *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<std::wstring> *val_out = NULL);
|
||||
|
||||
protected:
|
||||
std::list<std::wstring> *m_val; ///< Pointer to variable to receive control's parsed value
|
||||
};
|
||||
|
||||
|
||||
class wxTLSCredentialsPanel : public wxEAPCredentialsPanel<eap::credentials_tls, wxTLSCredentialsPanelBase>
|
||||
{
|
||||
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<std::wstring> 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
|
||||
};
|
||||
|
||||
|
||||
|
@ -26,4 +26,6 @@
|
||||
|
||||
#include "../include/TLS_UI.h"
|
||||
|
||||
#include <wxex/valnet.h>
|
||||
|
||||
#include <WindowsX.h>
|
||||
|
@ -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<std::wstring> *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<std::wstring> *val_out)
|
||||
{
|
||||
const wxStringCharType *buf = val_in;
|
||||
std::wstring _fqdn, *fqdn = val_out ? &_fqdn : NULL;
|
||||
std::list<std::wstring> _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;
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 385528cf23b9a27d31502865e13652a253d7e228
|
||||
Subproject commit 1c527e114c1f5d4c682123086093be1f450e5e27
|
2
output/locale/.gitignore
vendored
2
output/locale/.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
*/EAPTTLSUI.mo
|
||||
*/EventMonitor.mo
|
||||
*/wxExtend13.mo
|
||||
*/wxExtend14.mo
|
||||
*/wxstd.mo
|
||||
|
Loading…
x
Reference in New Issue
Block a user