From fc0bf839c2ded99cede7580f29d41cdbdd7925e6 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 2 Feb 2017 13:51:17 +0100 Subject: [PATCH] EAP_INNER_EAPHOST is now 0/1 #defined --- lib/TTLS/build/TTLS.vcxproj | 1 + lib/TTLS/build/TTLS.vcxproj.filters | 3 +++ lib/TTLS/include/Config.h | 1 + lib/TTLS/include/Credentials.h | 2 ++ lib/TTLS/include/Method.h | 1 + lib/TTLS/include/Module.h | 1 + lib/TTLS/include/TTLS.h | 31 +++++++++++++++++++++++++++++ lib/TTLS/src/Config.cpp | 4 ++-- lib/TTLS/src/Module.cpp | 8 ++++---- lib/TTLS/src/StdAfx.h | 2 ++ lib/TTLS_UI/include/TTLS_UI.h | 2 +- lib/TTLS_UI/src/Module.cpp | 4 ++-- lib/TTLS_UI/src/TTLS_UI.cpp | 10 +++++----- 13 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 lib/TTLS/include/TTLS.h diff --git a/lib/TTLS/build/TTLS.vcxproj b/lib/TTLS/build/TTLS.vcxproj index 0f5716f..8539920 100644 --- a/lib/TTLS/build/TTLS.vcxproj +++ b/lib/TTLS/build/TTLS.vcxproj @@ -83,6 +83,7 @@ + diff --git a/lib/TTLS/build/TTLS.vcxproj.filters b/lib/TTLS/build/TTLS.vcxproj.filters index 5cd912e..1aa920b 100644 --- a/lib/TTLS/build/TTLS.vcxproj.filters +++ b/lib/TTLS/build/TTLS.vcxproj.filters @@ -26,6 +26,9 @@ Header Files + + Header Files + diff --git a/lib/TTLS/include/Config.h b/lib/TTLS/include/Config.h index c8dead4..b2aca7a 100644 --- a/lib/TTLS/include/Config.h +++ b/lib/TTLS/include/Config.h @@ -28,6 +28,7 @@ namespace eap #pragma once #include "Credentials.h" +#include "TTLS.h" #include "../../TLS/include/Config.h" diff --git a/lib/TTLS/include/Credentials.h b/lib/TTLS/include/Credentials.h index 7b6e0ef..2cdb184 100644 --- a/lib/TTLS/include/Credentials.h +++ b/lib/TTLS/include/Credentials.h @@ -25,6 +25,8 @@ namespace eap #pragma once +#include "TTLS.h" + #include "../../TLS/include/Credentials.h" #include diff --git a/lib/TTLS/include/Method.h b/lib/TTLS/include/Method.h index c68cb87..a309c6a 100644 --- a/lib/TTLS/include/Method.h +++ b/lib/TTLS/include/Method.h @@ -29,6 +29,7 @@ namespace eap #include "Config.h" #include "Credentials.h" +#include "TTLS.h" #include "../../EAPBase/include/Method.h" diff --git a/lib/TTLS/include/Module.h b/lib/TTLS/include/Module.h index fd9226f..626de04 100644 --- a/lib/TTLS/include/Module.h +++ b/lib/TTLS/include/Module.h @@ -28,6 +28,7 @@ namespace eap #include "Config.h" #include "Credentials.h" #include "Method.h" +#include "TTLS.h" namespace eap diff --git a/lib/TTLS/include/TTLS.h b/lib/TTLS/include/TTLS.h new file mode 100644 index 0000000..5417b31 --- /dev/null +++ b/lib/TTLS/include/TTLS.h @@ -0,0 +1,31 @@ +/* + Copyright 2015-2017 Amebis + Copyright 2016-2017 GÉANT + + This file is part of GÉANTLink. + + GÉANTLink is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GÉANTLink is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GÉANTLink. If not, see . +*/ + +#pragma once + +/// \addtogroup EAPBaseMethod +/// @{ +#ifndef EAP_INNER_EAPHOST +/// +/// EapHost inner method support +/// +#define EAP_INNER_EAPHOST 0 +#endif +/// @} diff --git a/lib/TTLS/src/Config.cpp b/lib/TTLS/src/Config.cpp index 7ce24f6..bdcaf4a 100644 --- a/lib/TTLS/src/Config.cpp +++ b/lib/TTLS/src/Config.cpp @@ -268,7 +268,7 @@ eap::config_method* eap::config_method_ttls::make_config_method(_In_ winstd::eap case eap_type_legacy_pap : return new config_method_pap (m_module, m_level + 1); case eap_type_legacy_mschapv2: return new config_method_mschapv2 (m_module, m_level + 1); case eap_type_mschapv2 : return new config_method_eapmschapv2(m_module, m_level + 1); -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST default : return new config_method_eaphost (m_module, m_level + 1); // EapHost peer method handles all other method types #else default : throw invalid_argument(string_printf(__FUNCTION__ " Unsupported inner authentication method (%d).", eap_type)); @@ -282,7 +282,7 @@ eap::config_method* eap::config_method_ttls::make_config_method(_In_ const wchar if (_wcsicmp(eap_type, L"PAP" ) == 0) return new config_method_pap (m_module, m_level + 1); else if (_wcsicmp(eap_type, L"MSCHAPv2" ) == 0) return new config_method_mschapv2 (m_module, m_level + 1); else if (_wcsicmp(eap_type, L"EAP-MSCHAPv2") == 0) return new config_method_eapmschapv2(m_module, m_level + 1); -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST else if (_wcsicmp(eap_type, L"EapHost" ) == 0) return new config_method_eaphost (m_module, m_level + 1); #endif else throw invalid_argument(string_printf(__FUNCTION__ " Unsupported inner authentication method (%ls).", eap_type)); diff --git a/lib/TTLS/src/Module.cpp b/lib/TTLS/src/Module.cpp index acabdd4..e803d88 100644 --- a/lib/TTLS/src/Module.cpp +++ b/lib/TTLS/src/Module.cpp @@ -53,7 +53,7 @@ void eap::peer_ttls::initialize() MsiUseFeature(_T(PRODUCT_VERSION_GUID), _T("featEAPTTLS")); #endif -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST // Initialize EapHost based inner authentication methods. DWORD dwResult = EapHostPeerInitialize(); if (dwResult != ERROR_SUCCESS) @@ -73,7 +73,7 @@ void eap::peer_ttls::shutdown() } WaitForMultipleObjects((DWORD)chks.size(), chks.data(), TRUE, 10000); -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST // Uninitialize EapHost. It was initialized for EapHost based inner authentication methods. EapHostPeerUninitialize(); #endif @@ -243,7 +243,7 @@ EAP_SESSION_HANDLE eap::peer_ttls::begin_session( unique_ptr meth_inner; auto cfg_inner = cfg_method->m_inner.get(); auto cred_inner = dynamic_cast(s->m_cred.m_cred.get())->m_inner.get(); -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST auto cfg_inner_eaphost = dynamic_cast(cfg_inner); if (!cfg_inner_eaphost) #endif @@ -259,7 +259,7 @@ EAP_SESSION_HANDLE eap::peer_ttls::begin_session( default: throw invalid_argument(__FUNCTION__ " Unsupported inner authentication method."); } } -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST else { // EapHost inner method meth_inner.reset( diff --git a/lib/TTLS/src/StdAfx.h b/lib/TTLS/src/StdAfx.h index a58249a..7b14335 100644 --- a/lib/TTLS/src/StdAfx.h +++ b/lib/TTLS/src/StdAfx.h @@ -20,6 +20,8 @@ #pragma once +#include "../include/TTLS.h" + #include "../include/Config.h" #include "../include/Credentials.h" #include "../include/Method.h" diff --git a/lib/TTLS_UI/include/TTLS_UI.h b/lib/TTLS_UI/include/TTLS_UI.h index 5a90e1d..2735e21 100644 --- a/lib/TTLS_UI/include/TTLS_UI.h +++ b/lib/TTLS_UI/include/TTLS_UI.h @@ -107,7 +107,7 @@ protected: eap::config_method_pap m_cfg_pap; ///< PAP configuration eap::config_method_mschapv2 m_cfg_mschapv2; ///< MSCHAPv2 configuration eap::config_method_eapmschapv2 m_cfg_eapmschapv2; ///< EAP-MSCHAPv2 configuration -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST eap::config_method_eaphost m_cfg_eaphost; ///< Inner EAP configuration #endif }; diff --git a/lib/TTLS_UI/src/Module.cpp b/lib/TTLS_UI/src/Module.cpp index d881263..724cccb 100644 --- a/lib/TTLS_UI/src/Module.cpp +++ b/lib/TTLS_UI/src/Module.cpp @@ -284,7 +284,7 @@ void eap::peer_ttls_ui::invoke_identity_ui( src_inner != eap::credentials::source_config && eap::config_method::status_cred_begin <= cfg_method->m_inner->m_last_status && cfg_method->m_inner->m_last_status < eap::config_method::status_cred_end) { // Prompt for inner credentials. -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST auto cfg_inner_eaphost = dynamic_cast(cfg_method->m_inner.get()); if (!cfg_inner_eaphost) #endif @@ -322,7 +322,7 @@ void eap::peer_ttls_ui::invoke_identity_ui( } } } -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST else { // EapHost inner method auto cred_inner = dynamic_cast(cred->m_inner.get()); diff --git a/lib/TTLS_UI/src/TTLS_UI.cpp b/lib/TTLS_UI/src/TTLS_UI.cpp index b44cec2..f308989 100644 --- a/lib/TTLS_UI/src/TTLS_UI.cpp +++ b/lib/TTLS_UI/src/TTLS_UI.cpp @@ -103,7 +103,7 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_m m_cfg_pap (cfg.m_module, cfg.m_level + 1), m_cfg_mschapv2 (cfg.m_module, cfg.m_level + 1), m_cfg_eapmschapv2(cfg.m_module, cfg.m_level + 1), -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST m_cfg_eaphost (cfg.m_module, cfg.m_level + 1), #endif wxEAPConfigWindow(prov, cfg, parent) @@ -127,7 +127,7 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_m m_inner_type->AddPage(panel_mschapv2, _("MSCHAPv2")); wxMSCHAPv2ConfigPanel *panel_eapmschapv2 = new wxMSCHAPv2ConfigPanel(m_prov, m_cfg_eapmschapv2, m_inner_type); m_inner_type->AddPage(panel_eapmschapv2, _("EAP-MSCHAPv2")); -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST wxEapHostConfigPanel *panel_eaphost = new wxEapHostConfigPanel(m_prov, m_cfg_eaphost, m_inner_type); m_inner_type->AddPage(panel_eaphost, _("Other EAP methods...")); #endif @@ -176,7 +176,7 @@ bool wxTTLSConfigWindow::TransferDataToWindow() { auto &cfg_ttls = dynamic_cast(m_cfg); -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST auto cfg_inner_eaphost = dynamic_cast(cfg_ttls.m_inner.get()); if (!cfg_inner_eaphost) #endif @@ -202,7 +202,7 @@ bool wxTTLSConfigWindow::TransferDataToWindow() wxFAIL_MSG(wxT("Unsupported inner authentication method type.")); } } -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST else { // EapHost inner method m_cfg_eaphost = *cfg_inner_eaphost; @@ -237,7 +237,7 @@ bool wxTTLSConfigWindow::TransferDataFromWindow() cfg_ttls.m_inner.reset(new eap::config_method_eapmschapv2(m_cfg_eapmschapv2)); break; -#ifdef EAP_INNER_EAPHOST +#if EAP_INNER_EAPHOST case 3: // 3=EapHost cfg_ttls.m_inner.reset(new eap::config_method_eaphost(m_cfg_eaphost)); break;