diff --git a/lib/TTLS/include/Method.h b/lib/TTLS/include/Method.h index 66fb974..db362ee 100644 --- a/lib/TTLS/include/Method.h +++ b/lib/TTLS/include/Method.h @@ -141,9 +141,6 @@ namespace eap virtual void process_application_data(_In_bytecount_(size_msg) const void *msg, _In_ size_t size_msg); protected: - config_method_ttls &m_cfg; ///< EAP-TTLS method configuration - credentials_ttls &m_cred; ///< EAP-TTLS credentials - #pragma warning(suppress: 4480) enum version_t :unsigned char { version_0 = 0, ///< EAP-TTLS v0 diff --git a/lib/TTLS/src/Method.cpp b/lib/TTLS/src/Method.cpp index 437b9fa..1bb4806 100644 --- a/lib/TTLS/src/Method.cpp +++ b/lib/TTLS/src/Method.cpp @@ -29,8 +29,6 @@ using namespace winstd; ////////////////////////////////////////////////////////////////////// eap::method_ttls::method_ttls(_In_ module &module, _In_ config_method_ttls &cfg, _In_ credentials_ttls &cred) : - m_cfg(cfg), - m_cred(cred), m_version(version_0), method_tls(module, cfg, cred) { @@ -38,8 +36,6 @@ eap::method_ttls::method_ttls(_In_ module &module, _In_ config_method_ttls &cfg, eap::method_ttls::method_ttls(_Inout_ method_ttls &&other) : - m_cfg ( other.m_cfg ), - m_cred ( other.m_cred ), m_version (std::move(other.m_version)), m_inner (std::move(other.m_inner )), method_tls(std::move(other )) @@ -68,9 +64,9 @@ void eap::method_ttls::begin_session( method_tls::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize); // Initialize inner method. - switch (m_cfg.m_inner->get_method_id()) { - case eap_type_legacy_pap : m_inner.reset(new method_pap (m_module, (config_method_pap &)*m_cfg.m_inner, (credentials_pass &)*m_cred.m_inner.get())); break; - case eap_type_legacy_mschapv2: m_inner.reset(new method_mschapv2(m_module, (config_method_mschapv2&)*m_cfg.m_inner, (credentials_pass&)*m_cred.m_inner.get())); break; + switch (dynamic_cast(m_cfg).m_inner->get_method_id()) { + case eap_type_legacy_pap : m_inner.reset(new method_pap (m_module, (config_method_pap &)*dynamic_cast(m_cfg).m_inner, (credentials_pass&)*dynamic_cast(m_cred).m_inner.get())); break; + case eap_type_legacy_mschapv2: m_inner.reset(new method_mschapv2(m_module, (config_method_mschapv2&)*dynamic_cast(m_cfg).m_inner, (credentials_pass&)*dynamic_cast(m_cred).m_inner.get())); break; default: throw invalid_argument(__FUNCTION__ " Unsupported inner authentication method."); } m_inner->begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, MAXDWORD); diff --git a/lib/TTLS_UI/include/TTLS_UI.h b/lib/TTLS_UI/include/TTLS_UI.h index 0007799..3f19337 100644 --- a/lib/TTLS_UI/include/TTLS_UI.h +++ b/lib/TTLS_UI/include/TTLS_UI.h @@ -135,7 +135,6 @@ protected: /// \endcond protected: - eap::config_method_ttls &m_cfg; ///< TTLS configuration wxStaticText *m_outer_title; ///< Outer authentication title wxTTLSConfigPanel *m_outer_identity; ///< Outer identity configuration panel wxTLSConfigPanel *m_tls; ///< TLS configuration panel diff --git a/lib/TTLS_UI/src/TTLS_UI.cpp b/lib/TTLS_UI/src/TTLS_UI.cpp index c2bcfd1..42d9230 100644 --- a/lib/TTLS_UI/src/TTLS_UI.cpp +++ b/lib/TTLS_UI/src/TTLS_UI.cpp @@ -169,7 +169,6 @@ void wxTTLSConfigPanel::OnUpdateUI(wxUpdateUIEvent& event) ////////////////////////////////////////////////////////////////////// wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_method &cfg, wxWindow* parent) : - m_cfg((eap::config_method_ttls&)cfg), m_cfg_pap(cfg.m_module, cfg.m_level + 1), m_cfg_mschapv2(cfg.m_module, cfg.m_level + 1), wxEAPConfigWindow(prov, cfg, parent) @@ -200,10 +199,10 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_m m_outer_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) ); sb_content->Add(m_outer_title, 0, wxALL|wxALIGN_RIGHT, 5); - m_outer_identity = new wxTTLSConfigPanel(m_prov, m_cfg, this); + m_outer_identity = new wxTTLSConfigPanel(m_prov, dynamic_cast(m_cfg), this); sb_content->Add(m_outer_identity, 0, wxALL|wxEXPAND, 5); - m_tls = new wxTLSConfigPanel(m_prov, m_cfg, this); + m_tls = new wxTLSConfigPanel(m_prov, dynamic_cast(m_cfg), this); sb_content->Add(m_tls, 0, wxALL|wxEXPAND, 5); wxSize size = sb_content->CalcMin(); @@ -232,14 +231,14 @@ wxTTLSConfigWindow::~wxTTLSConfigWindow() bool wxTTLSConfigWindow::TransferDataToWindow() { - switch (m_cfg.m_inner->get_method_id()) { + switch (((eap::config_method_ttls&)m_cfg).m_inner->get_method_id()) { case winstd::eap_type_legacy_pap: - m_cfg_pap = *(eap::config_method_pap*)m_cfg.m_inner.get(); + m_cfg_pap = *(eap::config_method_pap*)((eap::config_method_ttls&)m_cfg).m_inner.get(); m_inner_type->SetSelection(0); // 0=PAP break; case winstd::eap_type_legacy_mschapv2: - m_cfg_mschapv2 = *(eap::config_method_mschapv2*)m_cfg.m_inner.get(); + m_cfg_mschapv2 = *(eap::config_method_mschapv2*)((eap::config_method_ttls&)m_cfg).m_inner.get(); m_inner_type->SetSelection(1); // 1=MSCHAPv2 break; @@ -261,11 +260,11 @@ bool wxTTLSConfigWindow::TransferDataFromWindow() // This is not a provider-locked configuration. Save the data. switch (m_inner_type->GetSelection()) { case 0: // 0=PAP - m_cfg.m_inner.reset(new eap::config_method_pap(m_cfg_pap)); + ((eap::config_method_ttls&)m_cfg).m_inner.reset(new eap::config_method_pap(m_cfg_pap)); break; case 1: // 1=MSCHAPv2 - m_cfg.m_inner.reset(new eap::config_method_mschapv2(m_cfg_mschapv2)); + ((eap::config_method_ttls&)m_cfg).m_inner.reset(new eap::config_method_mschapv2(m_cfg_mschapv2)); break; default: