eap::config_method is no longer a template class

This commit is contained in:
Simon Rozman 2016-07-20 15:21:58 +02:00
parent ce0bbc5b45
commit 180d9b265c
9 changed files with 238 additions and 212 deletions

View File

@ -28,9 +28,9 @@ namespace eap
class config; class config;
/// ///
/// Base template for method configuration storage /// Base class for method configuration storage
/// ///
template <class _Tcred> class config_method; class config_method;
/// ///
/// Single provider configuration /// Single provider configuration
@ -201,57 +201,34 @@ namespace eap
module &m_module; ///< Reference of the EAP module module &m_module; ///< Reference of the EAP module
}; };
// Forward declaration, otherwise we would have to merge Credentials.h here.
class credentials; class credentials;
template <class _Tcred>
class config_method : public config class config_method : public config
{ {
public:
///
/// Configuration credentials type
///
typedef _Tcred credentials_type;
public: public:
/// ///
/// Constructs configuration /// Constructs configuration
/// ///
/// \param[in] mod Reference of the EAP module to use for global services /// \param[in] mod Reference of the EAP module to use for global services
/// ///
config_method(_In_ module &mod) : config_method(_In_ module &mod);
m_allow_save(true),
config(mod)
{
}
/// ///
/// Copies configuration /// Copies configuration
/// ///
/// \param[in] other Configuration to copy from /// \param[in] other Configuration to copy from
/// ///
config_method(_In_ const config_method<_Tcred> &other) : config_method(_In_ const config_method &other);
m_allow_save(other.m_allow_save),
m_anonymous_identity(other.m_anonymous_identity),
m_preshared(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr),
config(other)
{
}
/// ///
/// Moves configuration /// Moves configuration
/// ///
/// \param[in] other Configuration to move from /// \param[in] other Configuration to move from
/// ///
config_method(_Inout_ config_method<_Tcred> &&other) : config_method(_Inout_ config_method &&other);
m_allow_save(std::move(other.m_allow_save)),
m_anonymous_identity(std::move(other.m_anonymous_identity)),
m_preshared(std::move(other.m_preshared)),
config(std::move(other))
{
}
/// ///
/// Copies configuration /// Copies configuration
@ -260,18 +237,7 @@ namespace eap
/// ///
/// \returns Reference to this object /// \returns Reference to this object
/// ///
config_method& operator=(_In_ const config_method<_Tcred> &other) config_method& operator=(_In_ const config_method &other);
{
if (this != &other) {
(config&)*this = other;
m_allow_save = other.m_allow_save;
m_anonymous_identity = other.m_anonymous_identity;
m_preshared.reset(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr);
}
return *this;
}
/// ///
/// Moves configuration /// Moves configuration
@ -280,18 +246,7 @@ namespace eap
/// ///
/// \returns Reference to this object /// \returns Reference to this object
/// ///
config_method& operator=(_Inout_ config_method<_Tcred> &&other) config_method& operator=(_Inout_ config_method &&other);
{
if (this != &other) {
(config&&)*this = std::move(other);
m_allow_save = std::move(other.m_allow_save);
m_anonymous_identity = std::move(other.m_anonymous_identity);
m_preshared = std::move(other.m_preshared);
}
return *this;
}
/// \name XML configuration management /// \name XML configuration management
/// @{ /// @{
@ -307,45 +262,7 @@ namespace eap
/// - \c true if succeeded /// - \c true if succeeded
/// - \c false otherwise. See \p ppEapError for details. /// - \c false otherwise. See \p ppEapError for details.
/// ///
virtual bool save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const virtual bool save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const;
{
assert(pDoc);
assert(pConfigRoot);
assert(ppEapError);
if (!config::save(pDoc, pConfigRoot, ppEapError))
return false;
const winstd::bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
DWORD dwResult;
// <ClientSideCredential>
winstd::com_obj<IXMLDOMElement> pXmlElClientSideCredential;
if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), winstd::bstr(L"ClientSideCredential"), bstrNamespace, &pXmlElClientSideCredential)) != ERROR_SUCCESS) {
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ClientSideCredential> element."));
return false;
}
// <ClientSideCredential>/<allow-save>
if ((dwResult = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, winstd::bstr(L"allow-save"), bstrNamespace, m_allow_save)) != ERROR_SUCCESS) {
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <allow-save> element."));
return false;
}
// <ClientSideCredential>/<AnonymousIdentity>
if (!m_anonymous_identity.empty())
if ((dwResult = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, winstd::bstr(L"AnonymousIdentity"), bstrNamespace, winstd::bstr(m_anonymous_identity))) != ERROR_SUCCESS) {
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <AnonymousIdentity> element."));
return false;
}
if (m_preshared)
if (!m_preshared->save(pDoc, pXmlElClientSideCredential, ppEapError))
return false;
return true;
}
/// ///
/// Load configuration from XML document /// Load configuration from XML document
@ -357,46 +274,7 @@ namespace eap
/// - \c true if succeeded /// - \c true if succeeded
/// - \c false otherwise. See \p ppEapError for details. /// - \c false otherwise. See \p ppEapError for details.
/// ///
virtual bool load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) virtual bool load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError);
{
assert(pConfigRoot);
assert(ppEapError);
if (!config::load(pConfigRoot, ppEapError))
return false;
m_allow_save = true;
m_preshared.reset(nullptr);
m_anonymous_identity.clear();
// <ClientSideCredential>
winstd::com_obj<IXMLDOMElement> pXmlElClientSideCredential;
if (eapxml::select_element(pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential) == ERROR_SUCCESS) {
std::wstring xpath(eapxml::get_xpath(pXmlElClientSideCredential));
// <allow-save>
eapxml::get_element_value(pXmlElClientSideCredential, winstd::bstr(L"eap-metadata:allow-save"), &m_allow_save);
m_module.log_config((xpath + L"/allow-save").c_str(), m_allow_save);
// <AnonymousIdentity>
eapxml::get_element_value(pXmlElClientSideCredential, winstd::bstr(L"eap-metadata:AnonymousIdentity"), m_anonymous_identity);
m_module.log_config((xpath + L"/AnonymousIdentity").c_str(), m_anonymous_identity.c_str());
std::unique_ptr<credentials> preshared(make_credentials());
assert(preshared);
if (preshared->load(pXmlElClientSideCredential, ppEapError)) {
m_preshared = std::move(preshared);
} else {
// This is not really an error - merely an indication pre-shared credentials are unavailable.
if (*ppEapError) {
m_module.free_error_memory(*ppEapError);
*ppEapError = NULL;
}
}
}
return true;
}
/// @} /// @}
@ -408,57 +286,21 @@ namespace eap
/// ///
/// \param[inout] cursor Memory cursor /// \param[inout] cursor Memory cursor
/// ///
virtual void pack(_Inout_ unsigned char *&cursor) const virtual void pack(_Inout_ unsigned char *&cursor) const;
{
eap::config::pack(cursor);
eapserial::pack(cursor, m_allow_save );
eapserial::pack(cursor, m_anonymous_identity);
if (m_preshared) {
eapserial::pack(cursor, true);
m_preshared->pack(cursor);
} else
eapserial::pack(cursor, false);
}
/// ///
/// Returns packed size of a configuration /// Returns packed size of a configuration
/// ///
/// \returns Size of data when packed (in bytes) /// \returns Size of data when packed (in bytes)
/// ///
virtual size_t get_pk_size() const virtual size_t get_pk_size() const;
{
return
eap::config::get_pk_size() +
eapserial::get_pk_size(m_allow_save ) +
eapserial::get_pk_size(m_anonymous_identity) +
(m_preshared ?
eapserial::get_pk_size(true) +
m_preshared->get_pk_size() :
eapserial::get_pk_size(false));
}
/// ///
/// Unpacks a configuration /// Unpacks a configuration
/// ///
/// \param[inout] cursor Memory cursor /// \param[inout] cursor Memory cursor
/// ///
virtual void unpack(_Inout_ const unsigned char *&cursor) virtual void unpack(_Inout_ const unsigned char *&cursor);
{
eap::config::unpack(cursor);
eapserial::unpack(cursor, m_allow_save );
eapserial::unpack(cursor, m_anonymous_identity);
bool use_preshared;
eapserial::unpack(cursor, use_preshared);
if (use_preshared) {
m_preshared.reset(make_credentials());
assert(m_preshared);
m_preshared->unpack(cursor);
} else
m_preshared.reset(nullptr);
}
/// @} /// @}

View File

@ -97,3 +97,183 @@ void eap::config::unpack(_Inout_ const unsigned char *&cursor)
{ {
UNREFERENCED_PARAMETER(cursor); UNREFERENCED_PARAMETER(cursor);
} }
//////////////////////////////////////////////////////////////////////
// eap::config_method
//////////////////////////////////////////////////////////////////////
eap::config_method::config_method(_In_ module &mod) :
m_allow_save(true),
config(mod)
{
}
eap::config_method::config_method(_In_ const config_method &other) :
m_allow_save(other.m_allow_save),
m_anonymous_identity(other.m_anonymous_identity),
m_preshared(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr),
config(other)
{
}
eap::config_method::config_method(_Inout_ config_method &&other) :
m_allow_save(std::move(other.m_allow_save)),
m_anonymous_identity(std::move(other.m_anonymous_identity)),
m_preshared(std::move(other.m_preshared)),
config(std::move(other))
{
}
eap::config_method& eap::config_method::operator=(_In_ const config_method &other)
{
if (this != &other) {
(config&)*this = other;
m_allow_save = other.m_allow_save;
m_anonymous_identity = other.m_anonymous_identity;
m_preshared.reset(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr);
}
return *this;
}
eap::config_method& eap::config_method::operator=(_Inout_ config_method &&other)
{
if (this != &other) {
(config&&)*this = std::move(other);
m_allow_save = std::move(other.m_allow_save);
m_anonymous_identity = std::move(other.m_anonymous_identity);
m_preshared = std::move(other.m_preshared);
}
return *this;
}
bool eap::config_method::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const
{
assert(pDoc);
assert(pConfigRoot);
assert(ppEapError);
if (!config::save(pDoc, pConfigRoot, ppEapError))
return false;
const winstd::bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
DWORD dwResult;
// <ClientSideCredential>
winstd::com_obj<IXMLDOMElement> pXmlElClientSideCredential;
if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), winstd::bstr(L"ClientSideCredential"), bstrNamespace, &pXmlElClientSideCredential)) != ERROR_SUCCESS) {
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <ClientSideCredential> element."));
return false;
}
// <ClientSideCredential>/<allow-save>
if ((dwResult = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, winstd::bstr(L"allow-save"), bstrNamespace, m_allow_save)) != ERROR_SUCCESS) {
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <allow-save> element."));
return false;
}
// <ClientSideCredential>/<AnonymousIdentity>
if (!m_anonymous_identity.empty())
if ((dwResult = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, winstd::bstr(L"AnonymousIdentity"), bstrNamespace, winstd::bstr(m_anonymous_identity))) != ERROR_SUCCESS) {
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <AnonymousIdentity> element."));
return false;
}
if (m_preshared)
if (!m_preshared->save(pDoc, pXmlElClientSideCredential, ppEapError))
return false;
return true;
}
bool eap::config_method::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError)
{
assert(pConfigRoot);
assert(ppEapError);
if (!config::load(pConfigRoot, ppEapError))
return false;
m_allow_save = true;
m_preshared.reset(nullptr);
m_anonymous_identity.clear();
// <ClientSideCredential>
winstd::com_obj<IXMLDOMElement> pXmlElClientSideCredential;
if (eapxml::select_element(pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential) == ERROR_SUCCESS) {
std::wstring xpath(eapxml::get_xpath(pXmlElClientSideCredential));
// <allow-save>
eapxml::get_element_value(pXmlElClientSideCredential, winstd::bstr(L"eap-metadata:allow-save"), &m_allow_save);
m_module.log_config((xpath + L"/allow-save").c_str(), m_allow_save);
// <AnonymousIdentity>
eapxml::get_element_value(pXmlElClientSideCredential, winstd::bstr(L"eap-metadata:AnonymousIdentity"), m_anonymous_identity);
m_module.log_config((xpath + L"/AnonymousIdentity").c_str(), m_anonymous_identity.c_str());
std::unique_ptr<credentials> preshared(make_credentials());
assert(preshared);
if (preshared->load(pXmlElClientSideCredential, ppEapError)) {
m_preshared = std::move(preshared);
} else {
// This is not really an error - merely an indication pre-shared credentials are unavailable.
if (*ppEapError) {
m_module.free_error_memory(*ppEapError);
*ppEapError = NULL;
}
}
}
return true;
}
void eap::config_method::pack(_Inout_ unsigned char *&cursor) const
{
eap::config::pack(cursor);
eapserial::pack(cursor, m_allow_save );
eapserial::pack(cursor, m_anonymous_identity);
if (m_preshared) {
eapserial::pack(cursor, true);
m_preshared->pack(cursor);
} else
eapserial::pack(cursor, false);
}
size_t eap::config_method::get_pk_size() const
{
return
eap::config::get_pk_size() +
eapserial::get_pk_size(m_allow_save ) +
eapserial::get_pk_size(m_anonymous_identity) +
(m_preshared ?
eapserial::get_pk_size(true) +
m_preshared->get_pk_size() :
eapserial::get_pk_size(false));
}
void eap::config_method::unpack(_Inout_ const unsigned char *&cursor)
{
eap::config::unpack(cursor);
eapserial::unpack(cursor, m_allow_save );
eapserial::unpack(cursor, m_anonymous_identity);
bool use_preshared;
eapserial::unpack(cursor, use_preshared);
if (use_preshared) {
m_preshared.reset(make_credentials());
assert(m_preshared);
m_preshared->unpack(cursor);
} else
m_preshared.reset(nullptr);
}

View File

@ -52,7 +52,7 @@ template <class _Tprov, class _Tmeth, class _wxT> class wxEAPCredentialsConfigPa
/// ///
/// Base template for all credential entry panels /// Base template for all credential entry panels
/// ///
template <class _Tcred, class _Tbase> class wxEAPCredentialsPanelBase; template <class _Tbase> class wxEAPCredentialsPanelBase;
/// ///
/// Generic password credential entry panel /// Generic password credential entry panel
@ -447,7 +447,7 @@ protected:
wxEAPCredentialsDialog<_Tprov> dlg(m_prov, this); wxEAPCredentialsDialog<_Tprov> dlg(m_prov, this);
_wxT *panel = new _wxT(m_prov, (typename _Tmeth::credentials_type&)*m_cred, m_target.c_str(), &dlg, true); _wxT *panel = new _wxT(m_prov, *m_cred, m_target.c_str(), &dlg, true);
dlg.AddContents((wxPanel**)&panel, 1); dlg.AddContents((wxPanel**)&panel, 1);
dlg.ShowModal(); dlg.ShowModal();
@ -469,7 +469,7 @@ protected:
wxEAPCredentialsDialog<_Tprov> dlg(m_prov, this); wxEAPCredentialsDialog<_Tprov> dlg(m_prov, this);
_wxT *panel = new _wxT(m_prov, (typename _Tmeth::credentials_type&)*m_cred, _T(""), &dlg, true); _wxT *panel = new _wxT(m_prov, *m_cred, _T(""), &dlg, true);
dlg.AddContents((wxPanel**)&panel, 1); dlg.AddContents((wxPanel**)&panel, 1);
dlg.ShowModal(); dlg.ShowModal();
@ -489,7 +489,7 @@ private:
}; };
template <class _Tcred, class _Tbase> template <class _Tbase>
class wxEAPCredentialsPanelBase : public _Tbase class wxEAPCredentialsPanelBase : public _Tbase
{ {
public: public:
@ -501,7 +501,7 @@ public:
/// \param[in] parent Parent window /// \param[in] parent Parent window
/// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled. /// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled.
/// ///
wxEAPCredentialsPanelBase(_Tcred &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config = false) : wxEAPCredentialsPanelBase(eap::credentials &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config = false) :
m_cred(cred), m_cred(cred),
m_target(pszCredTarget), m_target(pszCredTarget),
_Tbase(parent) _Tbase(parent)
@ -560,13 +560,13 @@ protected:
/// \endcond /// \endcond
protected: protected:
_Tcred &m_cred; ///< Password credentials eap::credentials &m_cred; ///< Generic credentials
winstd::tstring m_target; ///< Credential Manager target winstd::tstring m_target; ///< Credential Manager target
}; };
template <class _Tprov> template <class _Tprov>
class wxPasswordCredentialsPanel : public wxEAPCredentialsPanelBase<eap::credentials_pass, wxEAPCredentialsPanelPassBase> class wxPasswordCredentialsPanel : public wxEAPCredentialsPanelBase<wxEAPCredentialsPanelPassBase>
{ {
public: public:
/// ///
@ -578,8 +578,9 @@ public:
/// \param[in] parent Parent window /// \param[in] parent Parent window
/// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled. /// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled.
/// ///
wxPasswordCredentialsPanel(_Tprov &prov, eap::credentials_pass &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config = false) : wxPasswordCredentialsPanel(_Tprov &prov, eap::credentials &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config = false) :
wxEAPCredentialsPanelBase<eap::credentials_pass, wxEAPCredentialsPanelPassBase>(cred, pszCredTarget, parent, is_config) m_cred((eap::credentials_pass&)cred),
wxEAPCredentialsPanelBase<wxEAPCredentialsPanelPassBase>(cred, pszCredTarget, parent, is_config)
{ {
// Load and set icon. // Load and set icon.
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE)) if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
@ -641,8 +642,9 @@ protected:
/// \endcond /// \endcond
protected: protected:
winstd::library m_shell32; ///< shell32.dll resource library reference eap::credentials_pass &m_cred; ///< Password credentials
wxIcon m_icon; ///< Panel icon winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
private: private:
static const wxStringCharType *s_dummy_password; static const wxStringCharType *s_dummy_password;

View File

@ -40,7 +40,7 @@ namespace eap
namespace eap namespace eap
{ {
class config_method_pap : public config_method<credentials_pap> class config_method_pap : public config_method
{ {
public: public:
/// ///

View File

@ -25,19 +25,19 @@
// eap::config_method_pap // eap::config_method_pap
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
eap::config_method_pap::config_method_pap(_In_ module &mod) : config_method<credentials_pap>(mod) eap::config_method_pap::config_method_pap(_In_ module &mod) : config_method(mod)
{ {
} }
eap::config_method_pap::config_method_pap(_In_ const config_method_pap &other) : eap::config_method_pap::config_method_pap(_In_ const config_method_pap &other) :
config_method<credentials_pap>(other) config_method(other)
{ {
} }
eap::config_method_pap::config_method_pap(_Inout_ config_method_pap &&other) : eap::config_method_pap::config_method_pap(_Inout_ config_method_pap &&other) :
config_method<credentials_pap>(std::move(other)) config_method(std::move(other))
{ {
} }
@ -45,7 +45,7 @@ eap::config_method_pap::config_method_pap(_Inout_ config_method_pap &&other) :
eap::config_method_pap& eap::config_method_pap::operator=(_In_ const config_method_pap &other) eap::config_method_pap& eap::config_method_pap::operator=(_In_ const config_method_pap &other)
{ {
if (this != &other) if (this != &other)
(config_method<credentials_pap>&)*this = other; (config_method&)*this = other;
return *this; return *this;
} }
@ -54,7 +54,7 @@ eap::config_method_pap& eap::config_method_pap::operator=(_In_ const config_meth
eap::config_method_pap& eap::config_method_pap::operator=(_Inout_ config_method_pap &&other) eap::config_method_pap& eap::config_method_pap::operator=(_Inout_ config_method_pap &&other)
{ {
if (this != &other) if (this != &other)
(config_method<credentials_pap>&&)*this = std::move(other); (config_method&&)*this = std::move(other);
return *this; return *this;
} }

View File

@ -54,7 +54,7 @@ namespace eap
namespace eap namespace eap
{ {
class config_method_tls : public config_method<credentials_tls> class config_method_tls : public config_method
{ {
public: public:
/// ///

View File

@ -66,7 +66,7 @@ tstring eap::get_cert_title(PCCERT_CONTEXT cert)
// eap::config_method_tls // eap::config_method_tls
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
eap::config_method_tls::config_method_tls(_In_ module &mod) : config_method<credentials_tls>(mod) eap::config_method_tls::config_method_tls(_In_ module &mod) : config_method(mod)
{ {
} }
@ -74,7 +74,7 @@ eap::config_method_tls::config_method_tls(_In_ module &mod) : config_method<cred
eap::config_method_tls::config_method_tls(_In_ const config_method_tls &other) : eap::config_method_tls::config_method_tls(_In_ const config_method_tls &other) :
m_trusted_root_ca(other.m_trusted_root_ca), m_trusted_root_ca(other.m_trusted_root_ca),
m_server_names(other.m_server_names), m_server_names(other.m_server_names),
config_method<credentials_tls>(other) config_method(other)
{ {
} }
@ -82,7 +82,7 @@ eap::config_method_tls::config_method_tls(_In_ const config_method_tls &other) :
eap::config_method_tls::config_method_tls(_Inout_ config_method_tls &&other) : eap::config_method_tls::config_method_tls(_Inout_ config_method_tls &&other) :
m_trusted_root_ca(std::move(other.m_trusted_root_ca)), m_trusted_root_ca(std::move(other.m_trusted_root_ca)),
m_server_names(std::move(other.m_server_names)), m_server_names(std::move(other.m_server_names)),
config_method<credentials_tls>(std::move(other)) config_method(std::move(other))
{ {
} }
@ -90,7 +90,7 @@ eap::config_method_tls::config_method_tls(_Inout_ config_method_tls &&other) :
eap::config_method_tls& eap::config_method_tls::operator=(_In_ const eap::config_method_tls &other) eap::config_method_tls& eap::config_method_tls::operator=(_In_ const eap::config_method_tls &other)
{ {
if (this != &other) { if (this != &other) {
(config_method<credentials_tls>&)*this = other; (config_method&)*this = other;
m_trusted_root_ca = other.m_trusted_root_ca; m_trusted_root_ca = other.m_trusted_root_ca;
m_server_names = other.m_server_names; m_server_names = other.m_server_names;
} }
@ -102,7 +102,7 @@ eap::config_method_tls& eap::config_method_tls::operator=(_In_ const eap::config
eap::config_method_tls& eap::config_method_tls::operator=(_Inout_ eap::config_method_tls &&other) eap::config_method_tls& eap::config_method_tls::operator=(_Inout_ eap::config_method_tls &&other)
{ {
if (this != &other) { if (this != &other) {
(config_method<credentials_tls>&&)*this = std::move(other); (config_method&&)*this = std::move(other);
m_trusted_root_ca = std::move(other.m_trusted_root_ca); m_trusted_root_ca = std::move(other.m_trusted_root_ca);
m_server_names = std::move(other.m_server_names); m_server_names = std::move(other.m_server_names);
} }
@ -123,7 +123,7 @@ bool eap::config_method_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *
assert(pConfigRoot); assert(pConfigRoot);
assert(ppEapError); assert(ppEapError);
if (!config_method<credentials_tls>::save(pDoc, pConfigRoot, ppEapError)) if (!config_method::save(pDoc, pConfigRoot, ppEapError))
return false; return false;
const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata"); const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
@ -182,7 +182,7 @@ bool eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR
{ {
assert(pConfigRoot); assert(pConfigRoot);
if (!config_method<credentials_tls>::load(pConfigRoot, ppEapError)) if (!config_method::load(pConfigRoot, ppEapError))
return false; return false;
std::wstring xpath(eapxml::get_xpath(pConfigRoot)); std::wstring xpath(eapxml::get_xpath(pConfigRoot));
@ -258,7 +258,7 @@ bool eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR
void eap::config_method_tls::pack(_Inout_ unsigned char *&cursor) const void eap::config_method_tls::pack(_Inout_ unsigned char *&cursor) const
{ {
eap::config_method<eap::credentials_tls>::pack(cursor); eap::config_method::pack(cursor);
eapserial::pack(cursor, m_trusted_root_ca); eapserial::pack(cursor, m_trusted_root_ca);
eapserial::pack(cursor, m_server_names ); eapserial::pack(cursor, m_server_names );
} }
@ -267,7 +267,7 @@ void eap::config_method_tls::pack(_Inout_ unsigned char *&cursor) const
size_t eap::config_method_tls::get_pk_size() const size_t eap::config_method_tls::get_pk_size() const
{ {
return return
eap::config_method<eap::credentials_tls>::get_pk_size() + eap::config_method::get_pk_size() +
eapserial::get_pk_size(m_trusted_root_ca) + eapserial::get_pk_size(m_trusted_root_ca) +
eapserial::get_pk_size(m_server_names ); eapserial::get_pk_size(m_server_names );
} }
@ -275,7 +275,7 @@ size_t eap::config_method_tls::get_pk_size() const
void eap::config_method_tls::unpack(_Inout_ const unsigned char *&cursor) void eap::config_method_tls::unpack(_Inout_ const unsigned char *&cursor)
{ {
eap::config_method<eap::credentials_tls>::unpack(cursor); eap::config_method::unpack(cursor);
eapserial::unpack(cursor, m_trusted_root_ca); eapserial::unpack(cursor, m_trusted_root_ca);
eapserial::unpack(cursor, m_server_names ); eapserial::unpack(cursor, m_server_names );
} }

View File

@ -249,14 +249,15 @@ protected:
template <class _Tprov> template <class _Tprov>
class wxTLSCredentialsPanel : public wxEAPCredentialsPanelBase<eap::credentials_tls, wxTLSCredentialsPanelBase> class wxTLSCredentialsPanel : public wxEAPCredentialsPanelBase<wxTLSCredentialsPanelBase>
{ {
public: public:
/// ///
/// Constructs a configuration panel /// Constructs a configuration panel
/// ///
wxTLSCredentialsPanel(_Tprov &prov, eap::credentials_tls &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config = false) : wxTLSCredentialsPanel(_Tprov &prov, eap::credentials &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config = false) :
wxEAPCredentialsPanelBase<eap::credentials_tls, wxTLSCredentialsPanelBase>(cred, pszCredTarget, parent, is_config) m_cred((eap::credentials_tls&)cred),
wxEAPCredentialsPanelBase<wxTLSCredentialsPanelBase>(cred, pszCredTarget, parent, is_config)
{ {
UNREFERENCED_PARAMETER(prov); UNREFERENCED_PARAMETER(prov);
@ -339,8 +340,9 @@ protected:
/// \endcond /// \endcond
protected: protected:
winstd::library m_shell32; ///< shell32.dll resource library reference eap::credentials_tls &m_cred; ///< TLS credentials
wxIcon m_icon; ///< Panel icon winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
}; };

View File

@ -261,13 +261,13 @@ protected:
/// \endcond /// \endcond
protected: protected:
_Tprov &m_prov; ///< EAP provider _Tprov &m_prov; ///< EAP provider
eap::config_method_ttls &m_cfg; ///< TTLS configuration eap::config_method_ttls &m_cfg; ///< TTLS configuration
wxStaticText *m_outer_title; ///< Outer authentication title wxStaticText *m_outer_title; ///< Outer authentication title
wxTTLSConfigPanel<_Tprov> *m_outer_identity; ///< Outer identity configuration panel wxTTLSConfigPanel<_Tprov> *m_outer_identity; ///< Outer identity configuration panel
wxTLSConfigPanel<_Tprov> *m_tls; ///< TLS configuration panel wxTLSConfigPanel<_Tprov> *m_tls; ///< TLS configuration panel
wxStaticText *m_inner_title; ///< Inner authentication title wxStaticText *m_inner_title; ///< Inner authentication title
wxChoicebook *m_inner_type; ///< Inner authentication type wxChoicebook *m_inner_type; ///< Inner authentication type
eap::config_method_pap m_cfg_pap; ///< Temporary PAP configuration eap::config_method_pap m_cfg_pap; ///< Temporary PAP configuration
}; };