ID 1. Variables shadowing from security audit report fixed

This commit is contained in:
Simon Rozman 2016-10-03 09:35:14 +02:00
parent c1a483a0bd
commit 7924612419
4 changed files with 10 additions and 19 deletions

View File

@ -141,9 +141,6 @@ namespace eap
virtual void process_application_data(_In_bytecount_(size_msg) const void *msg, _In_ size_t size_msg); virtual void process_application_data(_In_bytecount_(size_msg) const void *msg, _In_ size_t size_msg);
protected: protected:
config_method_ttls &m_cfg; ///< EAP-TTLS method configuration
credentials_ttls &m_cred; ///< EAP-TTLS credentials
#pragma warning(suppress: 4480) #pragma warning(suppress: 4480)
enum version_t :unsigned char { enum version_t :unsigned char {
version_0 = 0, ///< EAP-TTLS v0 version_0 = 0, ///< EAP-TTLS v0

View File

@ -29,8 +29,6 @@ using namespace winstd;
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
eap::method_ttls::method_ttls(_In_ module &module, _In_ config_method_ttls &cfg, _In_ credentials_ttls &cred) : 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), m_version(version_0),
method_tls(module, cfg, cred) 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) : 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_version (std::move(other.m_version)),
m_inner (std::move(other.m_inner )), m_inner (std::move(other.m_inner )),
method_tls(std::move(other )) method_tls(std::move(other ))
@ -68,9 +64,9 @@ void eap::method_ttls::begin_session(
method_tls::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize); method_tls::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
// Initialize inner method. // Initialize inner method.
switch (m_cfg.m_inner->get_method_id()) { switch (dynamic_cast<config_method_ttls&>(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_pap : m_inner.reset(new method_pap (m_module, (config_method_pap &)*dynamic_cast<config_method_ttls&>(m_cfg).m_inner, (credentials_pass&)*dynamic_cast<credentials_ttls&>(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; case eap_type_legacy_mschapv2: m_inner.reset(new method_mschapv2(m_module, (config_method_mschapv2&)*dynamic_cast<config_method_ttls&>(m_cfg).m_inner, (credentials_pass&)*dynamic_cast<credentials_ttls&>(m_cred).m_inner.get())); break;
default: throw invalid_argument(__FUNCTION__ " Unsupported inner authentication method."); default: throw invalid_argument(__FUNCTION__ " Unsupported inner authentication method.");
} }
m_inner->begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, MAXDWORD); m_inner->begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, MAXDWORD);

View File

@ -136,7 +136,6 @@ protected:
/// \endcond /// \endcond
protected: protected:
eap::config_method_ttls &m_cfg; ///< TTLS configuration
wxStaticText *m_outer_title; ///< Outer authentication title wxStaticText *m_outer_title; ///< Outer authentication title
wxTTLSConfigPanel *m_outer_identity; ///< Outer identity configuration panel wxTTLSConfigPanel *m_outer_identity; ///< Outer identity configuration panel
wxTLSConfigPanel *m_tls; ///< TLS configuration panel wxTLSConfigPanel *m_tls; ///< TLS configuration panel

View File

@ -169,7 +169,6 @@ void wxTTLSConfigPanel::OnUpdateUI(wxUpdateUIEvent& event)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_method &cfg, wxWindow* parent) : 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_pap(cfg.m_module, cfg.m_level + 1),
m_cfg_mschapv2(cfg.m_module, cfg.m_level + 1), m_cfg_mschapv2(cfg.m_module, cfg.m_level + 1),
m_cfg_eapmsg(cfg.m_module, cfg.m_level + 1), m_cfg_eapmsg(cfg.m_module, cfg.m_level + 1),
@ -203,10 +202,10 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_m
m_outer_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) ); m_outer_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) );
sb_content->Add(m_outer_title, 0, wxALL|wxALIGN_RIGHT, 5); 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<eap::config_method_ttls&>(m_cfg), this);
sb_content->Add(m_outer_identity, 0, wxALL|wxEXPAND, 5); 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<eap::config_method_tls&>(m_cfg), this);
sb_content->Add(m_tls, 0, wxALL|wxEXPAND, 5); sb_content->Add(m_tls, 0, wxALL|wxEXPAND, 5);
wxSize size = sb_content->CalcMin(); wxSize size = sb_content->CalcMin();
@ -235,14 +234,14 @@ wxTTLSConfigWindow::~wxTTLSConfigWindow()
bool wxTTLSConfigWindow::TransferDataToWindow() 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: 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 m_inner_type->SetSelection(0); // 0=PAP
break; break;
case winstd::eap_type_legacy_mschapv2: 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 m_inner_type->SetSelection(1); // 1=MSCHAPv2
break; break;
@ -264,11 +263,11 @@ bool wxTTLSConfigWindow::TransferDataFromWindow()
// This is not a provider-locked configuration. Save the data. // This is not a provider-locked configuration. Save the data.
switch (m_inner_type->GetSelection()) { switch (m_inner_type->GetSelection()) {
case 0: // 0=PAP 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; break;
case 1: // 1=MSCHAPv2 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; break;
default: default: