Compare commits

...

34 Commits

Author SHA1 Message Date
5d5e14b724 Version set to 1.2a 2017-05-22 09:31:00 +02:00
1d583c39c9 daea1bba62 reverted 2017-05-22 09:14:09 +02:00
9926cd19ee WMI\Autologger records not installed any more, since they caused feature completeness check trouble: MsiUseFeature() reports feature broken, when it is denied access to any component folder or registry key 2017-05-22 09:13:40 +02:00
daea1bba62 MsiUseFeature() returning INSTALLSTATE_BROKEN is tolerated in non-elevated process now 2017-05-22 08:38:39 +02:00
f05f8dab76 Version set to 1.2 2017-05-17 13:10:54 +02:00
ba11abff1d WLANManager.exe now deployed as WLANManager-Win32.exe and WLANManager-x64.exe 2017-05-17 13:09:26 +02:00
22f578b451 Documentation update 2017-05-17 12:53:10 +02:00
7bc76ac54c Supported OS list update 2017-05-17 12:28:14 +02:00
5e35c5769a Documentation update 2017-05-17 12:25:39 +02:00
3f888dd781 Secondary error message pop-up removed 2017-05-17 10:26:41 +02:00
5b065bce3d Update README.md 2017-05-16 13:34:06 +02:00
d8a1fe95aa Sub-module update 2017-05-16 13:31:39 +02:00
f57ee6c0f8 Documentation update 2017-05-16 13:31:24 +02:00
3364719ba1 WLANManager support for multiple wireless interfaces 2017-05-16 13:11:10 +02:00
e46739a510 Indentation fix 2017-03-14 09:36:48 +01:00
adc860fa6e Version set to 1.2-beta2 2017-02-24 11:09:27 +01:00
d4cc3053a6 Clean-up 2017-02-23 12:09:00 +01:00
38c6189d5f AuthMode setting correctly logged now 2017-02-23 11:18:23 +01:00
bf4c4d846e Incorrect CoCreateInstance() result evaluation fixed 2017-02-23 11:05:13 +01:00
5040ebba8e Pop-up window single flash replaced with periodic flashing 2017-02-22 11:48:39 +01:00
4598528765 Debugging-related exception in WlanUIEditProfile() resolved 2017-02-22 11:11:57 +01:00
8fbcf27f6a Locale is dynamic now, since wxLocale does not support re-initialization (when module is reused) 2017-02-22 09:42:18 +01:00
48d46617d2 Pop-ups are no longer children of the GetForegroundWindow() when no parent window is specified. Instead, they are displayed as a standalone app. 2017-02-21 15:13:20 +01:00
e7d5ecb50b Documentation update 2017-02-21 12:01:54 +01:00
6a77f3f7b3 New version of wxExtend 2017-02-20 10:57:53 +01:00
a4673f9fb9 Compilation of debug MSI files fixed 2017-02-20 10:05:03 +01:00
c84a8b5a70 Documentation update 2017-02-13 08:00:07 +01:00
31a3b67cba 64-bit language detection removed from 32-bit MSI resolving ICE80 warning 2017-02-09 13:40:43 +01:00
b44cb66b2a Version set to 1.2-beta1 2017-02-09 13:20:33 +01:00
690a6d54d2 EAP-GTC authentication now split into two modes: Challenge/Response and Password 2017-02-09 13:18:46 +01:00
e7e57abf52 Uninitialized enum higher bytes when reading as unsigned char fixed 2017-02-09 11:38:57 +01:00
bda31a487f Revert "EAP-GTC method renamed to "EAP-GTC (Token Generator)""
This reverts commit 2908bc31a3.
2017-02-09 09:33:39 +01:00
2908bc31a3 EAP-GTC method renamed to "EAP-GTC (Token Generator)" 2017-02-09 08:06:32 +01:00
66dd2bf283 eap::config split to eap::config and eap::packable 2017-02-07 09:33:29 +01:00
39 changed files with 1095 additions and 455 deletions

Binary file not shown.

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: EAPMethods\n"
"POT-Creation-Date: 2017-02-02 18:14+0100\n"
"POT-Creation-Date: 2017-02-09 13:15+0100\n"
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
@@ -481,7 +481,7 @@ msgstr ""
msgid "Configuring EAP method failed (error %u)."
msgstr ""
#: master/lib/GTC_UI/res/wxGTC_UI.cpp:16 master/lib/GTC_UI/include/GTC_UI.h:93
#: master/lib/GTC_UI/res/wxGTC_UI.cpp:16 master/lib/GTC_UI/include/GTC_UI.h:103
msgid "GTC Challenge"
msgstr ""
@@ -497,11 +497,23 @@ msgstr ""
msgid "Enter your response here"
msgstr ""
#: master/lib/GTC_UI/src/GTC_UI.cpp:33
msgid "GTC User ID"
#: master/lib/GTC_UI/res/wxGTC_UI.cpp:70
msgid "EAP-GTC authentication &mode:"
msgstr ""
#: master/lib/GTC_UI/src/GTC_UI.cpp:69
#: master/lib/GTC_UI/res/wxGTC_UI.cpp:75
msgid "Select EAP-GTC authentication mode from the list"
msgstr ""
#: master/lib/GTC_UI/src/GTC_UI.cpp:39
msgid "Challenge/Response"
msgstr ""
#: master/lib/GTC_UI/src/GTC_UI.cpp:41
msgid "Password"
msgstr ""
#: master/lib/GTC_UI/src/GTC_UI.cpp:119
#, c-format
msgid "%s Challenge"
msgstr ""
@@ -713,7 +725,7 @@ msgstr ""
msgid "Custom outer identity to use"
msgstr ""
#: master/lib/TTLS_UI/src/Module.cpp:262 master/lib/TTLS_UI/src/Module.cpp:319
#: master/lib/TTLS_UI/src/Module.cpp:262 master/lib/TTLS_UI/src/Module.cpp:330
#: ver1.0/lib/TTLS_UI/src/Module.cpp:274 ver1.0/lib/TTLS_UI/src/Module.cpp:284
#: ver1.1/lib/TTLS_UI/src/Module.cpp:262 ver1.1/lib/TTLS_UI/src/Module.cpp:318
#: master/lib/EAPBase_UI/include/EAP_UI.h:785
@@ -723,7 +735,7 @@ msgstr ""
msgid "Error writing credentials to Credential Manager: %hs (error %u)"
msgstr ""
#: master/lib/TTLS_UI/src/Module.cpp:264 master/lib/TTLS_UI/src/Module.cpp:321
#: master/lib/TTLS_UI/src/Module.cpp:264 master/lib/TTLS_UI/src/Module.cpp:332
#: ver1.0/lib/TTLS_UI/src/Module.cpp:276 ver1.0/lib/TTLS_UI/src/Module.cpp:286
#: ver1.1/lib/TTLS_UI/src/Module.cpp:264 ver1.1/lib/TTLS_UI/src/Module.cpp:320
#: master/lib/EAPBase_UI/include/EAP_UI.h:788
@@ -732,22 +744,22 @@ msgstr ""
msgid "Writing credentials failed."
msgstr ""
#: master/lib/TTLS_UI/src/Module.cpp:356 ver1.1/lib/TTLS_UI/src/Module.cpp:355
#: master/lib/TTLS_UI/src/Module.cpp:367 ver1.1/lib/TTLS_UI/src/Module.cpp:355
#, c-format
msgid "Invoking EAP identity UI failed (error %u, %s, %s)."
msgstr ""
#: master/lib/TTLS_UI/src/Module.cpp:358 ver1.1/lib/TTLS_UI/src/Module.cpp:357
#: master/lib/TTLS_UI/src/Module.cpp:369 ver1.1/lib/TTLS_UI/src/Module.cpp:357
#, c-format
msgid "Invoking EAP identity UI failed (error %u)."
msgstr ""
#: master/lib/TTLS_UI/src/Module.cpp:485
#: master/lib/TTLS_UI/src/Module.cpp:496
#, c-format
msgid "Invoking EAP interactive UI failed (error %u, %s, %s)."
msgstr ""
#: master/lib/TTLS_UI/src/Module.cpp:488
#: master/lib/TTLS_UI/src/Module.cpp:499
#, c-format
msgid "Invoking EAP interactive UI failed (error %u)."
msgstr ""
@@ -884,62 +896,38 @@ msgstr ""
msgid "EAP Identity Provider"
msgstr ""
#: master/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: master/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: master/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: master/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: ver1.0/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: ver1.0/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: ver1.0/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: ver1.0/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: ver1.1/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: ver1.1/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: ver1.1/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: ver1.1/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
msgid "EAP Methods"
msgstr ""
#: master/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: master/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: master/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: master/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: ver1.0/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: ver1.0/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: ver1.0/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: ver1.0/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: ver1.1/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: ver1.1/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: ver1.1/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: ver1.1/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
msgid "Modules to support individual EAP methods"
msgstr ""
#: master/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:5
#: master/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:5
#: master/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:5
#: master/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:5
#: ver1.0/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:5
#: ver1.0/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:5
#: ver1.0/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:5
#: ver1.0/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:5
#: ver1.1/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:5
#: ver1.1/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:5
#: ver1.1/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:5
#: ver1.1/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:5
msgid "TTLS"
msgstr ""
#: master/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:5
#: master/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:5
#: master/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:5
#: master/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:5
#: ver1.0/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:5
#: ver1.0/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:5
#: ver1.0/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:5
#: ver1.0/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:5
#: ver1.1/EAPMethods/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:5
#: ver1.1/EAPMethods/MSIBuild/en_US.Win32.Release.Feature-2.idtx:5
#: ver1.1/EAPMethods/MSIBuild/en_US.x64.Debug.Feature-2.idtx:5
#: ver1.1/EAPMethods/MSIBuild/en_US.x64.Release.Feature-2.idtx:5
msgid "Tunneled Transport Layer Security"
msgstr ""

Binary file not shown.

BIN
Makefile

Binary file not shown.

View File

@@ -1,20 +1,22 @@
# GÉANTLink
Suite of EAP supplicants for Microsoft Windows - IEEE 802.1X plug-ins for enterprise network authentication
Suite of EAP supplicants for Microsoft Windows - IEEE 802.1X clients for enterprise network authentication
## Features
- Integrates into Windows seamlessly
- Wired and wireless network support
### Authentication methods
- EAP-TTLS with the following inner methods:
- PAP
- MSCHAPv2
- EAP-MSCHAPv2
- EAP-GTC
- EAP-GTC: Challenge/Response and Password authentication modes
- System-installed EAP method chaining (experimental)
### Security
- Microsoft Windows Credential Manager stored user credentials
- User credentials can be shared between different network profiles
- User credentials can be shared between different network profiles, regardless of their connection: wired or wireless
- Encrypted EapHost inter-process communication
- TLS:
- Separate trusted root CA list
@@ -30,11 +32,21 @@ Suite of EAP supplicants for Microsoft Windows - IEEE 802.1X plug-ins for enterp
- Lockable network profile configuration
### Deployment
- Released as multi-lingual 32 and 64-bit MSI packages
- Released as multi-lingual 32 and 64-bit MSI packages; Group Policy deployment supported
- [MsiUseFeature utility](https://github.com/Amebis/GEANTLink/tree/master/MsiUseFeature) for GÉANTLink install state testing (for embedding GÉANTLink into other setup packages)
- [CredWrite utility](https://github.com/Amebis/GEANTLink/tree/master/CredWrite) for automated user credential import to Credential Manager
- [WLANManager utility](https://github.com/Amebis/GEANTLink/tree/master/WLANManager) to allow network profile configuration dialog shortcuts
### Supported operating systems
- Windows Vista, Windows Server 2008
- Windows 7, Windows Server 2008 R2
- Windows 8 Desktop, Windows Server 2012
- Windows 8.1 Desktop, Windows Server 2012 R2
- Windows 10 Desktop, Windows Server 2016
## Download
Binaries are available for download [here](https://github.com/Amebis/GEANTLink/releases).
## Building
### Building Environment Requirements
@@ -117,3 +129,6 @@ Command | Explanation
`nmake SetupDebug` | Builds a debug version of project and debug MSI setup files. The resulting files can be found in `output\Setup` folder.
The `/ls` flag can be appended to the commands above to reduce NMAKEs verbosity. You can combine multiple targets (i.e. nmake Unregister Clean). Please, see NMAKE reference for further reading.
### Translating into your language
GÉANTLink is fully localizable. We kindly invite you to help [translating it on Transifex](https://www.transifex.com/eduroam_devel/geantlink/).

View File

@@ -60,6 +60,10 @@ static int WLANManager()
return -1;
}
wstring interface_name;
if (nArgs >= 5 && _wcsicmp(pwcArglist[3], L"interface") == 0)
interface_name = pwcArglist[4];
// Open WLAN handle.
DWORD dwNegotiatedVersion;
wlan_handle wlan;
@@ -83,21 +87,55 @@ static int WLANManager()
interfaces.reset(pInterfaceList);
}
tstring_guid devclass_net(GUID_DEVCLASS_NET);
bool profile_found = false;
for (DWORD i = 0; i < interfaces->dwNumberOfItems; i++) {
if (interfaces->InterfaceInfo[i].isState == wlan_interface_state_not_ready) {
// This interface is not ready.
continue;
}
if (!interface_name.empty()) {
// Read the interface name from registry.
reg_key key;
if (key.open(HKEY_LOCAL_MACHINE, tstring_printf(_T("SYSTEM\\CurrentControlSet\\Control\\Network\\%s\\%s\\Connection"), devclass_net.c_str(), tstring_guid(interfaces->InterfaceInfo[i].InterfaceGuid).c_str()).c_str(), 0, KEY_READ)) {
wstring name;
if (RegQueryStringValue(key, _T("Name"), name) == ERROR_SUCCESS && _wcsicmp(interface_name.c_str(), name.c_str()) != 0) {
// Not the interface we are interested in.
continue;
}
}
}
unique_ptr<WLAN_PROFILE_INFO_LIST, WlanFreeMemory_delete<WLAN_PROFILE_INFO_LIST> > profiles;
{
// Get a list of profiles.
WLAN_PROFILE_INFO_LIST *pProfileList;
DWORD dwResult = WlanGetProfileList(wlan, &(interfaces->InterfaceInfo[i].InterfaceGuid), NULL, &pProfileList);
if (dwResult != ERROR_SUCCESS) {
DisplayError(_T("%s function failed (error %u)."), _T("WlanGetProfileList"), dwResult);
return 4;
}
profiles.reset(pProfileList);
}
for (DWORD j = 0; j < profiles->dwNumberOfItems; j++)
if (_wcsicmp(profiles->ProfileInfo[j].strProfileName, pwcArglist[2]) == 0) {
profile_found = true;
break;
}
if (!profile_found)
continue;
// Launch WLAN profile config dialog.
// Note: When a debugger is attached to this process the WlanUIEditProfile() will raise an exception and fail.
WLAN_REASON_CODE wlrc;
WLAN_REASON_CODE wlrc = L2_REASON_CODE_SUCCESS;
DWORD dwResult = WlanUIEditProfile(WLAN_UI_API_VERSION, pwcArglist[2], &(interfaces->InterfaceInfo[i].InterfaceGuid), NULL, WLSecurityPage, NULL, &wlrc);
if (dwResult != ERROR_SUCCESS) {
DisplayError(_T("%s function failed (error %u)."), _T("WlanUIEditProfile"), dwResult);
// WlanUIEditProfile() displays own error dialog on failure.
//DisplayError(_T("%s function failed (error %u)."), _T("WlanUIEditProfile"), dwResult);
return 5;
}
if (wlrc != WLAN_REASON_CODE_SUCCESS) {
} else if (wlrc != WLAN_REASON_CODE_SUCCESS) {
tstring reason;
if (WlanReasonCodeToString(wlrc, reason, NULL) == ERROR_SUCCESS)
DisplayError(_T("%s function failed: %s"), _T("WlanUIEditProfile"), reason.c_str());
@@ -108,6 +146,9 @@ static int WLANManager()
break;
}
if (!profile_found)
DisplayError(_T("%ls profile not found."), pwcArglist[2]);
return 0;
}
@@ -119,6 +160,13 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(nCmdShow);
int res = 0;
{
// Note: When a debugger is attached to this process, the WlanUIEditProfile() will raise an exception and fail.
// It was accidentially discovered, that COM initialization resolves this issue.
com_initializer com_init(NULL);
{
// Initialize Windows XP visual styles
INITCOMMONCONTROLSEX icc;
@@ -129,7 +177,8 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
pfnWlanReasonCodeToString = WlanReasonCodeToString;
int res = WLANManager();
res = WLANManager();
}
assert(!_CrtDumpMemoryLeaks());
return res;

View File

@@ -1,12 +1,13 @@
#WLANManager
# WLANManager
Invokes standard Windows Wireless Network Properties dialog
##Usage
## Usage
```
WLANManager profile <name>
WLANManager profile <profile name> [interface <interface name>]
```
- `name` - The name of the network profile (not neccessarely the same as SSID)
- `profile name` - The name of the network profile (not neccessarely the same as SSID)
- `interface name` - The name of the specific network interface to search the profile at
Return codes:
- -1 = Invalid parameters

View File

@@ -28,6 +28,7 @@
#include <Windows.h>
#include <CommCtrl.h>
#include <devguid.h>
#include <tchar.h>
#include <memory>

View File

@@ -29,7 +29,7 @@
// Product version as a single DWORD
// Note: Used for version comparison within C/C++ code.
//
#define PRODUCT_VERSION 0x01020100
#define PRODUCT_VERSION 0x01020500
//
// Product version by components
@@ -39,26 +39,26 @@
//
#define PRODUCT_VERSION_MAJ 1
#define PRODUCT_VERSION_MIN 2
#define PRODUCT_VERSION_REV 1
#define PRODUCT_VERSION_REV 5
#define PRODUCT_VERSION_BUILD 0
//
// Human readable product version and build year for UI
//
#define PRODUCT_VERSION_STR "1.2-beta"
#define PRODUCT_BUILD_YEAR_STR "2016"
#define PRODUCT_VERSION_STR "1.2a"
#define PRODUCT_BUILD_YEAR_STR "2017"
//
// Numerical version presentation for ProductVersion propery in
// MSI packages (syntax: N.N[.N[.N]])
//
#define PRODUCT_VERSION_INST "1.2.1"
#define PRODUCT_VERSION_INST "1.2.5"
//
// The product code for ProductCode property in MSI packages
// Replace with new on every version change, regardless how minor it is.
//
#define PRODUCT_VERSION_GUID "{FDBF521E-65C3-4715-823F-CF7CE63E0470}"
#define PRODUCT_VERSION_GUID "{B43F5526-283F-4634-8841-51B7CB6D5AEC}"
//
// Product vendor

View File

@@ -31,36 +31,6 @@ namespace eap
class config_connection;
}
/// \addtogroup EAPBaseStream
/// @{
///
/// Packs a configuration
///
/// \param[inout] cursor Memory cursor
/// \param[in] val Configuration to pack
///
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &val);
///
/// Returns packed size of a configuration
///
/// \param[in] val Configuration to pack
///
/// \returns Size of data when packed (in bytes)
///
inline size_t pksizeof(_In_ const eap::config &val);
///
/// Unpacks a configuration
///
/// \param[inout] cursor Memory cursor
/// \param[out] val Configuration to unpack to
///
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val);
/// @}
#pragma once
#include "Module.h"
@@ -89,9 +59,9 @@ namespace eap
/// @{
///
/// Base class for configuration storage
/// Base class for packable and XML-exportable storage
///
class config
class config : public packable
{
public:
///
@@ -160,32 +130,6 @@ namespace eap
/// @}
/// \name BLOB management
/// @{
///
/// Packs this object
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of this object
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks this object
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
public:
module &m_module; ///< EAP module
@@ -530,24 +474,6 @@ namespace eap
}
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &val)
{
val.operator<<(cursor);
}
inline size_t pksizeof(_In_ const eap::config &val)
{
return val.get_pk_size();
}
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val)
{
val.operator>>(cursor);
}
/// \addtogroup EAPBaseStream
/// @{
@@ -584,6 +510,7 @@ inline size_t pksizeof(_In_ const eap::config_method::status_t &val)
///
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config_method::status_t &val)
{
val = (eap::config_method::status_t)0; // Reset higher bytes to zero before reading to lower byte.
cursor >> (unsigned char&)val;
}

View File

@@ -571,6 +571,7 @@ inline size_t pksizeof(_In_ const eap::credentials_pass::enc_alg_t &val)
///
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::credentials_pass::enc_alg_t &val)
{
val = (eap::credentials_pass::enc_alg_t)0; // Reset higher bytes to zero before reading to lower byte.
cursor >> (unsigned char&)val;
}

View File

@@ -80,6 +80,8 @@ namespace eap
struct cursor_out;
struct cursor_in;
class packable;
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_f;
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_zf;
@@ -499,6 +501,31 @@ inline size_t pksizeof(_In_ const EAP_METHOD_TYPE &val);
///
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ EAP_METHOD_TYPE &val);
///
/// Packs a packable object
///
/// \param[inout] cursor Memory cursor
/// \param[in] val Object to pack
///
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::packable &val);
///
/// Returns packed size of a packable object
///
/// \param[in] val Object to pack
///
/// \returns Size of data when packed (in bytes)
///
inline size_t pksizeof(_In_ const eap::packable &val);
///
/// Unpacks a packable object
///
/// \param[inout] cursor Memory cursor
/// \param[out] val Object to unpack to
///
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::packable &val);
/// @}
///
@@ -574,6 +601,45 @@ namespace eap
ptr_type ptr_end; ///< Pointer to the end of BLOB
};
///
/// Base class for all packable data classes
///
class packable
{
public:
///
/// Constructs configuration
///
packable();
/// \name BLOB management
/// @{
///
/// Packs this object
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of this object
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks this object
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
};
/// @}
/// \addtogroup EAPBaseSanitizing
@@ -1087,9 +1153,11 @@ inline size_t pksizeof(_In_ const winstd::cert_context &val)
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::cert_context &val)
{
DWORD dwCertEncodingType;
assert(sizeof(dwCertEncodingType) == sizeof(unsigned int));
cursor >> (unsigned int&)dwCertEncodingType;
DWORD dwCertEncodedSize;
assert(sizeof(dwCertEncodingType) == sizeof(unsigned int));
cursor >> (unsigned int&)dwCertEncodedSize;
if (dwCertEncodedSize) {
@@ -1116,6 +1184,7 @@ inline size_t pksizeof(_In_ const winstd::eap_type_t &val)
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::eap_type_t &val)
{
val = (winstd::eap_type_t)0; // Reset higher bytes to zero before reading to lower byte.
cursor >> (unsigned char&)val;
}
@@ -1198,6 +1267,24 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ EAP_METHOD_TYPE &va
}
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::packable &val)
{
val.operator<<(cursor);
}
inline size_t pksizeof(_In_ const eap::packable &val)
{
return val.get_pk_size();
}
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::packable &val)
{
val.operator>>(cursor);
}
#ifndef htonll
inline unsigned __int64 htonll(unsigned __int64 val)

View File

@@ -43,17 +43,16 @@ namespace eap
///
/// UI context
///
class ui_context : public config
class ui_context : public packable
{
public:
///
/// Constructs context
///
/// \param[in] mod EAP module to use for global services
/// \param[in] cfg Connection configuration
/// \param[in] cred Connection credentials
///
ui_context(_In_ module &mod, _In_ config_connection &cfg, _In_ credentials_connection &cred);
ui_context(_In_ config_connection &cfg, _In_ credentials_connection &cred);
///
/// Copies context

View File

@@ -77,24 +77,6 @@ void eap::config::load(_In_ IXMLDOMNode *pConfigRoot)
}
void eap::config::operator<<(_Inout_ cursor_out &cursor) const
{
UNREFERENCED_PARAMETER(cursor);
}
size_t eap::config::get_pk_size() const
{
return 0;
}
void eap::config::operator>>(_Inout_ cursor_in &cursor)
{
UNREFERENCED_PARAMETER(cursor);
}
const bstr eap::config::namespace_eapmetadata(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");

View File

@@ -20,10 +20,39 @@
#include "StdAfx.h"
#pragma comment(lib, "Ws2_32.lib")
using namespace std;
using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::packable
//////////////////////////////////////////////////////////////////////
eap::packable::packable()
{
}
void eap::packable::operator<<(_Inout_ cursor_out &cursor) const
{
UNREFERENCED_PARAMETER(cursor);
}
size_t eap::packable::get_pk_size() const
{
return 0;
}
void eap::packable::operator>>(_Inout_ cursor_in &cursor)
{
UNREFERENCED_PARAMETER(cursor);
}
//////////////////////////////////////////////////////////////////////
// eap::diameter_avp_append
//////////////////////////////////////////////////////////////////////

View File

@@ -28,8 +28,7 @@ using namespace winstd;
// eap::ui_context
//////////////////////////////////////////////////////////////////////
eap::ui_context::ui_context(_In_ module &mod, _In_ config_connection &cfg, _In_ credentials_connection &cred) :
config(mod),
eap::ui_context::ui_context(_In_ config_connection &cfg, _In_ credentials_connection &cred) :
m_cfg(cfg),
m_cred(cred)
{
@@ -38,16 +37,16 @@ eap::ui_context::ui_context(_In_ module &mod, _In_ config_connection &cfg, _In_
eap::ui_context::ui_context(_In_ const ui_context &other) :
m_cfg (other.m_cfg ),
m_cred(other.m_cred),
config(other )
m_cred (other.m_cred),
packable(other )
{
}
eap::ui_context::ui_context(_Inout_ ui_context &&other) :
m_cfg ( other.m_cfg ),
m_cred( other.m_cred ),
config(std::move(other ))
m_cred ( other.m_cred ),
packable(std::move(other ))
{
}
@@ -57,7 +56,7 @@ eap::ui_context& eap::ui_context::operator=(_In_ const ui_context &other)
if (this != &other) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Copy context within same configuration only!
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Copy context within same credentials only!
(config&)*this = other;
(packable&)*this = other;
}
return *this;
@@ -69,7 +68,7 @@ eap::ui_context& eap::ui_context::operator=(_Inout_ ui_context &&other)
if (this != &other) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move context within same configuration only!
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move context within same credentials only!
(config&)*this = std::move(other);
(packable&)*this = std::move(other);
}
return *this;
@@ -78,7 +77,7 @@ eap::ui_context& eap::ui_context::operator=(_Inout_ ui_context &&other)
void eap::ui_context::operator<<(_Inout_ cursor_out &cursor) const
{
config::operator<<(cursor);
packable::operator<<(cursor);
cursor << m_cfg ;
cursor << m_cred;
}
@@ -87,7 +86,7 @@ void eap::ui_context::operator<<(_Inout_ cursor_out &cursor) const
size_t eap::ui_context::get_pk_size() const
{
return
config::get_pk_size() +
packable::get_pk_size() +
pksizeof(m_cfg ) +
pksizeof(m_cred);
}
@@ -95,7 +94,7 @@ size_t eap::ui_context::get_pk_size() const
void eap::ui_context::operator>>(_Inout_ cursor_in &cursor)
{
config::operator>>(cursor);
packable::operator>>(cursor);
cursor >> m_cfg ;
cursor >> m_cred;
}

View File

@@ -360,6 +360,14 @@ public:
///
/// Constructs a credential dialog
///
/// \param[in] prov Provider configuration data
/// \param[in] parent Parent window
/// \param[in] id An identifier for the dialog. A value of -1 is taken to mean a default.
/// \param[in] title The title of the dialog
/// \param[in] pos The dialog position. The value \c wxDefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform.
/// \param[in] size The dialog size. The value \c wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform.
/// \param[in] style The window style
///
wxEAPCredentialsDialog(const eap::config_provider &prov, wxWindow *parent, wxWindowID id = wxID_ANY, const wxString &title = _("EAP Credentials"), const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
};

Binary file not shown.

View File

@@ -44,6 +44,15 @@ namespace eap
///
class config_method_eapgtc : public config_method_with_cred
{
public:
///
/// Authentication mode
///
enum auth_mode_t {
auth_mode_response = 0, ///< Challenge/Response
auth_mode_password, ///< Password
};
public:
///
/// Constructs configuration
@@ -87,6 +96,19 @@ namespace eap
virtual config* clone() const;
/// \name XML management
/// @{
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name BLOB management
/// @{
virtual void operator<<(_Inout_ cursor_out &cursor) const;
virtual size_t get_pk_size() const;
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
///
/// @copydoc eap::config_method::get_method_id()
/// \returns This implementation always returns `winstd::eap_type_gtc`
@@ -101,10 +123,53 @@ namespace eap
///
/// @copydoc eap::config_method::make_credentials()
/// \returns This implementation always returns `eap::credentials_identity` type of credentials
/// \returns This implementation returns `eap::credentials_identity` or `eap::credentials_pass` type of credentials, depending on authentication mode.
///
virtual credentials* make_credentials() const;
};
/// @}
}
/// \addtogroup EAPBaseStream
/// @{
///
/// Packs an EAP-GTC method authentication mode
///
/// \param[inout] cursor Memory cursor
/// \param[in] val Authentication mode to pack
///
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config_method_eapgtc::auth_mode_t &val)
{
cursor << (unsigned char)val;
}
///
/// Returns packed size of an EAP-GTC method authentication mode
///
/// \param[in] val Authentication mode to pack
///
/// \returns Size of data when packed (in bytes)
///
inline size_t pksizeof(_In_ const eap::config_method_eapgtc::auth_mode_t &val)
{
return pksizeof((unsigned char)val);
}
///
/// Unpacks an EAP-GTC method authentication mode
///
/// \param[inout] cursor Memory cursor
/// \param[out] val Authentication mode to unpack to
///
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config_method_eapgtc::auth_mode_t &val)
{
val = (eap::config_method_eapgtc::auth_mode_t)0; // Reset higher bytes to zero before reading to lower byte.
cursor >> (unsigned char&)val;
}
/// @}

View File

@@ -50,7 +50,7 @@ namespace eap
/// \param[in] cfg Method configuration
/// \param[in] cred User credentials
///
method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _In_ credentials_identity &cred);
method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _In_ credentials &cred);
///
/// Moves a GTC method
@@ -109,7 +109,7 @@ namespace eap
protected:
config_method_eapgtc &m_cfg; ///< Method configuration
credentials_identity &m_cred; ///< Method user credentials
credentials &m_cred; ///< Method user credentials
winstd::sanitizing_wstring m_challenge; ///< GTC challenge
winstd::sanitizing_wstring m_response; ///< GTC response
};

View File

@@ -30,6 +30,7 @@ using namespace winstd;
eap::config_method_eapgtc::config_method_eapgtc(_In_ module &mod, _In_ unsigned int level) : config_method_with_cred(mod, level)
{
// Default to Challenge/Response authentication mode.
m_cred.reset(new credentials_identity(mod));
}
@@ -70,6 +71,95 @@ eap::config* eap::config_method_eapgtc::clone() const
}
void eap::config_method_eapgtc::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
{
assert(pDoc);
assert(pConfigRoot);
config_method_with_cred::save(pDoc, pConfigRoot);
HRESULT hr;
if (dynamic_cast<credentials_identity*>(m_cred.get()))
hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"AuthMode"), namespace_eapmetadata, bstr(L"Challenge/Response"));
else if (dynamic_cast<credentials_pass*>(m_cred.get()))
hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"AuthMode"), namespace_eapmetadata, bstr(L"Password"));
else
throw invalid_argument(__FUNCTION__ " Unsupported authentication mode.");
if (FAILED(hr))
throw com_runtime_error(hr, __FUNCTION__ " Error creating <AuthMode> element.");
}
void eap::config_method_eapgtc::load(_In_ IXMLDOMNode *pConfigRoot)
{
assert(pConfigRoot);
HRESULT hr;
wstring xpath(eapxml::get_xpath(pConfigRoot));
// Load authentication mode first, then (re)create credentials to match the authentication mode.
bstr auth_mode;
if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:AuthMode"), auth_mode)) ||
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, auth_mode, auth_mode.length(), _L("Challenge/Response"), -1, NULL, NULL, 0) == CSTR_EQUAL)
{
m_cred.reset(new eap::credentials_identity(m_module));
} else if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, auth_mode, auth_mode.length(), _L("Password"), -1, NULL, NULL, 0) == CSTR_EQUAL) {
m_cred.reset(new eap::credentials_pass(m_module));
} else
throw invalid_argument(string_printf(__FUNCTION__ " Unsupported authentication mode (%ls).", (BSTR)auth_mode));
m_module.log_config((xpath + L"/AuthMode").c_str(), (BSTR)auth_mode);
// Load method configuration.
config_method_with_cred::load(pConfigRoot);
}
void eap::config_method_eapgtc::operator<<(_Inout_ cursor_out &cursor) const
{
// Save authentication mode first, as credential loading will require this information.
if (dynamic_cast<credentials_identity*>(m_cred.get()))
cursor << auth_mode_response;
else if (dynamic_cast<credentials_pass*>(m_cred.get()))
cursor << auth_mode_password;
else
throw invalid_argument(__FUNCTION__ " Unsupported authentication mode.");
config_method_with_cred::operator<<(cursor);
}
size_t eap::config_method_eapgtc::get_pk_size() const
{
auth_mode_t auth_mode;
if (dynamic_cast<credentials_identity*>(m_cred.get()))
auth_mode = auth_mode_response;
else if (dynamic_cast<credentials_pass*>(m_cred.get()))
auth_mode = auth_mode_password;
else
throw invalid_argument(__FUNCTION__ " Unsupported authentication mode.");
return
pksizeof(auth_mode) +
config_method_with_cred::get_pk_size();
}
void eap::config_method_eapgtc::operator>>(_Inout_ cursor_in &cursor)
{
// (Re)create credentials to match the authentication mode.
auth_mode_t auth_mode;
cursor >> auth_mode;
switch (auth_mode) {
case auth_mode_response: m_cred.reset(new eap::credentials_identity(m_module)); break;
case auth_mode_password: m_cred.reset(new eap::credentials_pass (m_module)); break;
default : throw invalid_argument(string_printf(__FUNCTION__ " Unsupported authentication mode (%u).", auth_mode));
}
config_method_with_cred::operator>>(cursor);
}
eap_type_t eap::config_method_eapgtc::get_method_id() const
{
return eap_type_gtc;
@@ -84,5 +174,10 @@ const wchar_t* eap::config_method_eapgtc::get_method_str() const
eap::credentials* eap::config_method_eapgtc::make_credentials() const
{
if (dynamic_cast<credentials_identity*>(m_cred.get()))
return new eap::credentials_identity(m_module);
else if (dynamic_cast<credentials_pass*>(m_cred.get()))
return new eap::credentials_pass (m_module);
else
throw invalid_argument(__FUNCTION__ " Unsupported authentication mode.");
}

View File

@@ -28,7 +28,7 @@ using namespace winstd;
// eap::method_gtc
//////////////////////////////////////////////////////////////////////
eap::method_gtc::method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _In_ credentials_identity &cred) :
eap::method_gtc::method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _In_ credentials &cred) :
m_cfg(cfg),
m_cred(cred),
method(mod)
@@ -83,6 +83,8 @@ EapPeerMethodResponseAction eap::method_gtc::process_request_packet(
m_module.log_event(&EAPMETHOD_METHOD_HANDSHAKE_START2, event_data((unsigned int)eap_type_gtc), event_data::blank);
credentials_pass *cred_pass;
if (dynamic_cast<credentials_identity*>(&m_cred)) {
// Read authenticator challenge as UTF-8 encoded string.
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)pReceivedPacket, dwReceivedPacketSize, m_challenge);
@@ -90,6 +92,15 @@ EapPeerMethodResponseAction eap::method_gtc::process_request_packet(
// User must respond to the challenge.
return EapPeerMethodResponseActionInvokeUI;
} else if ((cred_pass = dynamic_cast<credentials_pass*>(&m_cred)) != NULL) {
// Ignore authenticator challenge and save password as GTC response.
m_response = cred_pass->m_password;
// Send the response.
m_cfg.m_last_status = config_method::status_cred_invalid; // Blame "credentials" if we fail beyond this point.
return EapPeerMethodResponseActionSend;
} else
throw invalid_argument(__FUNCTION__ " Unsupported authentication mode.");
}
@@ -98,13 +109,13 @@ void eap::method_gtc::get_response_packet(
_In_opt_ DWORD size_max)
{
// Encode GTC response as UTF-8.
sanitizing_string reply_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_response, reply_utf8, NULL, NULL);
sanitizing_string response_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_response, response_utf8, NULL, NULL);
if (sizeof(sanitizing_string::value_type)*reply_utf8.length() > size_max)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", sizeof(sanitizing_string::value_type)*reply_utf8.length(), size_max));
if (sizeof(sanitizing_string::value_type)*response_utf8.length() > size_max)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", sizeof(sanitizing_string::value_type)*response_utf8.length(), size_max));
packet.assign(reply_utf8.begin(), reply_utf8.end());
packet.assign(response_utf8.begin(), response_utf8.end());
}

View File

@@ -29,14 +29,24 @@ class wxGTCResponsePanel;
/// @{
///
/// GTC credential entry panel
/// GTC challenge/response credential entry panel
///
typedef wxIdentityCredentialsPanel<eap::credentials_identity, wxIdentityCredentialsPanelBase> wxGTCCredentialsPanel;
typedef wxIdentityCredentialsPanel<eap::credentials_identity, wxIdentityCredentialsPanelBase> wxGTCResponseCredentialsPanel;
///
/// GTC credential configuration panel
/// GTC challenge/response credential configuration panel
///
typedef wxEAPCredentialsConfigPanel<eap::credentials_identity, wxGTCCredentialsPanel> wxGTCCredentialsConfigPanel;
typedef wxEAPCredentialsConfigPanel<eap::credentials_identity, wxGTCResponseCredentialsPanel> wxGTCResponseCredentialsConfigPanel;
///
/// GTC password credential entry panel
///
typedef wxPasswordCredentialsPanel<eap::credentials_pass, wxPasswordCredentialsPanelBase> wxGTCPasswordCredentialsPanel;
///
/// GTC password credential configuration panel
///
typedef wxEAPCredentialsConfigPanel<eap::credentials_pass, wxGTCPasswordCredentialsPanel> wxGTCPasswordCredentialsConfigPanel;
/// @}
@@ -44,11 +54,6 @@ typedef wxEAPCredentialsConfigPanel<eap::credentials_identity, wxGTCCredentialsP
#include "../res/wxGTC_UI.h"
#include <wx/panel.h>
#include <wx/stattext.h>
#include <string>
#include <Windows.h>
@@ -58,7 +63,7 @@ typedef wxEAPCredentialsConfigPanel<eap::credentials_identity, wxGTCCredentialsP
///
/// GTC configuration panel
///
class wxGTCConfigPanel : public wxPanel
class wxGTCConfigPanel : public wxGTCConfigPanelBase
{
public:
///
@@ -66,18 +71,23 @@ public:
///
wxGTCConfigPanel(const eap::config_provider &prov, eap::config_method_eapgtc &cfg, wxWindow* parent);
///
/// Destructs the configuration panel
///
virtual ~wxGTCConfigPanel();
protected:
/// \cond internal
virtual void OnInitDialog(wxInitDialogEvent& event);
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
virtual void OnUpdateUI(wxUpdateUIEvent& event);
/// \endcond
protected:
wxGTCCredentialsConfigPanel *m_credentials; ///< Credentials configuration panel
const eap::config_provider &m_prov; ///< EAP provider
eap::config_method_eapgtc &m_cfg; ///< EAP-GTC configuration
wxGTCResponseCredentialsConfigPanel *m_credentials_resp; ///< Challenge/response credentials configuration panel
wxGTCPasswordCredentialsConfigPanel *m_credentials_pass; ///< Password credentials configuration panel
// Temporary configurations to hold data until applied
eap::config_method_eapgtc m_cfg_resp; ///< Method configuration for challenge/response mode
eap::config_method_eapgtc m_cfg_pass; ///< Method configuration for password mode
};
@@ -90,6 +100,14 @@ public:
///
/// Constructs a credential dialog
///
/// \param[in] prov Provider configuration data
/// \param[in] parent Parent window
/// \param[in] id An identifier for the dialog. A value of -1 is taken to mean a default.
/// \param[in] title The title of the dialog
/// \param[in] pos The dialog position. The value \c wxDefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform.
/// \param[in] size The dialog size. The value \c wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform.
/// \param[in] style The window style
///
wxGTCResponseDialog(const eap::config_provider &prov, wxWindow *parent, wxWindowID id = wxID_ANY, const wxString &title = _("GTC Challenge"), const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
};

View File

@@ -61,3 +61,32 @@ wxGTCResponsePanelBase::wxGTCResponsePanelBase( wxWindow* parent, wxWindowID id,
wxGTCResponsePanelBase::~wxGTCResponsePanelBase()
{
}
wxGTCConfigPanelBase::wxGTCConfigPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxBoxSizer* sb_vertical;
sb_vertical = new wxBoxSizer( wxVERTICAL );
m_auth_mode_label = new wxStaticText( this, wxID_ANY, _("EAP-GTC authentication &mode:"), wxDefaultPosition, wxDefaultSize, 0 );
m_auth_mode_label->Wrap( -1 );
sb_vertical->Add( m_auth_mode_label, 0, wxBOTTOM, 5 );
m_auth_mode = new wxChoicebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCHB_DEFAULT );
m_auth_mode->SetToolTip( _("Select EAP-GTC authentication mode from the list") );
sb_vertical->Add( m_auth_mode, 1, wxEXPAND, 5 );
this->SetSizer( sb_vertical );
this->Layout();
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxGTCConfigPanelBase::OnUpdateUI ) );
}
wxGTCConfigPanelBase::~wxGTCConfigPanelBase()
{
// Disconnect Events
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxGTCConfigPanelBase::OnUpdateUI ) );
}

View File

@@ -466,5 +466,230 @@
</object>
</object>
</object>
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">wxGTCConfigPanelBase</property>
<property name="pos"></property>
<property name="size">500,-1</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI">OnUpdateUI</event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_vertical</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">EAP-GTC authentication &amp;mode:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_auth_mode_label</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxChoicebook" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_auth_mode</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxCHB_DEFAULT</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Select EAP-GTC authentication mode from the list</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnChoicebookPageChanged"></event>
<event name="OnChoicebookPageChanging"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@@ -25,6 +25,7 @@
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/panel.h>
#include <wx/choicebk.h>
///////////////////////////////////////////////////////////////////////////
@@ -50,4 +51,26 @@ class wxGTCResponsePanelBase : public wxPanel
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxGTCConfigPanelBase
///////////////////////////////////////////////////////////////////////////////
class wxGTCConfigPanelBase : public wxPanel
{
private:
protected:
wxStaticText* m_auth_mode_label;
wxChoicebook* m_auth_mode;
// Virtual event handlers, overide them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
public:
wxGTCConfigPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
~wxGTCConfigPanelBase();
};
#endif //__WXGTC_UI_H__

View File

@@ -25,36 +25,86 @@
// wxGTCConfigPanel
//////////////////////////////////////////////////////////////////////
wxGTCConfigPanel::wxGTCConfigPanel(const eap::config_provider &prov, eap::config_method_eapgtc &cfg, wxWindow* parent) : wxPanel(parent)
wxGTCConfigPanel::wxGTCConfigPanel(const eap::config_provider &prov, eap::config_method_eapgtc &cfg, wxWindow* parent) :
m_prov (prov ),
m_cfg (cfg ),
m_cfg_resp(cfg.m_module, cfg.m_level),
m_cfg_pass(cfg.m_module, cfg.m_level),
wxGTCConfigPanelBase(parent)
{
wxBoxSizer* sb_content;
sb_content = new wxBoxSizer( wxVERTICAL );
// Initialize Password authentication mode properly. Challenge/Response mode does not require initialization, since it is initialized so by default.
m_cfg_pass.m_cred.reset(new eap::credentials_pass(m_cfg.m_module));
m_credentials = new wxGTCCredentialsConfigPanel(prov, cfg, this, _("GTC User ID"));
sb_content->Add(m_credentials, 0, wxEXPAND, 5);
this->SetSizer(sb_content);
this->Layout();
// Connect Events
this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxGTCConfigPanel::OnInitDialog));
}
wxGTCConfigPanel::~wxGTCConfigPanel()
{
// Disconnect Events
this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxGTCConfigPanel::OnInitDialog));
m_credentials_resp = new wxGTCResponseCredentialsConfigPanel(m_prov, m_cfg_resp, m_auth_mode);
m_auth_mode->AddPage(m_credentials_resp, _("Challenge/Response"));
m_credentials_pass = new wxGTCPasswordCredentialsConfigPanel(m_prov, m_cfg_pass, m_auth_mode);
m_auth_mode->AddPage(m_credentials_pass, _("Password"));
}
/// \cond internal
void wxGTCConfigPanel::OnInitDialog(wxInitDialogEvent& event)
bool wxGTCConfigPanel::TransferDataToWindow()
{
// Forward the event to child panels.
if (m_credentials)
m_credentials->GetEventHandler()->ProcessEvent(event);
eap::credentials_identity *cred_resp;
eap::credentials_pass *cred_pass;
if ((cred_resp = dynamic_cast<eap::credentials_identity*>(m_cfg.m_cred.get())) != NULL) {
m_cfg_resp = m_cfg;
m_auth_mode->SetSelection(0); // 0=Challenge/Response
} else if ((cred_pass = dynamic_cast<eap::credentials_pass*>(m_cfg.m_cred.get())) != NULL) {
m_cfg_pass = m_cfg;
m_auth_mode->SetSelection(1); // 1=Password
} else
wxFAIL_MSG(wxT("Unsupported authentication mode."));
return wxGTCConfigPanelBase::TransferDataToWindow();
}
bool wxGTCConfigPanel::TransferDataFromWindow()
{
wxCHECK(wxGTCConfigPanelBase::TransferDataFromWindow(), false);
if (!m_prov.m_read_only) {
// This is not a provider-locked configuration. Save the data.
switch (m_auth_mode->GetSelection()) {
case 0: // 0=Challenge/Response
m_cfg = m_cfg_resp;
break;
case 1: // 1=Password
m_cfg = m_cfg_pass;
break;
default:
wxFAIL_MSG(wxT("Unsupported authentication mode."));
}
}
return true;
}
void wxGTCConfigPanel::OnUpdateUI(wxUpdateUIEvent& event)
{
UNREFERENCED_PARAMETER(event);
if (m_prov.m_read_only) {
// This is provider-locked configuration. Disable controls.
m_auth_mode_label ->Enable(false);
m_auth_mode ->Enable(false);
m_credentials_resp->Enable(false);
m_credentials_pass->Enable(false);
} else {
// This is not a provider-locked configuration. Enable controls.
m_auth_mode_label ->Enable(true);
m_auth_mode ->Enable(true);
m_credentials_resp->Enable(true);
m_credentials_pass ->Enable(true);
}
}
/// \endcond

View File

@@ -55,7 +55,6 @@ wxTLSServerTrustPanelBase::wxTLSServerTrustPanelBase( wxWindow* parent, wxWindow
sb_root_ca_btn->Add( m_root_ca_add_file, 0, wxRIGHT|wxLEFT, 5 );
m_root_ca_remove = new wxButton( sb_server_trust->GetStaticBox(), wxID_ANY, _("&Remove CA"), wxDefaultPosition, wxDefaultSize, 0 );
m_root_ca_remove->Enable( false );
m_root_ca_remove->SetToolTip( _("Removes selected certificate authorities from the list") );
sb_root_ca_btn->Add( m_root_ca_remove, 0, wxLEFT, 5 );

View File

@@ -659,7 +659,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>

View File

@@ -44,11 +44,10 @@ namespace eap
///
/// Constructs context
///
/// \param[in] mod EAP module to use for global services
/// \param[in] cfg Connection configuration
/// \param[in] cred Connection credentials
///
ui_context_ttls(_In_ module &mod, _In_ config_connection &cfg, _In_ credentials_connection &cred);
ui_context_ttls(_In_ config_connection &cfg, _In_ credentials_connection &cred);
///
/// Copies context
@@ -82,13 +81,6 @@ namespace eap
///
ui_context_ttls& operator=(_Inout_ ui_context_ttls &&other);
///
/// Clones this object
///
/// \returns Pointer to cloned object with identical data
///
virtual config* clone() const;
/// \name BLOB management
/// @{
virtual void operator<<(_Inout_ cursor_out &cursor) const;

View File

@@ -259,7 +259,7 @@ EAP_SESSION_HANDLE eap::peer_ttls::begin_session(
case eap_type_gtc : meth_inner.reset(
new method_eapmsg (*this, cred_inner->get_identity().c_str(),
new method_eap (*this, eap_type_gtc,
new method_gtc (*this, dynamic_cast<config_method_eapgtc&>(*cfg_inner), dynamic_cast<credentials_identity&>(*cred_inner))))); break;
new method_gtc (*this, dynamic_cast<config_method_eapgtc&>(*cfg_inner), dynamic_cast<credentials&>(*cred_inner))))); break;
default: throw invalid_argument(__FUNCTION__ " Unsupported inner authentication method.");
}
}
@@ -367,7 +367,7 @@ void eap::peer_ttls::get_ui_context(
auto s = static_cast<session*>(hSession);
// Get context data from method.
ui_context_ttls ctx(*this, s->m_cfg, s->m_cred);
ui_context_ttls ctx(s->m_cfg, s->m_cred);
s->m_method->get_ui_context(ctx.m_data);
// Pack context data.

View File

@@ -28,14 +28,15 @@ using namespace winstd;
// eap::ui_context_ttls
//////////////////////////////////////////////////////////////////////
eap::ui_context_ttls::ui_context_ttls(_In_ module &mod, _In_ config_connection &cfg, _In_ credentials_connection &cred) :
ui_context(mod, cfg, cred)
eap::ui_context_ttls::ui_context_ttls(_In_ config_connection &cfg, _In_ credentials_connection &cred) :
ui_context(cfg, cred)
{
}
eap::ui_context_ttls::ui_context_ttls(_In_ const ui_context_ttls &other) :
ui_context(other)
m_data (other.m_data),
ui_context(other )
{
}
@@ -69,12 +70,6 @@ eap::ui_context_ttls& eap::ui_context_ttls::operator=(_Inout_ ui_context_ttls &&
}
eap::config* eap::ui_context_ttls::clone() const
{
return new ui_context_ttls(*this);
}
void eap::ui_context_ttls::operator<<(_Inout_ cursor_out &cursor) const
{
ui_context::operator<<(cursor);

View File

@@ -43,7 +43,7 @@ public:
protected:
static wxCriticalSection s_lock; ///< Initialization lock
static unsigned long s_init_ref_count; ///< Initialization reference counter
static wxLocale s_locale; ///< Locale
static wxLocale *s_locale; ///< Locale
};
@@ -118,19 +118,27 @@ void eap::peer_ttls_ui::invoke_config_ui(
// Initialize application.
wxInitializerPeer init(m_instance);
{
wxWindow *parent;
if (hwndParent) {
// Create wxWidget-approved parent window.
wxWindow parent;
parent.SetHWND((WXHWND)(hwndParent ? hwndParent : GetForegroundWindow()));
parent.AdoptAttributesFromHWND();
wxTopLevelWindows.Append(&parent);
parent = new wxWindow;
parent->SetHWND((WXHWND)hwndParent);
parent->AdoptAttributesFromHWND();
wxTopLevelWindows.Append(parent);
} else
parent = NULL;
// Create and launch configuration dialog.
wxEAPConfigDialog<wxTTLSConfigWindow> dlg(cfg, &parent);
wxEAPConfigDialog<wxTTLSConfigWindow> dlg(cfg, parent);
if (!parent) {
FLASHWINFO fwi = { sizeof(FLASHWINFO), dlg.GetHWND(), FLASHW_ALL | FLASHW_TIMERNOFG };
::FlashWindowEx(&fwi);
}
result = dlg.ShowModal();
wxTopLevelWindows.DeleteObject(&parent);
parent.SetHWND((WXHWND)NULL);
if (parent) {
wxTopLevelWindows.DeleteObject(parent);
parent->SetHWND((WXHWND)NULL);
}
}
@@ -153,6 +161,9 @@ void eap::peer_ttls_ui::invoke_identity_ui(
_Out_ DWORD *pdwUserDataOutSize,
_Out_ LPWSTR *ppwszIdentity)
{
#ifdef _DEBUG
//::Sleep(10000);
#endif
assert(ppwszIdentity);
// Unpack configuration.
@@ -178,19 +189,26 @@ void eap::peer_ttls_ui::invoke_identity_ui(
// Initialize application.
wxInitializerPeer init(m_instance);
{
wxWindow *parent;
if (hwndParent) {
// Create wxWidget-approved parent window.
wxWindow parent;
parent.SetHWND((WXHWND)(hwndParent ? hwndParent : GetForegroundWindow()));
parent.AdoptAttributesFromHWND();
wxTopLevelWindows.Append(&parent);
parent = new wxWindow;
parent->SetHWND((WXHWND)hwndParent);
parent->AdoptAttributesFromHWND();
wxTopLevelWindows.Append(parent);
} else
parent = NULL;
if (cfg.m_providers.size() > 1) {
// Multiple identity providers: User has to select one first.
wxEAPProviderSelectDialog dlg(cfg, &parent);
wxEAPProviderSelectDialog dlg(cfg, parent);
// Centre and display dialog.
dlg.Centre(wxBOTH);
if (!parent) {
FLASHWINFO fwi = { sizeof(FLASHWINFO), dlg.GetHWND(), FLASHW_ALL | FLASHW_TIMERNOFG };
::FlashWindowEx(&fwi);
}
if ((result = dlg.ShowModal()) == wxID_OK) {
cfg_prov = dlg.GetSelection();
assert(cfg_prov);
@@ -240,7 +258,7 @@ void eap::peer_ttls_ui::invoke_identity_ui(
src_outer != eap::credentials::source_config && eap::config_method::status_cred_begin <= cfg_method->m_last_status && cfg_method->m_last_status < eap::config_method::status_cred_end)
{
// Build dialog to prompt for outer credentials.
wxEAPCredentialsDialog dlg(*cfg_prov, &parent);
wxEAPCredentialsDialog dlg(*cfg_prov, parent);
if (eap::config_method::status_cred_begin <= cfg_method->m_last_status && cfg_method->m_last_status < eap::config_method::status_cred_end)
dlg.AddContent(new wxEAPCredentialWarningPanel(*cfg_prov, cfg_method->m_last_status, &dlg));
auto panel = new wxTLSCredentialsPanel(*cfg_prov, *cfg_method, *cred, &dlg, false);
@@ -253,6 +271,10 @@ void eap::peer_ttls_ui::invoke_identity_ui(
// Centre and display dialog.
dlg.Centre(wxBOTH);
if (!parent) {
FLASHWINFO fwi = { sizeof(FLASHWINFO), dlg.GetHWND(), FLASHW_ALL | FLASHW_TIMERNOFG };
::FlashWindowEx(&fwi);
}
if ((result = dlg.ShowModal()) == wxID_OK) {
// Write credentials to credential manager.
if (panel->GetRemember()) {
@@ -290,7 +312,7 @@ void eap::peer_ttls_ui::invoke_identity_ui(
#endif
{
// Native inner methods. Build dialog to prompt for inner credentials.
wxEAPCredentialsDialog dlg(*cfg_prov, &parent);
wxEAPCredentialsDialog dlg(*cfg_prov, parent);
if (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)
dlg.AddContent(new wxEAPCredentialWarningPanel(*cfg_prov, cfg_method->m_inner->m_last_status, &dlg));
wxEAPCredentialsPanelBase *panel = NULL;
@@ -298,7 +320,18 @@ void eap::peer_ttls_ui::invoke_identity_ui(
case eap_type_legacy_pap : panel = new wxPAPCredentialsPanel (*cfg_prov, *dynamic_cast<const eap::config_method_pap *>(cfg_method->m_inner.get()), *dynamic_cast<eap::credentials_pass *>(cred->m_inner.get()), &dlg, false); break;
case eap_type_legacy_mschapv2: panel = new wxMSCHAPv2CredentialsPanel(*cfg_prov, *dynamic_cast<const eap::config_method_mschapv2 *>(cfg_method->m_inner.get()), *dynamic_cast<eap::credentials_pass *>(cred->m_inner.get()), &dlg, false); break;
case eap_type_mschapv2 : panel = new wxMSCHAPv2CredentialsPanel(*cfg_prov, *dynamic_cast<const eap::config_method_eapmschapv2*>(cfg_method->m_inner.get()), *dynamic_cast<eap::credentials_pass *>(cred->m_inner.get()), &dlg, false); break;
case eap_type_gtc : panel = new wxGTCCredentialsPanel (*cfg_prov, *dynamic_cast<const eap::config_method_eapgtc *>(cfg_method->m_inner.get()), *dynamic_cast<eap::credentials_identity*>(cred->m_inner.get()), &dlg, false); break;
case eap_type_gtc : {
// EAP-GTC credential prompt differes for "Challenge/Response" and "Password" authentication modes.
eap::credentials_identity *cred_resp;
eap::credentials_pass *cred_pass;
if ((cred_resp = dynamic_cast<eap::credentials_identity*>(cred->m_inner.get())) != NULL)
panel = new wxGTCResponseCredentialsPanel(*cfg_prov, *dynamic_cast<const eap::config_method_eapgtc*>(cfg_method->m_inner.get()), *cred_resp, &dlg, false);
else if ((cred_pass = dynamic_cast<eap::credentials_pass*>(cred->m_inner.get())) != NULL)
panel = new wxGTCPasswordCredentialsPanel(*cfg_prov, *dynamic_cast<const eap::config_method_eapgtc*>(cfg_method->m_inner.get()), *cred_pass, &dlg, false);
else
wxLogError("Unsupported authentication mode.");
break;
}
default : wxLogError("Unsupported inner authentication method.");
}
panel->SetRemember(src_inner == eap::credentials::source_storage);
@@ -310,6 +343,10 @@ void eap::peer_ttls_ui::invoke_identity_ui(
// Centre and display dialog.
dlg.Centre(wxBOTH);
if (!parent) {
FLASHWINFO fwi = { sizeof(FLASHWINFO), dlg.GetHWND(), FLASHW_ALL | FLASHW_TIMERNOFG };
::FlashWindowEx(&fwi);
}
if ((result = dlg.ShowModal()) == wxID_OK) {
// Write credentials to credential manager.
if (panel->GetRemember()) {
@@ -363,8 +400,9 @@ void eap::peer_ttls_ui::invoke_identity_ui(
}
}
wxTopLevelWindows.DeleteObject(&parent);
parent.SetHWND((WXHWND)NULL);
if (parent) {
wxTopLevelWindows.DeleteObject(parent);
parent->SetHWND((WXHWND)NULL);
}
}
@@ -393,7 +431,7 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
// Unpack context data.
config_connection cfg(*this);
credentials_connection cred(*this, cfg);
ui_context_ttls ctx(*this, cfg, cred);
ui_context_ttls ctx(cfg, cred);
unpack(ctx, pUIContextData, dwUIContextDataSize);
// Look-up the provider.
@@ -423,12 +461,15 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
// Initialize application.
wxInitializerPeer init(m_instance);
{
wxWindow *parent;
if (hwndParent) {
// Create wxWidget-approved parent window.
wxWindow parent;
parent.SetHWND((WXHWND)(hwndParent ? hwndParent : GetForegroundWindow()));
parent.AdoptAttributesFromHWND();
wxTopLevelWindows.Append(&parent);
parent = new wxWindow;
parent->SetHWND((WXHWND)hwndParent);
parent->AdoptAttributesFromHWND();
wxTopLevelWindows.Append(parent);
} else
parent = NULL;
{
sanitizing_wstring
@@ -436,7 +477,7 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
response;
// Build dialog to prompt for response.
wxGTCResponseDialog dlg(*cfg_prov, &parent);
wxGTCResponseDialog dlg(*cfg_prov, parent);
auto panel = new wxGTCResponsePanel(response, challenge.c_str(), &dlg);
dlg.AddContent(panel);
@@ -446,6 +487,10 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
// Centre and display dialog.
dlg.Centre(wxBOTH);
if (!parent) {
FLASHWINFO fwi = { sizeof(FLASHWINFO), dlg.GetHWND(), FLASHW_ALL | FLASHW_TIMERNOFG };
::FlashWindowEx(&fwi);
}
if ((result = dlg.ShowModal()) == wxID_OK) {
// Save response.
ctx.m_data.assign(
@@ -454,8 +499,9 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
}
}
wxTopLevelWindows.DeleteObject(&parent);
parent.SetHWND((WXHWND)NULL);
if (parent) {
wxTopLevelWindows.DeleteObject(parent);
parent->SetHWND((WXHWND)NULL);
}
}
@@ -512,9 +558,10 @@ wxInitializerPeer::wxInitializerPeer(_In_ HINSTANCE instance)
// Do our wxWidgets configuration and localization initialization.
wxInitializeConfig();
if (wxInitializeLocale(s_locale)) {
s_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion));
s_locale.AddCatalog(wxT("EAPTTLSUI"));
s_locale = new wxLocale;
if (wxInitializeLocale(*s_locale)) {
s_locale->AddCatalog(wxT("wxExtend") wxT(wxExtendVersion));
s_locale->AddCatalog(wxT("EAPTTLSUI"));
}
}
@@ -526,9 +573,14 @@ wxInitializerPeer::~wxInitializerPeer()
return;
wxEntryCleanup();
if (s_locale) {
delete s_locale;
s_locale = NULL;
}
}
wxCriticalSection wxInitializerPeer::s_lock;
unsigned long wxInitializerPeer::s_init_ref_count = 0;
wxLocale wxInitializerPeer::s_locale;
wxLocale *wxInitializerPeer::s_locale = NULL;