diff --git a/CredWrite/Main.cpp b/CredWrite/Main.cpp index 3312a36..bde329e 100644 --- a/CredWrite/Main.cpp +++ b/CredWrite/Main.cpp @@ -23,7 +23,7 @@ using namespace std; using namespace winstd; -eap::module g_module(eap::type_undefined); +eap::peer_base g_module(eap::type_undefined); static int CredWrite() diff --git a/CredWrite/StdAfx.h b/CredWrite/StdAfx.h index 3103120..6dbc3a3 100644 --- a/CredWrite/StdAfx.h +++ b/CredWrite/StdAfx.h @@ -20,6 +20,7 @@ #pragma once +#include "../lib/PAP/include/Config.h" #include "../lib/PAP/include/Credentials.h" #include "../lib/EAPBase/include/Module.h" diff --git a/lib/EAPBase/include/Config.h b/lib/EAPBase/include/Config.h index 05241b8..acdd02d 100644 --- a/lib/EAPBase/include/Config.h +++ b/lib/EAPBase/include/Config.h @@ -306,7 +306,7 @@ namespace eap /// @} /// - /// Makes new set of credentials for the given method type + /// Makes a new set of credentials for the given method type /// virtual credentials* make_credentials() const = 0; @@ -356,8 +356,8 @@ namespace eap m_lbl_alt_password(other.m_lbl_alt_password), config(other) { - for (std::list >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method) - m_methods.push_back(std::move(std::unique_ptr<_Tmeth>(*method ? (_Tmeth*)method->get()->clone() : nullptr))); + for (std::list >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method) + m_methods.push_back(std::move(std::unique_ptr(*method ? (config_method*)method->get()->clone() : nullptr))); } /// @@ -402,8 +402,8 @@ namespace eap m_lbl_alt_password = other.m_lbl_alt_password; m_methods.clear(); - for (std::list >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method) - m_methods.push_back(std::move(std::unique_ptr<_Tmeth>(*method ? (_Tmeth*)method->get()->clone() : nullptr))); + for (std::list >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method) + m_methods.push_back(std::move(std::unique_ptr(*method ? (config_method*)method->get()->clone() : nullptr))); } return *this; @@ -548,7 +548,7 @@ namespace eap return false; } - for (std::list >::const_iterator method = m_methods.cbegin(), method_end = m_methods.cend(); method != method_end; ++method) { + for (std::list >::const_iterator method = m_methods.cbegin(), method_end = m_methods.cend(); method != method_end; ++method) { // winstd::com_obj pXmlElAuthenticationMethod; if ((dwResult = eapxml::create_element(pDoc, winstd::bstr(L"AuthenticationMethod"), bstrNamespace, &pXmlElAuthenticationMethod))) { @@ -661,7 +661,7 @@ namespace eap winstd::com_obj pXmlElMethod; pXmlListMethods->get_item(i, &pXmlElMethod); - std::unique_ptr<_Tmeth> cfg(new _Tmeth(m_module)); + std::unique_ptr cfg(m_module.make_config_method()); // Check EAP method type (). DWORD dwMethodID; @@ -749,14 +749,14 @@ namespace eap eapserial::unpack(cursor, m_lbl_alt_identity ); eapserial::unpack(cursor, m_lbl_alt_password ); - std::list<_Tmeth>::size_type count; + std::list::size_type count; bool is_nonnull; eapserial::unpack(cursor, count); m_methods.clear(); - for (std::list<_Tmeth>::size_type i = 0; i < count; i++) { + for (std::list::size_type i = 0; i < count; i++) { eapserial::unpack(cursor, is_nonnull); if (is_nonnull) { - std::unique_ptr<_Tmeth> el(new _Tmeth(m_module)); + std::unique_ptr el(m_module.make_config_method()); el->unpack(cursor); m_methods.push_back(std::move(el)); } else @@ -767,16 +767,16 @@ namespace eap /// @} public: - bool m_read_only; ///< Is profile read-only - std::wstring m_id; ///< Profile ID - winstd::tstring m_name; ///< Provider name - winstd::tstring m_help_email; ///< Helpdesk e-mail - winstd::tstring m_help_web; ///< Helpdesk website URL - winstd::tstring m_help_phone; ///< Helpdesk phone - winstd::tstring m_lbl_alt_credential; ///< Alternative label for credential prompt - winstd::tstring m_lbl_alt_identity; ///< Alternative label for identity prompt - winstd::tstring m_lbl_alt_password; ///< Alternative label for password prompt - std::list > m_methods; ///< List of method configurations + bool m_read_only; ///< Is profile read-only + std::wstring m_id; ///< Profile ID + winstd::tstring m_name; ///< Provider name + winstd::tstring m_help_email; ///< Helpdesk e-mail + winstd::tstring m_help_web; ///< Helpdesk website URL + winstd::tstring m_help_phone; ///< Helpdesk phone + winstd::tstring m_lbl_alt_credential; ///< Alternative label for credential prompt + winstd::tstring m_lbl_alt_identity; ///< Alternative label for identity prompt + winstd::tstring m_lbl_alt_password; ///< Alternative label for password prompt + std::list > m_methods; ///< List of method configurations }; diff --git a/lib/EAPBase/include/Module.h b/lib/EAPBase/include/Module.h index b3bfbb9..6c9a37e 100644 --- a/lib/EAPBase/include/Module.h +++ b/lib/EAPBase/include/Module.h @@ -96,6 +96,11 @@ namespace eap /// void free_error_memory(_In_ EAP_ERROR *err); + /// + /// Makes a new method config for the given method type + /// + virtual config_method* make_config_method() = 0; + /// @} /// \name Logging @@ -693,6 +698,14 @@ namespace eap /// Constructs a EAP peer module for the given EAP type /// peer_base(_In_ type_t eap_method) : module(eap_method) {} + + /// + /// Makes a new method config for the given method type + /// + virtual config_method* make_config_method() + { + return new config_method_type(*this); + } }; diff --git a/lib/EAPBase_UI/include/EAP_UI.h b/lib/EAPBase_UI/include/EAP_UI.h index 7265f78..40d0a97 100644 --- a/lib/EAPBase_UI/include/EAP_UI.h +++ b/lib/EAPBase_UI/include/EAP_UI.h @@ -116,8 +116,8 @@ public: for (std::list<_Tprov>::iterator provider = m_cfg.m_providers.begin(), provider_end = m_cfg.m_providers.end(); provider != provider_end; ++provider) { bool is_single = provider->m_methods.size() == 1; - std::list >::size_type count = 0; - std::list >::iterator method = provider->m_methods.begin(), method_end = provider->m_methods.end(); + std::list >::size_type count = 0; + std::list >::iterator method = provider->m_methods.begin(), method_end = provider->m_methods.end(); for (; method != method_end; ++method, count++) m_providers->AddPage( new _wxT( diff --git a/lib/TTLS_UI/include/TTLS_UI.h b/lib/TTLS_UI/include/TTLS_UI.h index 3e39b40..88d2bf6 100644 --- a/lib/TTLS_UI/include/TTLS_UI.h +++ b/lib/TTLS_UI/include/TTLS_UI.h @@ -121,10 +121,10 @@ protected: /// \endcond protected: - _Tprov &m_prov; ///< EAP provider - eap::config_method_ttls &m_cfg; ///< TTLS configuration - winstd::library m_shell32; ///< shell32.dll resource library reference - wxIcon m_icon; ///< Panel icon + _Tprov &m_prov; ///< EAP provider + eap::config_method_ttls &m_cfg; ///< TTLS configuration + winstd::library m_shell32; ///< shell32.dll resource library reference + wxIcon m_icon; ///< Panel icon }; @@ -139,9 +139,9 @@ public: /// \param[in] pszCredTarget Target name of credentials in Windows Credential Manager. Can be further decorated to create final target name. /// \param[in] parent Parent window /// - wxTTLSConfigWindow(_Tprov &prov, eap::config_method_ttls &cfg, LPCTSTR pszCredTarget, wxWindow* parent) : + wxTTLSConfigWindow(_Tprov &prov, eap::config_method &cfg, LPCTSTR pszCredTarget, wxWindow* parent) : m_prov(prov), - m_cfg(cfg), + m_cfg((eap::config_method_ttls&)cfg), m_cfg_pap(cfg.m_module), wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL) { @@ -269,5 +269,6 @@ protected: wxStaticText *m_inner_title; ///< Inner authentication title wxChoicebook *m_inner_type; ///< Inner authentication type - eap::config_method_pap m_cfg_pap; ///< Temporary PAP configuration + // Temprary inner method configurations to hold data until applied + eap::config_method_pap m_cfg_pap; ///< PAP configuration };