EAP_INNER_EAPHOST is now 0/1 #defined

This commit is contained in:
Simon Rozman 2017-02-02 13:45:45 +01:00
parent 6f049d2692
commit 5b79f5d849
14 changed files with 58 additions and 16 deletions

View File

@ -83,6 +83,7 @@
<ClInclude Include="..\include\Credentials.h" />
<ClInclude Include="..\include\Method.h" />
<ClInclude Include="..\include\Module.h" />
<ClInclude Include="..\include\TTLS.h" />
<ClInclude Include="..\include\UIContext.h" />
<ClInclude Include="..\src\StdAfx.h" />
</ItemGroup>

View File

@ -29,6 +29,9 @@
<ClInclude Include="..\include\UIContext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\TTLS.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\StdAfx.cpp">

View File

@ -28,6 +28,7 @@ namespace eap
#pragma once
#include "Credentials.h"
#include "TTLS.h"
#include "../../TLS/include/Config.h"

View File

@ -25,6 +25,8 @@ namespace eap
#pragma once
#include "TTLS.h"
#include "../../TLS/include/Credentials.h"
#include <memory>

View File

@ -29,6 +29,7 @@ namespace eap
#include "Config.h"
#include "Credentials.h"
#include "TTLS.h"
#include "../../EAPBase/include/Method.h"

View File

@ -28,6 +28,7 @@ namespace eap
#include "Config.h"
#include "Credentials.h"
#include "Method.h"
#include "TTLS.h"
namespace eap

29
lib/TTLS/include/TTLS.h Normal file
View File

@ -0,0 +1,29 @@
/*
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 <http://www.gnu.org/licenses/>.
*/
/// \addtogroup EAPBaseMethod
/// @{
#ifndef EAP_INNER_EAPHOST
///
/// EapHost inner method support
///
#define EAP_INNER_EAPHOST 0
#endif
/// @}

View File

@ -25,6 +25,8 @@ namespace eap
#pragma once
#include "TTLS.h"
#include "../../EAPBase/include/UIContext.h"

View File

@ -269,7 +269,7 @@ eap::config_method* eap::config_method_ttls::make_config_method(_In_ winstd::eap
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);
case eap_type_gtc : return new config_method_eapgtc (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));
@ -284,7 +284,7 @@ eap::config_method* eap::config_method_ttls::make_config_method(_In_ const wchar
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);
else if (_wcsicmp(eap_type, L"EAP-GTC" ) == 0) return new config_method_eapgtc (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));

View File

@ -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<method> meth_inner;
auto cfg_inner = cfg_method->m_inner.get();
auto cred_inner = dynamic_cast<credentials_ttls*>(s->m_cred.m_cred.get())->m_inner.get();
#ifdef EAP_INNER_EAPHOST
#if EAP_INNER_EAPHOST
auto cfg_inner_eaphost = dynamic_cast<config_method_eaphost*>(cfg_inner);
if (!cfg_inner_eaphost)
#endif
@ -263,7 +263,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(

View File

@ -20,6 +20,8 @@
#pragma once
#include "../include/TTLS.h"
#include "../include/Config.h"
#include "../include/Credentials.h"
#include "../include/Method.h"

View File

@ -109,7 +109,7 @@ protected:
eap::config_method_mschapv2 m_cfg_mschapv2; ///< MSCHAPv2 configuration
eap::config_method_eapmschapv2 m_cfg_eapmschapv2; ///< EAP-MSCHAPv2 configuration
eap::config_method_eapgtc m_cfg_eapgtc; ///< EAP-GTC configuration
#ifdef EAP_INNER_EAPHOST
#if EAP_INNER_EAPHOST
eap::config_method_eaphost m_cfg_eaphost; ///< Inner EAP configuration
#endif
};

View File

@ -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<config_method_eaphost*>(cfg_method->m_inner.get());
if (!cfg_inner_eaphost)
#endif
@ -323,7 +323,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<eap::credentials_eaphost*>(cred->m_inner.get());
@ -413,7 +413,7 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", cred.get_id().c_str()));
}
#ifdef EAP_INNER_EAPHOST
#if EAP_INNER_EAPHOST
auto cfg_inner_eaphost = dynamic_cast<config_method_eaphost*>(cfg_method->m_inner.get());
if (!cfg_inner_eaphost)
#endif
@ -462,7 +462,7 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
if (result != wxID_OK)
throw win_runtime_error(ERROR_CANCELLED, __FUNCTION__ " Cancelled.");
}
#ifdef EAP_INNER_EAPHOST
#if EAP_INNER_EAPHOST
else {
// EapHost inner method
DWORD dwSizeofDataFromInteractiveUI;

View File

@ -104,7 +104,7 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_m
m_cfg_mschapv2 (cfg.m_module, cfg.m_level + 1),
m_cfg_eapmschapv2(cfg.m_module, cfg.m_level + 1),
m_cfg_eapgtc (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)
@ -130,7 +130,7 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_m
m_inner_type->AddPage(panel_eapmschapv2, _("EAP-MSCHAPv2"));
wxGTCConfigPanel *panel_eapgtc = new wxGTCConfigPanel(m_prov, m_cfg_eapgtc, m_inner_type);
m_inner_type->AddPage(panel_eapgtc, _("EAP-GTC"));
#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
@ -179,7 +179,7 @@ bool wxTTLSConfigWindow::TransferDataToWindow()
{
auto &cfg_ttls = dynamic_cast<eap::config_method_ttls&>(m_cfg);
#ifdef EAP_INNER_EAPHOST
#if EAP_INNER_EAPHOST
auto cfg_inner_eaphost = dynamic_cast<eap::config_method_eaphost*>(cfg_ttls.m_inner.get());
if (!cfg_inner_eaphost)
#endif
@ -210,7 +210,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;
@ -249,7 +249,7 @@ bool wxTTLSConfigWindow::TransferDataFromWindow()
cfg_ttls.m_inner.reset(new eap::config_method_eapgtc(m_cfg_eapgtc));
break;
#ifdef EAP_INNER_EAPHOST
#if EAP_INNER_EAPHOST
case 4: // 4=EapHost
cfg_ttls.m_inner.reset(new eap::config_method_eaphost(m_cfg_eaphost));
break;