diff --git a/lib/EAPBase/include/Config.h b/lib/EAPBase/include/Config.h index 04e1f5c..fb9a5d3 100644 --- a/lib/EAPBase/include/Config.h +++ b/lib/EAPBase/include/Config.h @@ -358,8 +358,8 @@ namespace eap public: bool m_allow_save; ///< Are credentials allowed to be saved to Windows Credential Manager? - bool m_use_preshared; ///< Use pre-shared credentials - std::unique_ptr m_preshared; ///< Pre-shared credentials + bool m_use_cred; ///< Use configured credentials + std::unique_ptr m_cred; ///< Configured credentials enum status { status_success = 0, ///< Authentication succeeded diff --git a/lib/EAPBase/include/Credentials.h b/lib/EAPBase/include/Credentials.h index 2a08563..f4d0073 100644 --- a/lib/EAPBase/include/Credentials.h +++ b/lib/EAPBase/include/Credentials.h @@ -67,7 +67,7 @@ namespace eap enum source_t { source_unknown = -1, ///< Unknown source source_cache = 0, ///< Credentials were obtained from EapHost cache - source_preshared, ///< Credentials were set by method configuration + source_config, ///< Credentials were set by method configuration source_storage ///< Credentials were loaded from Windows Credential Manager }; @@ -247,9 +247,9 @@ namespace eap /// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL) /// /// \returns - /// - \c source_cache Credentials were obtained from EapHost cache - /// - \c source_preshared Credentials were set by method configuration - /// - \c source_storage Credentials were loaded from Windows Credential Manager + /// - \c source_cache Credentials were obtained from EapHost cache + /// - \c source_config Credentials were set by method configuration + /// - \c source_storage Credentials were loaded from Windows Credential Manager /// virtual source_t combine( _In_ const credentials *cred_cached, @@ -408,9 +408,9 @@ namespace eap /// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL) /// /// \returns - /// - \c source_cache Credentials were obtained from EapHost cache - /// - \c source_preshared Credentials were set by method configuration - /// - \c source_storage Credentials were loaded from Windows Credential Manager + /// - \c source_cache Credentials were obtained from EapHost cache + /// - \c source_config Credentials were set by method configuration + /// - \c source_storage Credentials were loaded from Windows Credential Manager /// virtual source_t combine( _In_ const credentials *cred_cached, diff --git a/lib/EAPBase/src/Config.cpp b/lib/EAPBase/src/Config.cpp index d90c06f..c13b04f 100644 --- a/lib/EAPBase/src/Config.cpp +++ b/lib/EAPBase/src/Config.cpp @@ -151,7 +151,7 @@ eap::config_method& eap::config_method::operator=(_Inout_ config_method &&other) eap::config_method_with_cred::config_method_with_cred(_In_ module &mod, _In_ unsigned int level) : m_allow_save(true), - m_use_preshared(false), + m_use_cred(false), m_last_status(status_success), config_method(mod, level) { @@ -159,23 +159,23 @@ eap::config_method_with_cred::config_method_with_cred(_In_ module &mod, _In_ uns eap::config_method_with_cred::config_method_with_cred(_In_ const config_method_with_cred &other) : - m_allow_save (other.m_allow_save ), - m_use_preshared(other.m_use_preshared ), - m_preshared (other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr), - m_last_status (other.m_last_status ), - m_last_msg (other.m_last_msg ), - config_method (other ) + m_allow_save (other.m_allow_save ), + m_use_cred (other.m_use_cred ), + m_cred (other.m_cred ? (credentials*)other.m_cred->clone() : nullptr), + m_last_status (other.m_last_status ), + m_last_msg (other.m_last_msg ), + config_method (other ) { } eap::config_method_with_cred::config_method_with_cred(_Inout_ config_method_with_cred &&other) : - m_allow_save (std::move(other.m_allow_save )), - m_use_preshared(std::move(other.m_use_preshared)), - m_preshared (std::move(other.m_preshared )), - m_last_status (std::move(other.m_last_status )), - m_last_msg (std::move(other.m_last_msg )), - config_method (std::move(other )) + m_allow_save (std::move(other.m_allow_save )), + m_use_cred (std::move(other.m_use_cred )), + m_cred (std::move(other.m_cred )), + m_last_status(std::move(other.m_last_status)), + m_last_msg (std::move(other.m_last_msg )), + config_method(std::move(other )) { } @@ -185,8 +185,8 @@ eap::config_method_with_cred& eap::config_method_with_cred::operator=(_In_ const if (this != &other) { (config_method&)*this = other; m_allow_save = other.m_allow_save; - m_use_preshared = other.m_use_preshared; - m_preshared.reset(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr); + m_use_cred = other.m_use_cred; + m_cred.reset(other.m_cred ? (credentials*)other.m_cred->clone() : nullptr); m_last_status = other.m_last_status; m_last_msg = other.m_last_msg; } @@ -198,12 +198,12 @@ eap::config_method_with_cred& eap::config_method_with_cred::operator=(_In_ const eap::config_method_with_cred& eap::config_method_with_cred::operator=(_Inout_ config_method_with_cred &&other) { if (this != &other) { - (config_method&)*this = std::move(other ); - m_allow_save = std::move(other.m_allow_save ); - m_use_preshared = std::move(other.m_use_preshared); - m_preshared = std::move(other.m_preshared ); - m_last_status = std::move(other.m_last_status ); - m_last_msg = std::move(other.m_last_msg ); + (config_method&)*this = std::move(other ); + m_allow_save = std::move(other.m_allow_save ); + m_use_cred = std::move(other.m_use_cred ); + m_cred = std::move(other.m_cred ); + m_last_status = std::move(other.m_last_status); + m_last_msg = std::move(other.m_last_msg ); } return *this; @@ -226,8 +226,8 @@ void eap::config_method_with_cred::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOM if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, winstd::bstr(L"allow-save"), namespace_eapmetadata, m_allow_save))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); - if (m_use_preshared) - m_preshared->save(pDoc, pXmlElClientSideCredential); + if (m_use_cred) + m_cred->save(pDoc, pXmlElClientSideCredential); } @@ -235,9 +235,9 @@ void eap::config_method_with_cred::load(_In_ IXMLDOMNode *pConfigRoot) { assert(pConfigRoot); - m_allow_save = true; - m_use_preshared = false; - m_preshared->clear(); + m_allow_save = true; + m_use_cred = false; + m_cred->clear(); // winstd::com_obj pXmlElClientSideCredential; @@ -249,10 +249,10 @@ void eap::config_method_with_cred::load(_In_ IXMLDOMNode *pConfigRoot) m_module.log_config((xpath + L"/allow-save").c_str(), m_allow_save); try { - m_preshared->load(pXmlElClientSideCredential); - m_use_preshared = true; + m_cred->load(pXmlElClientSideCredential); + m_use_cred = true; } catch (...) { - // This is not really an error - merely an indication pre-shared credentials are unavailable. + // This is not really an error - merely an indication configured credentials are unavailable. } } @@ -265,8 +265,8 @@ void eap::config_method_with_cred::operator<<(_Inout_ cursor_out &cursor) const { config_method::operator<<(cursor); cursor << m_allow_save; - cursor << m_use_preshared; - cursor << *m_preshared; + cursor << m_use_cred; + cursor << *m_cred; cursor << m_last_status; cursor << m_last_msg; } @@ -276,11 +276,11 @@ size_t eap::config_method_with_cred::get_pk_size() const { return config_method::get_pk_size() + - pksizeof(m_allow_save ) + - pksizeof(m_use_preshared) + - pksizeof(*m_preshared ) + - pksizeof(m_last_status ) + - pksizeof(m_last_msg ); + pksizeof(m_allow_save ) + + pksizeof(m_use_cred ) + + pksizeof(*m_cred ) + + pksizeof(m_last_status) + + pksizeof(m_last_msg ); } @@ -288,8 +288,8 @@ void eap::config_method_with_cred::operator>>(_Inout_ cursor_in &cursor) { config_method::operator>>(cursor); cursor >> m_allow_save; - cursor >> m_use_preshared; - cursor >> *m_preshared; + cursor >> m_use_cred; + cursor >> *m_cred; cursor >> m_last_status; cursor >> m_last_msg; } diff --git a/lib/EAPBase/src/Credentials.cpp b/lib/EAPBase/src/Credentials.cpp index c8ccff2..502239b 100644 --- a/lib/EAPBase/src/Credentials.cpp +++ b/lib/EAPBase/src/Credentials.cpp @@ -375,11 +375,11 @@ eap::credentials::source_t eap::credentials_pass::combine( return source_cache; } - if (cfg.m_use_preshared) { - // Using preshared credentials. - *this = *(credentials_pass*)cfg.m_preshared.get(); - m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_PRESHARED1, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_pass::get_name()), event_data::blank); - return source_preshared; + if (cfg.m_use_cred) { + // Using configured credentials. + *this = *(credentials_pass*)cfg.m_cred.get(); + m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CONFIG1, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_pass::get_name()), event_data::blank); + return source_config; } if (pszTargetName) { diff --git a/lib/EAPBase_UI/include/EAP_UI.h b/lib/EAPBase_UI/include/EAP_UI.h index c3c604d..a7ebdd4 100644 --- a/lib/EAPBase_UI/include/EAP_UI.h +++ b/lib/EAPBase_UI/include/EAP_UI.h @@ -569,9 +569,9 @@ public: wxEAPCredentialsConfigPanel(const eap::config_provider &prov, eap::config_method_with_cred &cfg, wxWindow *parent) : m_prov(prov), m_cfg(cfg), - m_has_own(false), - m_cred_own(cfg.m_module), - m_cred_preshared(cfg.m_module), + m_has_storage(false), + m_cred_storage(cfg.m_module), + m_cred_config(cfg.m_module), wxEAPCredentialsConfigPanelBase(parent) { // Load and set icon. @@ -585,7 +585,7 @@ public: /// inline void SetFocusFromKbd() { - m_own->SetFocusFromKbd(); + m_storage->SetFocusFromKbd(); } protected: @@ -593,18 +593,18 @@ protected: virtual bool TransferDataToWindow() { - if (!m_cfg.m_use_preshared) - m_own->SetValue(true); + if (!m_cfg.m_use_cred) + m_storage->SetValue(true); else - m_preshared->SetValue(true); + m_config->SetValue(true); if (m_cfg.m_allow_save) { - RetrieveOwnCredentials(); - m_timer_own.Start(3000); + RetrieveStorageCredentials(); + m_timer_storage.Start(3000); } - m_cred_preshared = *(_Tcred*)m_cfg.m_preshared.get(); - UpdatePresharedIdentity(); + m_cred_config = *(_Tcred*)m_cfg.m_cred.get(); + UpdateConfigIdentity(); return wxEAPCredentialsConfigPanelBase::TransferDataToWindow(); } @@ -616,8 +616,8 @@ protected: if (!m_prov.m_read_only) { // This is not a provider-locked configuration. Save the data. - m_cfg.m_use_preshared = !m_own->GetValue(); - *m_cfg.m_preshared = m_cred_preshared; + m_cfg.m_use_cred = !m_storage->GetValue(); + *m_cfg.m_cred = m_cred_config; } return true; @@ -627,139 +627,139 @@ protected: virtual void OnUpdateUI(wxUpdateUIEvent& /*event*/) { if (m_cfg.m_allow_save) { - if (m_own->GetValue()) { - m_own_identity->Enable(true); - m_own_set ->Enable(true); - m_own_clear ->Enable(m_has_own); + if (m_storage->GetValue()) { + m_storage_identity->Enable(true); + m_storage_set ->Enable(true); + m_storage_clear ->Enable(m_has_storage); } else { - m_own_identity->Enable(false); - m_own_set ->Enable(false); - m_own_clear ->Enable(false); + m_storage_identity->Enable(false); + m_storage_set ->Enable(false); + m_storage_clear ->Enable(false); } } else { - m_own_identity->Enable(false); - m_own_set ->Enable(false); - m_own_clear ->Enable(false); + m_storage_identity->Enable(false); + m_storage_set ->Enable(false); + m_storage_clear ->Enable(false); } if (m_prov.m_read_only) { // This is provider-locked configuration. Disable controls. // To avoid run-away selection of radio buttons, disable the selected one last. - if (m_own->GetValue()) { - m_preshared->Enable(false); - m_own ->Enable(false); + if (m_storage->GetValue()) { + m_config ->Enable(false); + m_storage->Enable(false); } else { - m_own ->Enable(false); - m_preshared->Enable(false); + m_storage->Enable(false); + m_config ->Enable(false); } - m_preshared_identity->Enable(false); - m_preshared_set ->Enable(false); + m_config_identity->Enable(false); + m_config_set ->Enable(false); } else { // This is not a provider-locked configuration. Selectively enable/disable controls. - m_own ->Enable(true); - m_preshared->Enable(true); - if (m_own->GetValue()) { - m_preshared_identity->Enable(false); - m_preshared_set ->Enable(false); + m_storage->Enable(true); + m_config->Enable(true); + if (m_storage->GetValue()) { + m_config_identity->Enable(false); + m_config_set ->Enable(false); } else { - m_preshared_identity->Enable(true); - m_preshared_set ->Enable(true); + m_config_identity->Enable(true); + m_config_set ->Enable(true); } } } - virtual void OnSetOwn(wxCommandEvent& /*event*/) + virtual void OnSetStorage(wxCommandEvent& /*event*/) { // Read credentials from Credential Manager. - RetrieveOwnCredentials(); + RetrieveStorageCredentials(); // Display credential prompt. wxEAPCredentialsDialog dlg(m_prov, this); - _wxT *panel = new _wxT(m_prov, m_cfg, m_cred_own, &dlg, true); + _wxT *panel = new _wxT(m_prov, m_cfg, m_cred_storage, &dlg, true); dlg.AddContent(panel); if (dlg.ShowModal() == wxID_OK && panel->GetRemember()) { // Write credentials to credential manager. try { - m_cred_own.store(m_prov.get_id().c_str(), m_cfg.m_level); - m_has_own = TRUE; - UpdateOwnIdentity(); + m_cred_storage.store(m_prov.get_id().c_str(), m_cfg.m_level); + m_has_storage = TRUE; + UpdateStorageIdentity(); } catch (winstd::win_runtime_error &err) { wxLogError(winstd::tstring_printf(_("Error writing credentials to Credential Manager: %hs (error %u)"), err.what(), err.number()).c_str()); - RetrieveOwnCredentials(); + RetrieveStorageCredentials(); } catch (...) { wxLogError(_("Writing credentials failed.")); - RetrieveOwnCredentials(); + RetrieveStorageCredentials(); } } } - virtual void OnClearOwn(wxCommandEvent& /*event*/) + virtual void OnClearStorage(wxCommandEvent& /*event*/) { - if (CredDelete(m_cred_own.target_name(m_prov.get_id().c_str(), m_cfg.m_level).c_str(), CRED_TYPE_GENERIC, 0)) { - m_own_identity->Clear(); - m_has_own = false; + if (CredDelete(m_cred_storage.target_name(m_prov.get_id().c_str(), m_cfg.m_level).c_str(), CRED_TYPE_GENERIC, 0)) { + m_storage_identity->Clear(); + m_has_storage = false; } else wxLogError(_("Deleting credentials failed (error %u)."), GetLastError()); } - virtual void OnSetPreshared(wxCommandEvent& /*event*/) + virtual void OnSetConfig(wxCommandEvent& /*event*/) { wxEAPCredentialsDialog dlg(m_prov, this); - _wxT *panel = new _wxT(m_prov, m_cfg, m_cred_preshared, &dlg, true); + _wxT *panel = new _wxT(m_prov, m_cfg, m_cred_config, &dlg, true); dlg.AddContent(panel); if (dlg.ShowModal() == wxID_OK) - UpdatePresharedIdentity(); + UpdateConfigIdentity(); } - virtual void OnTimerOwn(wxTimerEvent& /*event*/) + virtual void OnTimerStorage(wxTimerEvent& /*event*/) { - if (m_own_identity->IsShownOnScreen()) - RetrieveOwnCredentials(); + if (m_storage_identity->IsShownOnScreen()) + RetrieveStorageCredentials(); } - void RetrieveOwnCredentials() + void RetrieveStorageCredentials() { try { - m_cred_own.retrieve(m_prov.get_id().c_str(), m_cfg.m_level); - m_has_own = true; - UpdateOwnIdentity(); + m_cred_storage.retrieve(m_prov.get_id().c_str(), m_cfg.m_level); + m_has_storage = true; + UpdateStorageIdentity(); } catch (winstd::win_runtime_error &err) { if (err.number() == ERROR_NOT_FOUND) { - m_own_identity->Clear(); - m_has_own = false; + m_storage_identity->Clear(); + m_has_storage = false; } else { - m_own_identity->SetValue(wxString::Format(_(""), err.number())); - m_has_own = true; + m_storage_identity->SetValue(wxString::Format(_(""), err.number())); + m_has_storage = true; } } catch (...) { - m_own_identity->SetValue(_("")); - m_has_own = true; + m_storage_identity->SetValue(_("")); + m_has_storage = true; } } - inline void UpdateOwnIdentity() + inline void UpdateStorageIdentity() { - wxString identity(m_cred_own.get_identity()); - m_own_identity->SetValue( + wxString identity(m_cred_storage.get_identity()); + m_storage_identity->SetValue( !identity.empty() ? identity : - m_cred_own.empty() ? _("") : _("")); + m_cred_storage.empty() ? _("") : _("")); } - inline void UpdatePresharedIdentity() + inline void UpdateConfigIdentity() { - wxString identity(m_cred_preshared.get_identity()); - m_preshared_identity->SetValue( - !identity.empty() ? identity : - m_cred_preshared.empty() ? _("") : _("")); + wxString identity(m_cred_config.get_identity()); + m_config_identity->SetValue( + !identity.empty() ? identity : + m_cred_config.empty() ? _("") : _("")); } /// \endcond @@ -769,9 +769,9 @@ protected: eap::config_method_with_cred &m_cfg; ///< EAP method configuration private: - bool m_has_own; ///< Does the user has (some sort of) credentials stored in Credential Manager? - _Tcred m_cred_own; ///< Temporary own credential data - _Tcred m_cred_preshared; ///< Temporary pre-shared credential data + bool m_has_storage; ///< Does the user has (some sort of) credentials stored in Credential Manager? + _Tcred m_cred_storage; ///< Temporary own credential data + _Tcred m_cred_config; ///< Temporary config credential data }; @@ -822,8 +822,8 @@ protected: // Always store credentials (somewhere). m_remember->SetValue(true); m_remember->Enable(false); - } else if (m_cfg.m_use_preshared) { - // Credential prompt mode & Using pre-shared credentials + } else if (m_cfg.m_use_cred) { + // Credential prompt mode & Using configured credentials m_remember->SetValue(false); m_remember->Enable(false); } else if (!m_cfg.m_allow_save) { @@ -896,8 +896,8 @@ protected: m_identity->SetSelection(0, -1); m_password->SetValue(m_cred.m_password.empty() ? wxEmptyString : s_dummy_password); - if (!m_is_config && m_cfg.m_use_preshared) { - // Credential prompt mode & Using pre-shared credentials + if (!m_is_config && m_cfg.m_use_cred) { + // Credential prompt mode & Using configured credentials m_identity_label->Enable(false); m_identity ->Enable(false); m_password_label->Enable(false); diff --git a/lib/EAPBase_UI/res/wxEAP_UI.cpp b/lib/EAPBase_UI/res/wxEAP_UI.cpp index 72f3e36..62c0500 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.cpp +++ b/lib/EAPBase_UI/res/wxEAP_UI.cpp @@ -245,76 +245,76 @@ wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* pare wxBoxSizer* sb_cred_radio; sb_cred_radio = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* sz_own; - sz_own = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* sz_storage; + sz_storage = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* sz_own_inner; - sz_own_inner = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* sz_storage_inner; + sz_storage_inner = new wxBoxSizer( wxHORIZONTAL ); - m_own = new wxRadioButton( sb_credentials->GetStaticBox(), wxID_ANY, _("Use &own credentials:"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - m_own->SetToolTip( _("Select this option if you have your unique credentials to connect") ); + m_storage = new wxRadioButton( sb_credentials->GetStaticBox(), wxID_ANY, _("Use &own credentials:"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_storage->SetToolTip( _("Select this option if you have your unique credentials to connect") ); - sz_own_inner->Add( m_own, 2, wxEXPAND, 5 ); + sz_storage_inner->Add( m_storage, 2, wxEXPAND, 5 ); - m_own_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); - m_own_identity->SetToolTip( _("Your credentials loaded from Windows Credential Manager") ); + m_storage_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + m_storage_identity->SetToolTip( _("Your credentials loaded from Windows Credential Manager") ); - sz_own_inner->Add( m_own_identity, 3, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + sz_storage_inner->Add( m_storage_identity, 3, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - sz_own->Add( sz_own_inner, 1, wxEXPAND|wxBOTTOM, 5 ); + sz_storage->Add( sz_storage_inner, 1, wxEXPAND|wxBOTTOM, 5 ); - wxBoxSizer* sb_buttons_own; - sb_buttons_own = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* sb_buttons_storage; + sb_buttons_storage = new wxBoxSizer( wxHORIZONTAL ); - m_own_clear = new wxButton( sb_credentials->GetStaticBox(), wxID_ANY, _("&Clear Credentials"), wxDefaultPosition, wxDefaultSize, 0 ); - m_own_clear->SetToolTip( _("Click to clear your credentials from Credential Manager.\nNote: You will be prompted to enter credentials when connecting.") ); + m_storage_clear = new wxButton( sb_credentials->GetStaticBox(), wxID_ANY, _("&Clear Credentials"), wxDefaultPosition, wxDefaultSize, 0 ); + m_storage_clear->SetToolTip( _("Click to clear your credentials from Credential Manager.\nNote: You will be prompted to enter credentials when connecting.") ); - sb_buttons_own->Add( m_own_clear, 0, wxRIGHT, 5 ); + sb_buttons_storage->Add( m_storage_clear, 0, wxRIGHT, 5 ); - m_own_set = new wxButton( sb_credentials->GetStaticBox(), wxID_ANY, _("&Set Credentials..."), wxDefaultPosition, wxDefaultSize, 0 ); - m_own_set->SetToolTip( _("Click here to set or modify your credentials") ); + m_storage_set = new wxButton( sb_credentials->GetStaticBox(), wxID_ANY, _("&Set Credentials..."), wxDefaultPosition, wxDefaultSize, 0 ); + m_storage_set->SetToolTip( _("Click here to set or modify your credentials") ); - sb_buttons_own->Add( m_own_set, 0, wxLEFT, 5 ); + sb_buttons_storage->Add( m_storage_set, 0, wxLEFT, 5 ); - sz_own->Add( sb_buttons_own, 0, wxALIGN_RIGHT, 5 ); + sz_storage->Add( sb_buttons_storage, 0, wxALIGN_RIGHT, 5 ); - sb_cred_radio->Add( sz_own, 0, wxEXPAND|wxBOTTOM, 5 ); + sb_cred_radio->Add( sz_storage, 0, wxEXPAND|wxBOTTOM, 5 ); - wxBoxSizer* sz_preshared; - sz_preshared = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* sz_config; + sz_config = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* sz_preshared_inner; - sz_preshared_inner = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* sz_config_inner; + sz_config_inner = new wxBoxSizer( wxHORIZONTAL ); - m_preshared = new wxRadioButton( sb_credentials->GetStaticBox(), wxID_ANY, _("Use &pre-shared credentials:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_preshared->SetToolTip( _("Select this options if all clients connect using the same credentials") ); + m_config = new wxRadioButton( sb_credentials->GetStaticBox(), wxID_ANY, _("Use &pre-shared credentials:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_config->SetToolTip( _("Select this options if all clients connect using the same credentials") ); - sz_preshared_inner->Add( m_preshared, 2, wxEXPAND, 5 ); + sz_config_inner->Add( m_config, 2, wxEXPAND, 5 ); - m_preshared_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); - m_preshared_identity->SetToolTip( _("Common (pre-shared) credentials") ); + m_config_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + m_config_identity->SetToolTip( _("Common (pre-shared) credentials") ); - sz_preshared_inner->Add( m_preshared_identity, 3, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + sz_config_inner->Add( m_config_identity, 3, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - sz_preshared->Add( sz_preshared_inner, 1, wxEXPAND|wxBOTTOM, 5 ); + sz_config->Add( sz_config_inner, 1, wxEXPAND|wxBOTTOM, 5 ); - wxBoxSizer* sb_buttons_preshared; - sb_buttons_preshared = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* sb_buttons_config; + sb_buttons_config = new wxBoxSizer( wxHORIZONTAL ); - m_preshared_set = new wxButton( sb_credentials->GetStaticBox(), wxID_ANY, _("&Set Credentials..."), wxDefaultPosition, wxDefaultSize, 0 ); - m_preshared_set->SetToolTip( _("Click here to set or modify your credentials") ); + m_config_set = new wxButton( sb_credentials->GetStaticBox(), wxID_ANY, _("&Set Credentials..."), wxDefaultPosition, wxDefaultSize, 0 ); + m_config_set->SetToolTip( _("Click here to set or modify your credentials") ); - sb_buttons_preshared->Add( m_preshared_set, 0, 0, 5 ); + sb_buttons_config->Add( m_config_set, 0, 0, 5 ); - sz_preshared->Add( sb_buttons_preshared, 0, wxALIGN_RIGHT, 5 ); + sz_config->Add( sb_buttons_config, 0, wxALIGN_RIGHT, 5 ); - sb_cred_radio->Add( sz_preshared, 0, wxEXPAND|wxTOP, 5 ); + sb_cred_radio->Add( sz_config, 0, wxEXPAND|wxTOP, 5 ); sb_credentials_vert->Add( sb_cred_radio, 0, wxEXPAND|wxALL, 5 ); @@ -328,24 +328,24 @@ wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* pare this->SetSizer( sb_credentials ); this->Layout(); - m_timer_own.SetOwner( this, wxID_ANY ); + m_timer_storage.SetOwner( this, wxID_ANY ); // Connect Events this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPCredentialsConfigPanelBase::OnUpdateUI ) ); - m_own_clear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearOwn ), NULL, this ); - m_own_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetOwn ), NULL, this ); - m_preshared_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetPreshared ), NULL, this ); - this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerOwn ) ); + m_storage_clear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearStorage ), NULL, this ); + m_storage_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetStorage ), NULL, this ); + m_config_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetConfig ), NULL, this ); + this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerStorage ) ); } wxEAPCredentialsConfigPanelBase::~wxEAPCredentialsConfigPanelBase() { // Disconnect Events this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPCredentialsConfigPanelBase::OnUpdateUI ) ); - m_own_clear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearOwn ), NULL, this ); - m_own_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetOwn ), NULL, this ); - m_preshared_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetPreshared ), NULL, this ); - this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerOwn ) ); + m_storage_clear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearStorage ), NULL, this ); + m_storage_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetStorage ), NULL, this ); + m_config_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetConfig ), NULL, this ); + this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerStorage ) ); } diff --git a/lib/EAPBase_UI/res/wxEAP_UI.fbp b/lib/EAPBase_UI/res/wxEAP_UI.fbp index 368d522..bfa3f09 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.fbp +++ b/lib/EAPBase_UI/res/wxEAP_UI.fbp @@ -1664,7 +1664,7 @@ 0 - sz_own + sz_storage wxVERTICAL none @@ -1673,7 +1673,7 @@ 1 - sz_own_inner + sz_storage_inner wxHORIZONTAL none @@ -1716,7 +1716,7 @@ 0 1 - m_own + m_storage 1 @@ -1804,7 +1804,7 @@ 0 1 - m_own_identity + m_storage_identity 1 @@ -1863,7 +1863,7 @@ 0 - sb_buttons_own + sb_buttons_storage wxHORIZONTAL none @@ -1907,7 +1907,7 @@ 0 1 - m_own_clear + m_storage_clear 1 @@ -1928,7 +1928,7 @@ - OnClearOwn + OnClearStorage @@ -1995,7 +1995,7 @@ 0 1 - m_own_set + m_storage_set 1 @@ -2016,7 +2016,7 @@ - OnSetOwn + OnSetStorage @@ -2052,7 +2052,7 @@ 0 - sz_preshared + sz_config wxVERTICAL none @@ -2061,7 +2061,7 @@ 1 - sz_preshared_inner + sz_config_inner wxHORIZONTAL none @@ -2104,7 +2104,7 @@ 0 1 - m_preshared + m_config 1 @@ -2192,7 +2192,7 @@ 0 1 - m_preshared_identity + m_config_identity 1 @@ -2251,7 +2251,7 @@ 0 - sb_buttons_preshared + sb_buttons_config wxHORIZONTAL none @@ -2295,7 +2295,7 @@ 0 1 - m_preshared_set + m_config_set 1 @@ -2316,7 +2316,7 @@ - OnSetPreshared + OnSetConfig @@ -2356,11 +2356,11 @@ 0 wxID_ANY - m_timer_own + m_timer_storage 0 5000 protected - OnTimerOwn + OnTimerStorage diff --git a/lib/EAPBase_UI/res/wxEAP_UI.h b/lib/EAPBase_UI/res/wxEAP_UI.h index 0d941fb..7e13613 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.h +++ b/lib/EAPBase_UI/res/wxEAP_UI.h @@ -167,21 +167,21 @@ class wxEAPCredentialsConfigPanelBase : public wxPanel protected: wxStaticBitmap* m_credentials_icon; wxStaticText* m_credentials_label; - wxRadioButton* m_own; - wxTextCtrl* m_own_identity; - wxButton* m_own_clear; - wxButton* m_own_set; - wxRadioButton* m_preshared; - wxTextCtrl* m_preshared_identity; - wxButton* m_preshared_set; - wxTimer m_timer_own; + wxRadioButton* m_storage; + wxTextCtrl* m_storage_identity; + wxButton* m_storage_clear; + wxButton* m_storage_set; + wxRadioButton* m_config; + wxTextCtrl* m_config_identity; + wxButton* m_config_set; + wxTimer m_timer_storage; // Virtual event handlers, overide them in your derived class virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void OnClearOwn( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSetOwn( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSetPreshared( wxCommandEvent& event ) { event.Skip(); } - virtual void OnTimerOwn( wxTimerEvent& event ) { event.Skip(); } + virtual void OnClearStorage( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSetStorage( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSetConfig( wxCommandEvent& event ) { event.Skip(); } + virtual void OnTimerStorage( wxTimerEvent& event ) { event.Skip(); } public: diff --git a/lib/Events/res/EventsETW.man b/lib/Events/res/EventsETW.man index b7b61de..9366d8d 100644 Binary files a/lib/Events/res/EventsETW.man and b/lib/Events/res/EventsETW.man differ diff --git a/lib/MSCHAPv2/src/Config.cpp b/lib/MSCHAPv2/src/Config.cpp index 87f271a..7255b65 100644 --- a/lib/MSCHAPv2/src/Config.cpp +++ b/lib/MSCHAPv2/src/Config.cpp @@ -30,7 +30,7 @@ using namespace winstd; eap::config_method_mschapv2::config_method_mschapv2(_In_ module &mod, _In_ unsigned int level) : config_method_with_cred(mod, level) { - m_preshared.reset(new credentials_pass(mod)); + m_cred.reset(new credentials_pass(mod)); } diff --git a/lib/PAP/src/Config.cpp b/lib/PAP/src/Config.cpp index 36a95de..ceb01ee 100644 --- a/lib/PAP/src/Config.cpp +++ b/lib/PAP/src/Config.cpp @@ -30,7 +30,7 @@ using namespace winstd; eap::config_method_pap::config_method_pap(_In_ module &mod, _In_ unsigned int level) : config_method_with_cred(mod, level) { - m_preshared.reset(new credentials_pass(mod)); + m_cred.reset(new credentials_pass(mod)); } diff --git a/lib/TLS/include/Credentials.h b/lib/TLS/include/Credentials.h index 6413eef..2dd9644 100644 --- a/lib/TLS/include/Credentials.h +++ b/lib/TLS/include/Credentials.h @@ -194,9 +194,9 @@ namespace eap /// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL) /// /// \returns - /// - \c source_cache Credentials were obtained from EapHost cache - /// - \c source_preshared Credentials were set by method configuration - /// - \c source_storage Credentials were loaded from Windows Credential Manager + /// - \c source_cache Credentials were obtained from EapHost cache + /// - \c source_config Credentials were set by method configuration + /// - \c source_storage Credentials were loaded from Windows Credential Manager /// virtual source_t combine( _In_ const credentials *cred_cached, diff --git a/lib/TLS/src/Config.cpp b/lib/TLS/src/Config.cpp index cbb27ac..2adff51 100644 --- a/lib/TLS/src/Config.cpp +++ b/lib/TLS/src/Config.cpp @@ -68,7 +68,7 @@ tstring eap::get_cert_title(PCCERT_CONTEXT cert) eap::config_method_tls::config_method_tls(_In_ module &mod, _In_ unsigned int level) : config_method_with_cred(mod, level) { - m_preshared.reset(new credentials_tls(mod)); + m_cred.reset(new credentials_tls(mod)); } diff --git a/lib/TLS/src/Credentials.cpp b/lib/TLS/src/Credentials.cpp index a7794a1..d383b09 100644 --- a/lib/TLS/src/Credentials.cpp +++ b/lib/TLS/src/Credentials.cpp @@ -303,11 +303,11 @@ eap::credentials::source_t eap::credentials_tls::combine( return source_cache; } - if (cfg.m_use_preshared) { - // Using preshared credentials. - *this = *(credentials_tls*)cfg.m_preshared.get(); - m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_PRESHARED2, event_data((unsigned int)eap_type_tls), event_data(credentials_tls::get_name()), event_data(pszTargetName), event_data::blank); - return source_preshared; + if (cfg.m_use_cred) { + // Using configured credentials. + *this = *(credentials_tls*)cfg.m_cred.get(); + m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CONFIG2, event_data((unsigned int)eap_type_tls), event_data(credentials_tls::get_name()), event_data(pszTargetName), event_data::blank); + return source_config; } if (pszTargetName) { diff --git a/lib/TLS_UI/src/TLS_UI.cpp b/lib/TLS_UI/src/TLS_UI.cpp index b8a6e22..d32a3f3 100644 --- a/lib/TLS_UI/src/TLS_UI.cpp +++ b/lib/TLS_UI/src/TLS_UI.cpp @@ -387,8 +387,8 @@ bool wxTLSCredentialsPanel::TransferDataFromWindow() void wxTLSCredentialsPanel::OnUpdateUI(wxUpdateUIEvent& /*event*/) { - if (!m_is_config && m_cfg.m_use_preshared) { - // Credential prompt mode & Using pre-shared credentials + if (!m_is_config && m_cfg.m_use_cred) { + // Credential prompt mode & Using configured credentials // To avoid run-away selection of radio buttons, disable the selected one last. if (m_cert_none->GetValue()) { m_cert_select->Enable(false); diff --git a/lib/TTLS/include/Credentials.h b/lib/TTLS/include/Credentials.h index 6301d7c..01766e4 100644 --- a/lib/TTLS/include/Credentials.h +++ b/lib/TTLS/include/Credentials.h @@ -180,9 +180,9 @@ namespace eap /// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL) /// /// \returns - /// - \c source_cache Credentials were obtained from EapHost cache - /// - \c source_preshared Credentials were set by method configuration - /// - \c source_storage Credentials were loaded from Windows Credential Manager + /// - \c source_cache Credentials were obtained from EapHost cache + /// - \c source_config Credentials were set by method configuration + /// - \c source_storage Credentials were loaded from Windows Credential Manager /// virtual source_t combine( _In_ const credentials *cred_cached, diff --git a/lib/TTLS/src/Config.cpp b/lib/TTLS/src/Config.cpp index b9f69bb..0f68362 100644 --- a/lib/TTLS/src/Config.cpp +++ b/lib/TTLS/src/Config.cpp @@ -32,8 +32,8 @@ eap::config_method_ttls::config_method_ttls(_In_ module &mod, _In_ unsigned int m_inner(new config_method_pap(mod, level + 1)), config_method_tls(mod, level) { - // TTLS is using blank pre-shared credentials per default. - m_use_preshared = true; + // TTLS is using blank configured credentials per default. + m_use_cred = true; } @@ -124,17 +124,17 @@ void eap::config_method_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode { com_obj pXmlElClientSideCredential; if (SUCCEEDED(hr = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential))) { - // Fix 1: Pre-shared outer credentials in draft-winter-opsawg-eap-metadata has some bizarre presence/absence/blank logic for EAP-TTLS methods only. + // Fix 1: Configured outer credentials in draft-winter-opsawg-eap-metadata has some bizarre presence/absence/blank logic for EAP-TTLS methods only. // To keep our code clean, we do some post-processing, to make draft compliant XML on output, while keeping things simple on the inside. - if (m_use_preshared && m_preshared->empty()) { - // For empty pre-shared client certificate must not be present. + if (m_use_cred && m_cred->empty()) { + // For empty configured client certificate must not be present. com_obj pXmlElClientCertificate; if (SUCCEEDED(hr = eapxml::select_node(pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), &pXmlElClientCertificate))) { com_obj pXmlElClientCertificateOld; hr = pXmlElClientSideCredential->removeChild(pXmlElClientCertificate, &pXmlElClientCertificateOld); } - } else if (!m_use_preshared) { - // When not using pre-shared (user must supply one), add empty . + } else if (!m_use_cred) { + // When not using configured client certificate (user must supply one), add empty . com_obj pXmlElClientCertificate; hr = eapxml::create_element(pDoc, pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, &pXmlElClientCertificate); } @@ -153,18 +153,18 @@ void eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot) if (SUCCEEDED(hr = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential))) { com_obj pDoc; if (SUCCEEDED(hr = pXmlElClientSideCredential->get_ownerDocument(&pDoc))) { - // Fix 1: Pre-shared outer credentials in draft-winter-opsawg-eap-metadata has some bizarre presence/absence/blank logic for EAP-TTLS methods only. + // Fix 1: Configured outer credentials in draft-winter-opsawg-eap-metadata has some bizarre presence/absence/blank logic for EAP-TTLS methods only. // To keep our code clean, we do some pre-processing, to accept draft compliant XML on input, while keeping things simple on the inside. com_obj pXmlElClientCertificate; if (SUCCEEDED(hr = eapxml::select_node(pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), &pXmlElClientCertificate))) { VARIANT_BOOL has_children; if (SUCCEEDED(hr = pXmlElClientCertificate->hasChildNodes(&has_children)) && !has_children) { - // Empty means: do not use pre-shared credentials. + // Empty means: do not use configured credentials. com_obj pXmlElClientCertificateOld; hr = pXmlElClientSideCredential->removeChild(pXmlElClientCertificate, &pXmlElClientCertificateOld); } } else { - // Nonexisting means: use blank pre-shared credentials. + // Nonexisting means: use blank configured credentials. com_obj pXmlElClientCertificate; hr = eapxml::create_element(pDoc, pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, &pXmlElClientCertificate); }