Compare commits

..

69 Commits

Author SHA1 Message Date
303a060f28 Version set to 1.0d 2017-05-22 09:19:51 +02:00
6264741a62 daea1bba62 reverted 2017-05-22 09:18:02 +02:00
28f5710e47 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
# Conflicts:
#	Makefile
2017-05-22 09:18:01 +02:00
cf6e3e7c25 MsiUseFeature() returning INSTALLSTATE_BROKEN is tolerated in non-elevated process now 2017-05-22 08:42:56 +02:00
a1485a78f6 WLANManager.exe now deployed as WLANManager-Win32.exe and WLANManager-x64.exe 2017-05-17 13:02:21 +02:00
06d39f0561 Sub-module update 2017-05-17 13:01:32 +02:00
0efe4d52c3 Secondary error message pop-up removed 2017-05-17 12:56:15 +02:00
5efadaa8c2 WLANManager support for multiple wireless interfaces 2017-05-17 12:56:14 +02:00
4937550746 Documentation update 2017-05-17 12:55:14 +02:00
4b5ffdf9a1 Indentation fix 2017-03-14 09:37:57 +01:00
ffa74466a4 Version set to 1.0c 2017-02-24 12:07:05 +01:00
f4e27d2151 Clean-up 2017-02-23 12:11:39 +01:00
7f20906cf7 Incorrect CoCreateInstance() result evaluation fixed
# Conflicts:
#	lib/WinStd
2017-02-23 11:12:39 +01:00
30b96082bd Debugging-related exception in WlanUIEditProfile() resolved 2017-02-23 11:11:53 +01:00
0abae8fe0e Locale is dynamic now, since wxLocale does not support re-initialization (when module is reused) 2017-02-22 09:45:26 +01:00
6df6eeaa0a New version of wxExtend 2017-02-20 10:58:38 +01:00
4ac3643ef7 Compilation of debug MSI files fixed 2017-02-20 10:07:00 +01:00
3fa838aba1 Documentation update 2017-02-13 07:59:34 +01:00
2557861065 64-bit language detection removed from 32-bit MSI resolving ICE80 warning 2017-02-09 13:42:08 +01:00
212e319011 Uninitialized enum higher bytes when reading as unsigned char fixed 2017-02-09 11:42:55 +01:00
e5acaee698 Version set to 1.0b 2017-02-06 08:12:54 +01:00
fe85347c31 Translation update 2017-02-06 07:59:53 +01:00
e0572524aa __DANGEROUS__LOG_CONFIDENTIAL_DATA is now 0/1 #defined 2017-02-02 14:01:12 +01:00
decf8d0860 EAP_USE_NATIVE_CREDENTIAL_CACHE is now 0/1 #defined 2017-02-02 13:34:43 +01:00
f5530b4ca9 Documentation update 2017-02-02 12:10:55 +01:00
9b174b7855 Simple BLOB encryption/decryption added & comment updates 2017-02-01 10:26:24 +01:00
33e5bc90a5 Missing namespace added 2017-02-01 10:14:05 +01:00
391fc796d7 Clean-up 2017-01-31 14:00:37 +01:00
946db58d3e EAP errors now correctly displayed in Event Viewer 2017-01-31 12:37:19 +01:00
d1a6d02e67 Incorrect RFC quote removed 2017-01-31 11:07:25 +01:00
d695ded8e7 Both event channels are registered using Makefile disabled now, to prevent Events.dll getting constantly locked by Event Log service.
# Conflicts:
#	Makefile
2017-01-31 10:43:58 +01:00
c4bc78cb47 "User ID" and "Password" labels vertically centered 2017-01-31 10:42:43 +01:00
3a7d26c68e EAP types look-up extended 2017-01-30 12:18:34 +01:00
9a71fe64c6 Documentation update 2016-12-13 11:27:53 +01:00
8d64acfab9 Event reporting extended to support event channel in Windows Event Viewer
# Conflicts:
#	Makefile
#	lib/Events/res/EventsETW.man
2016-12-09 13:41:28 +01:00
eab7def72e Event source in registry changed to match the one in manifest
# Conflicts:
#	Makefile
2016-12-09 13:32:24 +01:00
07dbb7618a Translation update 2016-12-07 14:05:24 +01:00
cc7bc07efe Missing credential identity tooltip reintroduced 2016-12-07 13:28:16 +01:00
4b7c697385 Identity read-only text box in credential selection configuration panel has been replaced by static text not to confuse users they can edit it there 2016-12-07 13:19:31 +01:00
8e81ece9e3 Some extra diagnostic output added when configuration XML contains unknown/unsupported method 2016-12-07 11:54:42 +01:00
5214afe17e Sub-module update 2016-12-06 11:13:25 +01:00
281c8a7119 eap::peer_ttls::end_session() fixed to call method's end_session() method 2016-12-05 13:17:38 +01:00
1162ccae3f New authentication status introduced: server compromised 2016-12-05 13:15:07 +01:00
4804214231 Distribution folder changed 2016-11-29 13:01:50 +01:00
130bab1391 Charset issue in version resource fixed 2016-11-18 09:13:28 +01:00
ba609ba469 Version set to 1.0a 2016-11-18 06:49:24 +01:00
6fef48848d Digital signing of CAB files introduced 2016-11-18 06:30:14 +01:00
bdc1ffd9f1 ...3.msi and ...3.mst files renamed to remove ".3" versioning in the name, to simplify their deployment 2016-11-18 06:30:14 +01:00
0ac18d6961 ...3.msi files are finalized now (marked as final, digitally signed, read-only), as they can be used for GPO deployment 2016-11-18 06:30:13 +01:00
09c08aa301 Makefile sub-target CleanSetup introduced 2016-11-18 06:30:13 +01:00
d95803c672 en_US MSI files prepared using MSILocal.mak now for more uniform building 2016-11-18 06:30:13 +01:00
9a74e982ab Translation update 2016-11-18 06:28:36 +01:00
c603008cd4 Distribution folder changed 2016-11-08 11:35:59 +01:00
51eb485440 Sub-module update 2016-11-08 11:35:43 +01:00
e75d31dd9b Version set to 1.0 2016-11-07 13:56:12 +01:00
0b4e4571b6 WideCharToMultiByte() and MultiByteToWideChar() optimization 2016-11-07 13:53:17 +01:00
435157955e Documentation update 2016-11-07 13:00:17 +01:00
f155b93ac2 POT update 2016-11-07 12:58:46 +01:00
0865318278 Documentation update 2016-11-07 12:57:41 +01:00
271e062be2 Auditing of CryptProtectData() enabled 2016-11-07 11:06:33 +01:00
ebe12e5157 Password and certificate output to log is no longer conditioned by _DEBUG 2016-11-07 10:59:28 +01:00
f197c0c937 Doxygen documentation update 2016-11-07 09:26:55 +01:00
29d5769060 Excessive .c_str() removed 2016-11-07 09:20:29 +01:00
0afbdadea7 EventMonitor Doxygen documentation update 2016-11-07 09:10:35 +01:00
cebcf7506e Redundant std::string to const char* conversion in exception constructors cleaned 2016-11-04 14:50:12 +01:00
3fb92a0c30 Version set to 1.0-beta8 2016-11-04 14:24:50 +01:00
0c5a145ad8 MSI localized files contain and install own resources only now 2016-11-04 14:05:34 +01:00
cc069d0442 Non-ready localizations deactivated 2016-11-04 14:05:33 +01:00
060aada133 Sub-module update 2016-11-04 13:58:10 +01:00
139 changed files with 6348 additions and 12465 deletions

View File

@@ -794,7 +794,6 @@ EXCLUDE = \
EventMonitor\res \
lib\EAPBase_UI\res \
lib\EapHost_UI\res \
lib\GTC_UI\res \
lib\TLS_UI\res \
lib\TTLS_UI\res \
lib\WinStd \

View File

@@ -97,15 +97,9 @@
<ProjectReference Include="..\..\lib\EAPBase\build\EAPBase.vcxproj">
<Project>{ad6816a0-9600-4e01-8c49-39d03d1e791f}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\EapHost\build\EapHost.vcxproj">
<Project>{b385ec2b-c3f4-48bb-9bac-8b996de7f754}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\Events\build\Events.vcxproj">
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\GTC\build\GTC.vcxproj">
<Project>{114a70bb-8698-4a0c-8c90-58f22edd8129}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\MSCHAPv2\build\MSCHAPv2.vcxproj">
<Project>{86a6d6a0-4b7d-4134-be81-a5755c77584d}</Project>
</ProjectReference>

View File

@@ -100,21 +100,9 @@
<ProjectReference Include="..\..\lib\EAPBase_UI\build\EAPBase_UI.vcxproj">
<Project>{d4b54856-be1f-4937-a8f7-495125be76be}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\EapHost\build\EapHost.vcxproj">
<Project>{b385ec2b-c3f4-48bb-9bac-8b996de7f754}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\EapHost_UI\build\EapHost_UI.vcxproj">
<Project>{13d2d8b5-f6aa-459d-b5f7-29b95dd9d583}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\Events\build\Events.vcxproj">
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\GTC\build\GTC.vcxproj">
<Project>{114a70bb-8698-4a0c-8c90-58f22edd8129}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\GTC_UI\build\GTC_UI.vcxproj">
<Project>{34680813-3a52-46fb-b5a8-1e4bbf770855}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\MSCHAPv2\build\MSCHAPv2.vcxproj">
<Project>{86a6d6a0-4b7d-4134-be81-a5755c77584d}</Project>
</ProjectReference>

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -439,7 +439,7 @@ msgid "Use my true user name"
msgstr ""
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:40
msgid "Use &empty outer identity"
msgid "Use &empty outer identity (RFC 4822)"
msgstr ""
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:41

View File

@@ -2,335 +2,217 @@
msgid ""
msgstr ""
"Project-Id-Version: EventMonitor\n"
"POT-Creation-Date: 2017-02-02 18:14+0100\n"
"POT-Creation-Date: 2016-09-19 11:14+0200\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.11\n"
"X-Poedit-Basepath: ../../..\n"
"X-Generator: Poedit 1.8.9\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: en_US\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: _\n"
"X-Poedit-SearchPath-0: master/EventMonitor\n"
"X-Poedit-SearchPath-1: ver1.1/EventMonitor\n"
"X-Poedit-SearchPath-2: ver1.0/EventMonitor\n"
"X-Poedit-SearchPath-0: .\n"
#: master/EventMonitor/App.cpp:61 ver1.0/EventMonitor/App.cpp:61
#: ver1.1/EventMonitor/App.cpp:61 master/EventMonitor/Frame.h:75
#: ver1.0/EventMonitor/Frame.h:75 ver1.1/EventMonitor/Frame.h:75
#: master/EventMonitor/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: App.cpp:61 Frame.h:67 MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: MSIBuild/en_US.x64.Release.Feature-2.idtx:4
msgid "Event Monitor"
msgstr ""
#: master/EventMonitor/ETWLog.cpp:83 ver1.0/EventMonitor/ETWLog.cpp:83
#: ver1.1/EventMonitor/ETWLog.cpp:83
#: ETWLog.cpp:83
#, c-format
msgid "Error opening event trace (error %u)."
msgstr ""
#: master/EventMonitor/ETWLog.cpp:171 ver1.0/EventMonitor/ETWLog.cpp:171
#: ver1.1/EventMonitor/ETWLog.cpp:171
#: ETWLog.cpp:167
msgid "Time"
msgstr ""
#: master/EventMonitor/ETWLog.cpp:172 ver1.0/EventMonitor/ETWLog.cpp:172
#: ver1.1/EventMonitor/ETWLog.cpp:172
#: ETWLog.cpp:168
msgid "PID"
msgstr ""
#: master/EventMonitor/ETWLog.cpp:173 ver1.0/EventMonitor/ETWLog.cpp:173
#: ver1.1/EventMonitor/ETWLog.cpp:173
#: ETWLog.cpp:169
msgid "TID"
msgstr ""
#: master/EventMonitor/ETWLog.cpp:174 ver1.0/EventMonitor/ETWLog.cpp:174
#: ver1.1/EventMonitor/ETWLog.cpp:174
#: ETWLog.cpp:170
msgid "Source"
msgstr ""
#: master/EventMonitor/ETWLog.cpp:175 ver1.0/EventMonitor/ETWLog.cpp:175
#: ver1.1/EventMonitor/ETWLog.cpp:175
#: ETWLog.cpp:171
msgid "Event"
msgstr ""
#: master/EventMonitor/ETWLog.cpp:232 ver1.0/EventMonitor/ETWLog.cpp:232
#: ver1.1/EventMonitor/ETWLog.cpp:232
#: ETWLog.cpp:228
msgid "Access denied creating event session: you need administrative privileges (Run As Administrator) or be a member of Performance Log Users group to start event tracing session."
msgstr ""
#: master/EventMonitor/ETWLog.cpp:235 ver1.0/EventMonitor/ETWLog.cpp:235
#: ver1.1/EventMonitor/ETWLog.cpp:235
#: ETWLog.cpp:231
#, c-format
msgid "The %s event session already exists."
msgstr ""
#: master/EventMonitor/ETWLog.cpp:239 ver1.0/EventMonitor/ETWLog.cpp:239
#: ver1.1/EventMonitor/ETWLog.cpp:239
#: ETWLog.cpp:235
#, c-format
msgid "Error creating event session (error %u)."
msgstr ""
#: master/EventMonitor/ETWLog.cpp:255 master/EventMonitor/ETWLog.cpp:271
#: master/EventMonitor/ETWLog.cpp:285 ver1.0/EventMonitor/ETWLog.cpp:255
#: ver1.0/EventMonitor/ETWLog.cpp:271 ver1.0/EventMonitor/ETWLog.cpp:285
#: ver1.1/EventMonitor/ETWLog.cpp:255 ver1.1/EventMonitor/ETWLog.cpp:271
#: ver1.1/EventMonitor/ETWLog.cpp:285
#: ETWLog.cpp:251 ETWLog.cpp:267 ETWLog.cpp:281
#, c-format
msgid "Error enabling %s event provider (error %u)."
msgstr ""
#: master/EventMonitor/Frame.cpp:48 master/EventMonitor/Frame.cpp:108
#: master/EventMonitor/Frame.cpp:113 master/EventMonitor/Frame.cpp:168
#: master/EventMonitor/Frame.cpp:170 ver1.0/EventMonitor/Frame.cpp:48
#: ver1.0/EventMonitor/Frame.cpp:108 ver1.0/EventMonitor/Frame.cpp:113
#: ver1.0/EventMonitor/Frame.cpp:168 ver1.0/EventMonitor/Frame.cpp:170
#: ver1.1/EventMonitor/Frame.cpp:48 ver1.1/EventMonitor/Frame.cpp:108
#: ver1.1/EventMonitor/Frame.cpp:113 ver1.1/EventMonitor/Frame.cpp:168
#: ver1.1/EventMonitor/Frame.cpp:170
#: Frame.cpp:48 Frame.cpp:108 Frame.cpp:113 Frame.cpp:168 Frame.cpp:170
#, c-format
msgid "Toggles display of %s records"
msgstr ""
#: master/EventMonitor/Frame.cpp:65 ver1.0/EventMonitor/Frame.cpp:65
#: ver1.1/EventMonitor/Frame.cpp:65
#: Frame.cpp:65
msgid "E&xit"
msgstr ""
#: master/EventMonitor/Frame.cpp:65 ver1.0/EventMonitor/Frame.cpp:65
#: ver1.1/EventMonitor/Frame.cpp:65
#: Frame.cpp:65
msgid "Quits this program"
msgstr ""
#: master/EventMonitor/Frame.cpp:69 ver1.0/EventMonitor/Frame.cpp:69
#: ver1.1/EventMonitor/Frame.cpp:69
#: Frame.cpp:69
msgid "&Program"
msgstr ""
#: master/EventMonitor/Frame.cpp:73 ver1.0/EventMonitor/Frame.cpp:73
#: ver1.1/EventMonitor/Frame.cpp:73
#: Frame.cpp:73
msgid "&Copy"
msgstr ""
#: master/EventMonitor/Frame.cpp:73 master/EventMonitor/Frame.cpp:154
#: ver1.0/EventMonitor/Frame.cpp:73 ver1.0/EventMonitor/Frame.cpp:154
#: ver1.1/EventMonitor/Frame.cpp:73 ver1.1/EventMonitor/Frame.cpp:154
#: Frame.cpp:73 Frame.cpp:154
msgid "Copies selected records to clipboard"
msgstr ""
#: master/EventMonitor/Frame.cpp:78 ver1.0/EventMonitor/Frame.cpp:78
#: ver1.1/EventMonitor/Frame.cpp:78
#: Frame.cpp:78
msgid "Copy A&ll"
msgstr ""
#: master/EventMonitor/Frame.cpp:78 master/EventMonitor/Frame.cpp:156
#: ver1.0/EventMonitor/Frame.cpp:78 ver1.0/EventMonitor/Frame.cpp:156
#: ver1.1/EventMonitor/Frame.cpp:78 ver1.1/EventMonitor/Frame.cpp:156
#: Frame.cpp:78 Frame.cpp:156
msgid "Copies all records to clipboard (including hidden)"
msgstr ""
#: master/EventMonitor/Frame.cpp:83 master/EventMonitor/Frame.cpp:158
#: ver1.0/EventMonitor/Frame.cpp:83 ver1.0/EventMonitor/Frame.cpp:158
#: ver1.1/EventMonitor/Frame.cpp:83 ver1.1/EventMonitor/Frame.cpp:158
#: Frame.cpp:83 Frame.cpp:158
msgid "Clear"
msgstr ""
#: master/EventMonitor/Frame.cpp:83 master/EventMonitor/Frame.cpp:158
#: ver1.0/EventMonitor/Frame.cpp:83 ver1.0/EventMonitor/Frame.cpp:158
#: ver1.1/EventMonitor/Frame.cpp:83 ver1.1/EventMonitor/Frame.cpp:158
#: Frame.cpp:83 Frame.cpp:158
msgid "Clears all records from the log"
msgstr ""
#: master/EventMonitor/Frame.cpp:90 ver1.0/EventMonitor/Frame.cpp:90
#: ver1.1/EventMonitor/Frame.cpp:90
#: Frame.cpp:90
msgid "Select &All"
msgstr ""
#: master/EventMonitor/Frame.cpp:90 ver1.0/EventMonitor/Frame.cpp:90
#: ver1.1/EventMonitor/Frame.cpp:90
#: Frame.cpp:90
msgid "Selects all visible records"
msgstr ""
#: master/EventMonitor/Frame.cpp:94 ver1.0/EventMonitor/Frame.cpp:94
#: ver1.1/EventMonitor/Frame.cpp:94
#: Frame.cpp:94
msgid "Select &None"
msgstr ""
#: master/EventMonitor/Frame.cpp:94 ver1.0/EventMonitor/Frame.cpp:94
#: ver1.1/EventMonitor/Frame.cpp:94
#: Frame.cpp:94
msgid "Clears record selection"
msgstr ""
#: master/EventMonitor/Frame.cpp:97 master/EventMonitor/Frame.cpp:142
#: ver1.0/EventMonitor/Frame.cpp:97 ver1.0/EventMonitor/Frame.cpp:142
#: ver1.1/EventMonitor/Frame.cpp:97 ver1.1/EventMonitor/Frame.cpp:142
#: Frame.cpp:97 Frame.cpp:142
msgid "&Edit"
msgstr ""
#: master/EventMonitor/Frame.cpp:101 ver1.0/EventMonitor/Frame.cpp:101
#: ver1.1/EventMonitor/Frame.cpp:101
#: Frame.cpp:101
msgid "Auto &Scroll"
msgstr ""
#: master/EventMonitor/Frame.cpp:101 master/EventMonitor/Frame.cpp:164
#: ver1.0/EventMonitor/Frame.cpp:101 ver1.0/EventMonitor/Frame.cpp:164
#: ver1.1/EventMonitor/Frame.cpp:101 ver1.1/EventMonitor/Frame.cpp:164
#: Frame.cpp:101 Frame.cpp:164
msgid "Automatically scrolls to the most recent records as they come-in"
msgstr ""
#: master/EventMonitor/Frame.cpp:123 master/EventMonitor/Frame.cpp:176
#: ver1.0/EventMonitor/Frame.cpp:123 ver1.0/EventMonitor/Frame.cpp:176
#: ver1.1/EventMonitor/Frame.cpp:123 ver1.1/EventMonitor/Frame.cpp:176
#: Frame.cpp:123 Frame.cpp:176
msgid "Verbose"
msgstr ""
#: master/EventMonitor/Frame.cpp:123 master/EventMonitor/Frame.cpp:176
#: ver1.0/EventMonitor/Frame.cpp:123 ver1.0/EventMonitor/Frame.cpp:176
#: ver1.1/EventMonitor/Frame.cpp:123 ver1.1/EventMonitor/Frame.cpp:176
#: Frame.cpp:123 Frame.cpp:176
msgid "Displays all levels of records"
msgstr ""
#: master/EventMonitor/Frame.cpp:127 master/EventMonitor/Frame.cpp:178
#: ver1.0/EventMonitor/Frame.cpp:127 ver1.0/EventMonitor/Frame.cpp:178
#: ver1.1/EventMonitor/Frame.cpp:127 ver1.1/EventMonitor/Frame.cpp:178
#: Frame.cpp:127 Frame.cpp:178
msgid "Informational"
msgstr ""
#: master/EventMonitor/Frame.cpp:127 master/EventMonitor/Frame.cpp:178
#: ver1.0/EventMonitor/Frame.cpp:127 ver1.0/EventMonitor/Frame.cpp:178
#: ver1.1/EventMonitor/Frame.cpp:127 ver1.1/EventMonitor/Frame.cpp:178
#: Frame.cpp:127 Frame.cpp:178
msgid "Displays all records up to informational level"
msgstr ""
#: master/EventMonitor/Frame.cpp:131 master/EventMonitor/Frame.cpp:180
#: ver1.0/EventMonitor/Frame.cpp:131 ver1.0/EventMonitor/Frame.cpp:180
#: ver1.1/EventMonitor/Frame.cpp:131 ver1.1/EventMonitor/Frame.cpp:180
#: Frame.cpp:131 Frame.cpp:180
msgid "Warning"
msgstr ""
#: master/EventMonitor/Frame.cpp:131 master/EventMonitor/Frame.cpp:180
#: ver1.0/EventMonitor/Frame.cpp:131 ver1.0/EventMonitor/Frame.cpp:180
#: ver1.1/EventMonitor/Frame.cpp:131 ver1.1/EventMonitor/Frame.cpp:180
#: Frame.cpp:131 Frame.cpp:180
msgid "Displays all records up to warning level"
msgstr ""
#: master/EventMonitor/Frame.cpp:135 master/EventMonitor/Frame.cpp:182
#: ver1.0/EventMonitor/Frame.cpp:135 ver1.0/EventMonitor/Frame.cpp:182
#: ver1.1/EventMonitor/Frame.cpp:135 ver1.1/EventMonitor/Frame.cpp:182
#: Frame.cpp:135 Frame.cpp:182
msgid "Error"
msgstr ""
#: master/EventMonitor/Frame.cpp:135 master/EventMonitor/Frame.cpp:182
#: ver1.0/EventMonitor/Frame.cpp:135 ver1.0/EventMonitor/Frame.cpp:182
#: ver1.1/EventMonitor/Frame.cpp:135 ver1.1/EventMonitor/Frame.cpp:182
#: Frame.cpp:135 Frame.cpp:182
msgid "Displays error level records only"
msgstr ""
#: master/EventMonitor/Frame.cpp:142 master/EventMonitor/Frame.cpp:146
#: ver1.0/EventMonitor/Frame.cpp:142 ver1.0/EventMonitor/Frame.cpp:146
#: ver1.1/EventMonitor/Frame.cpp:142 ver1.1/EventMonitor/Frame.cpp:146
#: Frame.cpp:142 Frame.cpp:146
#, c-format
msgid "%s toolbar"
msgstr ""
#: master/EventMonitor/Frame.cpp:142 master/EventMonitor/Frame.cpp:146
#: ver1.0/EventMonitor/Frame.cpp:142 ver1.0/EventMonitor/Frame.cpp:146
#: ver1.1/EventMonitor/Frame.cpp:142 ver1.1/EventMonitor/Frame.cpp:146
#: Frame.cpp:142 Frame.cpp:146
#, c-format
msgid "Toggles display of %s toolbar"
msgstr ""
#: master/EventMonitor/Frame.cpp:142 master/EventMonitor/Frame.cpp:146
#: master/EventMonitor/Frame.cpp:185 ver1.0/EventMonitor/Frame.cpp:142
#: ver1.0/EventMonitor/Frame.cpp:146 ver1.0/EventMonitor/Frame.cpp:185
#: ver1.1/EventMonitor/Frame.cpp:142 ver1.1/EventMonitor/Frame.cpp:146
#: ver1.1/EventMonitor/Frame.cpp:185
#: Frame.cpp:142 Frame.cpp:146 Frame.cpp:185
msgid "View"
msgstr ""
#: master/EventMonitor/Frame.cpp:146 master/EventMonitor/Frame.cpp:149
#: ver1.0/EventMonitor/Frame.cpp:146 ver1.0/EventMonitor/Frame.cpp:149
#: ver1.1/EventMonitor/Frame.cpp:146 ver1.1/EventMonitor/Frame.cpp:149
#: Frame.cpp:146 Frame.cpp:149
msgid "&View"
msgstr ""
#: master/EventMonitor/Frame.cpp:154 ver1.0/EventMonitor/Frame.cpp:154
#: ver1.1/EventMonitor/Frame.cpp:154
#: Frame.cpp:154
msgid "Copy"
msgstr ""
#: master/EventMonitor/Frame.cpp:156 ver1.0/EventMonitor/Frame.cpp:156
#: ver1.1/EventMonitor/Frame.cpp:156
#: Frame.cpp:156
msgid "Copy All"
msgstr ""
#: master/EventMonitor/Frame.cpp:161 ver1.0/EventMonitor/Frame.cpp:161
#: ver1.1/EventMonitor/Frame.cpp:161
#: Frame.cpp:161
msgid "Edit"
msgstr ""
#: master/EventMonitor/Frame.cpp:164 ver1.0/EventMonitor/Frame.cpp:164
#: ver1.1/EventMonitor/Frame.cpp:164
#: Frame.cpp:164
msgid "Auto Scroll"
msgstr ""
#: master/EventMonitor/Frame.cpp:189 ver1.0/EventMonitor/Frame.cpp:189
#: ver1.1/EventMonitor/Frame.cpp:189
#: Frame.cpp:189
msgid "Trace Log"
msgstr ""
#: master/EventMonitor/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.Win32.Debug.Shortcut-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.Win32.Release.Shortcut-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.x64.Debug.Shortcut-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.x64.Release.Shortcut-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.Win32.Debug.Shortcut-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.Win32.Release.Shortcut-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.x64.Debug.Shortcut-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.x64.Release.Shortcut-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.Win32.Debug.Shortcut-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.Win32.Release.Shortcut-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.x64.Debug.Feature-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.x64.Debug.Shortcut-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.x64.Release.Shortcut-2.idtx:4
#: MSIBuild/en_US.Win32.Release.Feature-2.idtx:4
#: MSIBuild/en_US.Win32.Release.Shortcut-2.idtx:4
#: MSIBuild/en_US.x64.Release.Feature-2.idtx:4
#: MSIBuild/en_US.x64.Release.Shortcut-2.idtx:4
msgid "Real-time display of internal events"
msgstr ""
#: master/EventMonitor/MSIBuild/en_US.Win32.Debug.Shortcut-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.Win32.Release.Shortcut-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.x64.Debug.Shortcut-2.idtx:4
#: master/EventMonitor/MSIBuild/en_US.x64.Release.Shortcut-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.Win32.Debug.Shortcut-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.Win32.Release.Shortcut-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.x64.Debug.Shortcut-2.idtx:4
#: ver1.0/EventMonitor/MSIBuild/en_US.x64.Release.Shortcut-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.Win32.Debug.Shortcut-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.Win32.Release.Shortcut-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.x64.Debug.Shortcut-2.idtx:4
#: ver1.1/EventMonitor/MSIBuild/en_US.x64.Release.Shortcut-2.idtx:4
#: MSIBuild/en_US.Win32.Release.Shortcut-2.idtx:4
#: MSIBuild/en_US.x64.Release.Shortcut-2.idtx:4
msgid "EVENTM~1|GÉANTLink Event Monitor"
msgstr ""

View File

@@ -2,76 +2,31 @@
msgid ""
msgstr ""
"Project-Id-Version: GÉANTLink MSI\n"
"POT-Creation-Date: 2017-02-02 18:14+0100\n"
"POT-Creation-Date: 2016-09-19 11:20+0200\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.11\n"
"X-Poedit-Basepath: ../../../..\n"
"X-Generator: Poedit 1.8.9\n"
"X-Poedit-Basepath: ../Main\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: en_US\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: _\n"
"X-Poedit-SearchPath-0: master/MSI/Base/Main\n"
"X-Poedit-SearchPath-1: ver1.1/MSI/Base/Main\n"
"X-Poedit-SearchPath-2: ver1.0/MSI/Base/Main\n"
"X-Poedit-SearchPath-0: .\n"
#: master/MSI/Base/Main/en_US.Win32.Debug.LaunchCondition-2.idtx:4
#: master/MSI/Base/Main/en_US.Win32.Release.LaunchCondition-2.idtx:4
#: master/MSI/Base/Main/en_US.x64.Debug.LaunchCondition-2.idtx:4
#: master/MSI/Base/Main/en_US.x64.Release.LaunchCondition-2.idtx:4
#: ver1.0/MSI/Base/Main/en_US.Win32.Debug.LaunchCondition-2.idtx:4
#: ver1.0/MSI/Base/Main/en_US.Win32.Release.LaunchCondition-2.idtx:4
#: ver1.0/MSI/Base/Main/en_US.x64.Debug.LaunchCondition-2.idtx:4
#: ver1.0/MSI/Base/Main/en_US.x64.Release.LaunchCondition-2.idtx:4
#: ver1.1/MSI/Base/Main/en_US.Win32.Debug.LaunchCondition-2.idtx:4
#: ver1.1/MSI/Base/Main/en_US.Win32.Release.LaunchCondition-2.idtx:4
#: ver1.1/MSI/Base/Main/en_US.x64.Debug.LaunchCondition-2.idtx:4
#: ver1.1/MSI/Base/Main/en_US.x64.Release.LaunchCondition-2.idtx:4
#: en_US.Win32.Release.LaunchCondition-2.idtx:4
#: en_US.x64.Release.LaunchCondition-2.idtx:4
msgid "[ProductName] requires Windows Vista or later version of Windows."
msgstr ""
#: master/MSI/Base/Main/en_US.Win32.Debug.Property-2.idtx:4
#: master/MSI/Base/Main/en_US.Win32.Debug.Property-2.idtx:5
#: master/MSI/Base/Main/en_US.Win32.Release.Property-2.idtx:4
#: master/MSI/Base/Main/en_US.Win32.Release.Property-2.idtx:5
#: master/MSI/Base/Main/en_US.x64.Debug.Property-2.idtx:4
#: master/MSI/Base/Main/en_US.x64.Debug.Property-2.idtx:5
#: master/MSI/Base/Main/en_US.x64.Release.Property-2.idtx:4
#: master/MSI/Base/Main/en_US.x64.Release.Property-2.idtx:5
#: ver1.0/MSI/Base/Main/en_US.Win32.Debug.Property-2.idtx:4
#: ver1.0/MSI/Base/Main/en_US.Win32.Debug.Property-2.idtx:5
#: ver1.0/MSI/Base/Main/en_US.Win32.Release.Property-2.idtx:4
#: ver1.0/MSI/Base/Main/en_US.Win32.Release.Property-2.idtx:5
#: ver1.0/MSI/Base/Main/en_US.x64.Debug.Property-2.idtx:4
#: ver1.0/MSI/Base/Main/en_US.x64.Debug.Property-2.idtx:5
#: ver1.0/MSI/Base/Main/en_US.x64.Release.Property-2.idtx:4
#: ver1.0/MSI/Base/Main/en_US.x64.Release.Property-2.idtx:5
#: ver1.1/MSI/Base/Main/en_US.Win32.Debug.Property-2.idtx:4
#: ver1.1/MSI/Base/Main/en_US.Win32.Debug.Property-2.idtx:5
#: ver1.1/MSI/Base/Main/en_US.Win32.Release.Property-2.idtx:4
#: ver1.1/MSI/Base/Main/en_US.Win32.Release.Property-2.idtx:5
#: ver1.1/MSI/Base/Main/en_US.x64.Debug.Property-2.idtx:4
#: ver1.1/MSI/Base/Main/en_US.x64.Debug.Property-2.idtx:5
#: ver1.1/MSI/Base/Main/en_US.x64.Release.Property-2.idtx:4
#: ver1.1/MSI/Base/Main/en_US.x64.Release.Property-2.idtx:5
#: en_US.Win32.Release.Property-2.idtx:4 en_US.Win32.Release.Property-2.idtx:5
#: en_US.x64.Release.Property-2.idtx:4 en_US.x64.Release.Property-2.idtx:5
msgid "http://www.geant.org/"
msgstr ""
#: master/MSI/Base/Main/en_US.Win32.Debug.Property-2.idtx:6
#: master/MSI/Base/Main/en_US.Win32.Release.Property-2.idtx:6
#: master/MSI/Base/Main/en_US.x64.Debug.Property-2.idtx:6
#: master/MSI/Base/Main/en_US.x64.Release.Property-2.idtx:6
#: ver1.0/MSI/Base/Main/en_US.Win32.Debug.Property-2.idtx:6
#: ver1.0/MSI/Base/Main/en_US.Win32.Release.Property-2.idtx:6
#: ver1.0/MSI/Base/Main/en_US.x64.Debug.Property-2.idtx:6
#: ver1.0/MSI/Base/Main/en_US.x64.Release.Property-2.idtx:6
#: ver1.1/MSI/Base/Main/en_US.Win32.Debug.Property-2.idtx:6
#: ver1.1/MSI/Base/Main/en_US.Win32.Release.Property-2.idtx:6
#: ver1.1/MSI/Base/Main/en_US.x64.Debug.Property-2.idtx:6
#: ver1.1/MSI/Base/Main/en_US.x64.Release.Property-2.idtx:6
#: en_US.Win32.Release.Property-2.idtx:6 en_US.x64.Release.Property-2.idtx:6
msgid "https://github.com/Amebis/GEANTLink/releases"
msgstr ""

BIN
Makefile

Binary file not shown.

View File

@@ -1,25 +1,23 @@
# 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: 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
- Configurable list of accepted server names
- Post-authentication CRL check
### Diagnostics
- Reporting to Event Log channels: Operational and Analytic verbosity
@@ -30,10 +28,14 @@ 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
- [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
- Released as multi-lingual 32 and 64-bit MSI packages; Group Policy deployment supported
- [MsiUseFeature utility](https://github.com/Amebis/GEANTLink/tree/ver1.0/MsiUseFeature) for GÉANTLink install state testing (for embedding GÉANTLink into other setup packages)
- [CredWrite utility](https://github.com/Amebis/GEANTLink/tree/ver1.0/CredWrite) for automated user credential import to Credential Manager
- [WLANManager utility](https://github.com/Amebis/GEANTLink/tree/ver1.0/WLANManager) to allow network profile configuration dialog shortcuts
### Supported operating systems
- Windows Vista, Windows Server 2008
- Windows 7, Windows Server 2008 R2
## Download
Binaries are available for download [here](https://github.com/Amebis/GEANTLink/releases).

View File

@@ -51,14 +51,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSCHAPv2", "lib\MSCHAPv2\bu
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSCHAPv2_UI", "lib\MSCHAPv2_UI\build\MSCHAPv2_UI.vcxproj", "{7AF5B922-7C17-428A-97E0-09E3B41A684D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EapHost", "lib\EapHost\build\EapHost.vcxproj", "{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EapHost_UI", "lib\EapHost_UI\build\EapHost_UI.vcxproj", "{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GTC", "lib\GTC\build\GTC.vcxproj", "{114A70BB-8698-4A0C-8C90-58F22EDD8129}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GTC_UI", "lib\GTC_UI\build\GTC_UI.vcxproj", "{34680813-3A52-46FB-B5A8-1E4BBF770855}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -219,38 +211,6 @@ Global
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Release|Win32.Build.0 = Release|Win32
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Release|x64.ActiveCfg = Release|x64
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Release|x64.Build.0 = Release|x64
{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}.Debug|Win32.ActiveCfg = Debug|Win32
{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}.Debug|Win32.Build.0 = Debug|Win32
{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}.Debug|x64.ActiveCfg = Debug|x64
{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}.Debug|x64.Build.0 = Debug|x64
{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}.Release|Win32.ActiveCfg = Release|Win32
{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}.Release|Win32.Build.0 = Release|Win32
{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}.Release|x64.ActiveCfg = Release|x64
{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}.Release|x64.Build.0 = Release|x64
{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}.Debug|Win32.ActiveCfg = Debug|Win32
{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}.Debug|Win32.Build.0 = Debug|Win32
{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}.Debug|x64.ActiveCfg = Debug|x64
{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}.Debug|x64.Build.0 = Debug|x64
{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}.Release|Win32.ActiveCfg = Release|Win32
{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}.Release|Win32.Build.0 = Release|Win32
{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}.Release|x64.ActiveCfg = Release|x64
{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}.Release|x64.Build.0 = Release|x64
{114A70BB-8698-4A0C-8C90-58F22EDD8129}.Debug|Win32.ActiveCfg = Debug|Win32
{114A70BB-8698-4A0C-8C90-58F22EDD8129}.Debug|Win32.Build.0 = Debug|Win32
{114A70BB-8698-4A0C-8C90-58F22EDD8129}.Debug|x64.ActiveCfg = Debug|x64
{114A70BB-8698-4A0C-8C90-58F22EDD8129}.Debug|x64.Build.0 = Debug|x64
{114A70BB-8698-4A0C-8C90-58F22EDD8129}.Release|Win32.ActiveCfg = Release|Win32
{114A70BB-8698-4A0C-8C90-58F22EDD8129}.Release|Win32.Build.0 = Release|Win32
{114A70BB-8698-4A0C-8C90-58F22EDD8129}.Release|x64.ActiveCfg = Release|x64
{114A70BB-8698-4A0C-8C90-58F22EDD8129}.Release|x64.Build.0 = Release|x64
{34680813-3A52-46FB-B5A8-1E4BBF770855}.Debug|Win32.ActiveCfg = Debug|Win32
{34680813-3A52-46FB-B5A8-1E4BBF770855}.Debug|Win32.Build.0 = Debug|Win32
{34680813-3A52-46FB-B5A8-1E4BBF770855}.Debug|x64.ActiveCfg = Debug|x64
{34680813-3A52-46FB-B5A8-1E4BBF770855}.Debug|x64.Build.0 = Debug|x64
{34680813-3A52-46FB-B5A8-1E4BBF770855}.Release|Win32.ActiveCfg = Release|Win32
{34680813-3A52-46FB-B5A8-1E4BBF770855}.Release|Win32.Build.0 = Release|Win32
{34680813-3A52-46FB-B5A8-1E4BBF770855}.Release|x64.ActiveCfg = Release|x64
{34680813-3A52-46FB-B5A8-1E4BBF770855}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -271,10 +231,6 @@ Global
{D3E29951-D9F5-486D-A167-20AE8E90B1FA} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
{86A6D6A0-4B7D-4134-BE81-A5755C77584D} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
{7AF5B922-7C17-428A-97E0-09E3B41A684D} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
{114A70BB-8698-4A0C-8C90-58F22EDD8129} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
{34680813-3A52-46FB-B5A8-1E4BBF770855} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
{2D3CE079-7EB1-4F47-B79E-F0310671ECCB} = {7B5EC9B7-208C-426A-941D-DAF9271BD4A4}
{679D03C5-CD70-4FFA-93F8-A4AB3637509B} = {7B5EC9B7-208C-426A-941D-DAF9271BD4A4}
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2} = {7B5EC9B7-208C-426A-941D-DAF9271BD4A4}

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,20 +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.
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());
@@ -107,6 +146,9 @@ static int WLANManager()
break;
}
if (!profile_found)
DisplayError(_T("%ls profile not found."), pwcArglist[2]);
return 0;
}

View File

@@ -3,7 +3,7 @@ Invokes standard Windows Wireless Network Properties dialog
##Usage
```
WLANManager profile <name>
WLANManager profile <name> [interface <name>]
```
- `name` - The name of the network profile (not neccessarely the same as SSID)

View File

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

View File

@@ -2,22 +2,20 @@
msgid ""
msgstr ""
"Project-Id-Version: WLANManager\n"
"POT-Creation-Date: 2016-11-08 11:51+0100\n"
"POT-Creation-Date: 2016-09-19 11:22+0200\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.11\n"
"X-Poedit-Basepath: ../../..\n"
"X-Generator: Poedit 1.8.9\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: en_US\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: _\n"
"X-Poedit-SearchPath-0: master/WLANManager\n"
"X-Poedit-SearchPath-1: ver1.1/WLANManager\n"
"X-Poedit-SearchPath-2: ver1.0/WLANManager\n"
"X-Poedit-SearchPath-0: .\n"
#: MSIBuild/en_US.Win32.Debug.Feature-2.idtx:4
#: MSIBuild/en_US.Win32.Release.Feature-2.idtx:4

View File

@@ -29,7 +29,7 @@
// Product version as a single DWORD
// Note: Used for version comparison within C/C++ code.
//
#define PRODUCT_VERSION 0x01020300
#define PRODUCT_VERSION 0x01001f00
//
// Product version by components
@@ -38,27 +38,27 @@
// separately.
//
#define PRODUCT_VERSION_MAJ 1
#define PRODUCT_VERSION_MIN 2
#define PRODUCT_VERSION_REV 3
#define PRODUCT_VERSION_MIN 0
#define PRODUCT_VERSION_REV 31
#define PRODUCT_VERSION_BUILD 0
//
// Human readable product version and build year for UI
//
#define PRODUCT_VERSION_STR "1.2-beta2"
#define PRODUCT_BUILD_YEAR_STR "2016"
#define PRODUCT_VERSION_STR "1.0d"
#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.3"
#define PRODUCT_VERSION_INST "1.0.31"
//
// 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 "{4C8DDB7D-3297-4B6A-ACF3-19702F85DE49}"
#define PRODUCT_VERSION_GUID "{930DA0D6-428F-4E9B-9969-0DEE33F1D958}"
//
// Product vendor

View File

@@ -85,7 +85,6 @@
<ClInclude Include="..\include\EAPXML.h" />
<ClInclude Include="..\include\Method.h" />
<ClInclude Include="..\include\Module.h" />
<ClInclude Include="..\include\UIContext.h" />
<ClInclude Include="..\src\StdAfx.h" />
</ItemGroup>
<ItemGroup>
@@ -100,7 +99,6 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\UIContext.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Events\build\Events.vcxproj">

View File

@@ -32,9 +32,6 @@
<ClInclude Include="..\include\Credentials.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\UIContext.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\StdAfx.cpp">
@@ -55,8 +52,5 @@
<ClCompile Include="..\src\EAP.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\UIContext.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -24,13 +24,57 @@
namespace eap
{
///
/// Base class for configuration storage
///
class config;
///
/// Base class for method configuration storage
///
class config_method;
///
/// Base class for method with credentials
///
class config_method_with_cred;
///
/// Provider configuration storage
///
class config_provider;
///
/// Connection configuration storage
///
class config_connection;
}
///
/// 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(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"
@@ -52,16 +96,7 @@ namespace eap
namespace eap
{
///
/// \defgroup EAPBaseConfig Configuration
/// Configuration management
///
/// @{
///
/// Base class for packable and XML-exportable storage
///
class config : public packable
class config
{
public:
///
@@ -104,17 +139,17 @@ namespace eap
config& operator=(_Inout_ config &&other);
///
/// Clones this object
/// Clones this configuration
///
/// \returns Pointer to cloned object with identical data
/// \returns Pointer to cloned configuration
///
virtual config* clone() const = 0;
/// \name XML management
/// \name XML configuration management
/// @{
///
/// Save data to XML document
/// Save to XML document
///
/// \param[in] pDoc XML document
/// \param[in] pConfigRoot Suggested root element for saving
@@ -130,20 +165,40 @@ namespace eap
/// @}
/// \name BLOB management
/// @{
///
/// Packs a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of a configuration
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
public:
module &m_module; ///< EAP module
protected:
static const winstd::bstr namespace_eapmetadata; ///< Reusable BSTR containing "urn:ietf:params:xml:ns:yang:ietf-eap-metadata"
static const winstd::bstr namespace_eapmetadata;
};
class credentials;
///
/// Base class for method configuration storage
///
class config_method : public config
{
public:
@@ -207,17 +262,50 @@ namespace eap
///
config_method& operator=(_Inout_ config_method &&other);
/// \name XML management
/// \name XML configuration management
/// @{
///
/// Save to XML document
///
/// \param[in] pDoc XML document
/// \param[in] pConfigRoot Suggested root element for saving
///
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
///
/// Load from XML document
///
/// \param[in] pConfigRoot Root element for loading
///
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name BLOB management
/// @{
///
/// Packs a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of a configuration
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
///
@@ -232,11 +320,6 @@ namespace eap
///
virtual const wchar_t* get_method_str() const = 0;
///
/// Creates a blank set of credentials suitable for this method
///
virtual credentials* make_credentials() const = 0;
public:
const unsigned int m_level; ///< Config level (0=outer, 1=inner, 2=inner-inner...)
bool m_allow_save; ///< Are credentials allowed to be saved to Windows Credential Manager?
@@ -245,9 +328,9 @@ namespace eap
};
///
/// Base class for method with credentials
///
class credentials;
class config_method_with_cred : public config_method
{
public:
@@ -291,28 +374,63 @@ namespace eap
///
config_method_with_cred& operator=(_Inout_ config_method_with_cred &&other);
/// \name XML management
/// \name XML configuration management
/// @{
///
/// Save to XML document
///
/// \param[in] pDoc XML document
/// \param[in] pConfigRoot Suggested root element for saving
///
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
///
/// Load from XML document
///
/// \param[in] pConfigRoot Root element for loading
///
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name BLOB management
/// @{
///
/// Packs a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of a configuration
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
///
/// Creates a blank set of credentials suitable for this method
///
virtual credentials* make_credentials() const = 0;
public:
bool m_use_cred; ///< Use configured credentials
std::unique_ptr<credentials> m_cred; ///< Configured credentials
};
///
/// Provider configuration storage
///
class config_provider : public config
{
public:
@@ -355,19 +473,57 @@ namespace eap
///
config_provider& operator=(_Inout_ config_provider &&other);
///
/// Clones configuration
///
/// \returns Pointer to cloned configuration
///
virtual config* clone() const;
/// \name XML management
/// \name XML configuration management
/// @{
///
/// Save to XML document
///
/// \param[in] pDoc XML document
/// \param[in] pConfigRoot Suggested root element for saving
///
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
///
/// Load from XML document
///
/// \param[in] pConfigRoot Root element for loading
///
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name BLOB management
/// @{
///
/// Packs a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of a configuration
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
///
@@ -400,16 +556,10 @@ namespace eap
};
///
/// Connection configuration storage
///
class config_connection : public config
{
public:
///
/// List of configuration providers
///
typedef std::list<config_provider> provider_list;
typedef std::list<eap::config_provider> provider_list;
public:
///
@@ -451,67 +601,97 @@ namespace eap
///
config_connection& operator=(_Inout_ config_connection &&other);
///
/// Clones configuration
///
/// \returns Pointer to cloned configuration
///
virtual config* clone() const;
/// \name XML management
/// \name XML configuration management
/// @{
///
/// Save to XML document
///
/// \param[in] pDoc XML document
/// \param[in] pConfigRoot Suggested root element for saving
///
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
///
/// Load from XML document
///
/// \param[in] pConfigRoot Root element for loading
///
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name BLOB management
/// @{
///
/// Packs a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of a configuration
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
public:
std::list<config_provider> m_providers; ///< Provider configurations
std::list<eap::config_provider> m_providers; ///< Provider configurations
};
/// @}
}
/// \addtogroup EAPBaseStream
/// @{
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &val)
{
val.operator<<(cursor);
}
inline size_t pksizeof(const eap::config &val)
{
return val.get_pk_size();
}
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val)
{
val.operator>>(cursor);
}
///
/// Packs a method status
///
/// \param[inout] cursor Memory cursor
/// \param[in] val Method status to pack
///
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config_method::status_t &val)
{
cursor << (unsigned char)val;
}
///
/// Returns packed size of a method status
///
/// \param[in] val Method status to pack
///
/// \returns Size of data when packed (in bytes)
///
inline size_t pksizeof(_In_ const eap::config_method::status_t &val)
{
return pksizeof((unsigned char)val);
}
///
/// Unpacks a method status
///
/// \param[inout] cursor Memory cursor
/// \param[out] val Method status to unpack to
///
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

@@ -18,10 +18,23 @@
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sal.h>
namespace eap
{
///
/// Base class for method credential storage
///
class credentials;
///
/// Password based method credentials
///
class credentials_pass;
///
/// Connection credentials
///
class credentials_connection;
}
@@ -45,12 +58,6 @@ namespace eap
namespace eap
{
/// \addtogroup EAPBaseCred
/// @{
///
/// Base class for method credential storage
///
class credentials : public config
{
public:
@@ -61,8 +68,7 @@ namespace eap
source_unknown = -1, ///< Unknown source
source_cache = 0, ///< Credentials were obtained from EapHost cache
source_config, ///< Credentials were set by method configuration
source_storage, ///< Credentials were loaded from Windows Credential Manager
source_lower, ///< Credentials were set by lower EAP method
source_storage ///< Credentials were loaded from Windows Credential Manager
};
@@ -120,17 +126,50 @@ namespace eap
///
virtual bool empty() const;
/// \name XML management
/// \name XML configuration management
/// @{
///
/// Save to XML document
///
/// \param[in] pDoc XML document
/// \param[in] pConfigRoot Suggested root element for saving
///
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
///
/// Load from XML document
///
/// \param[in] pConfigRoot Root element for loading
///
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name BLOB management
/// @{
///
/// Packs a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of a configuration
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
/// \name Storage
@@ -200,11 +239,9 @@ namespace eap
/// Combine credentials in the following order:
///
/// 1. Cached credentials
/// 2. Configured credentials (if \p cfg is derived from `config_method_with_cred`)
/// 2. Pre-configured credentials
/// 3. Stored credentials
///
/// \param[in] dwFlags A combination of [EAP flags](https://msdn.microsoft.com/en-us/library/windows/desktop/bb891975.aspx) that describe the EAP authentication session behavior
/// \param[in] hTokenImpersonateUser Impersonation token for a logged-on user to collect user-related information
/// \param[in] cred_cached Cached credentials (optional, can be \c NULL, must be the same type of credentials as `this`)
/// \param[in] cfg Method configuration (must be the same type of configuration as `this` credentials belong to)
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL)
@@ -215,10 +252,8 @@ namespace eap
/// - \c source_storage Credentials were loaded from Windows Credential Manager
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_ const credentials *cred_cached,
_In_ const config_method_with_cred &cfg,
_In_opt_z_ LPCTSTR pszTargetName) = 0;
public:
@@ -226,101 +261,6 @@ namespace eap
};
///
/// Identity-only based method credentials
///
class credentials_identity : public credentials
{
public:
///
/// Constructs credentials
///
/// \param[in] mod EAP module to use for global services
///
credentials_identity(_In_ module &mod);
///
/// Copies credentials
///
/// \param[in] other Credentials to copy from
///
credentials_identity(_In_ const credentials_identity &other);
///
/// Moves credentials
///
/// \param[in] other Credentials to move from
///
credentials_identity(_Inout_ credentials_identity &&other);
///
/// Copies credentials
///
/// \param[in] other Credentials to copy from
///
/// \returns Reference to this object
///
credentials_identity& operator=(_In_ const credentials_identity &other);
///
/// Moves credentials
///
/// \param[in] other Credentials to move from
///
/// \returns Reference to this object
///
credentials_identity& operator=(_Inout_ credentials_identity &&other);
virtual config* clone() const;
/// \name XML management
/// @{
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name Storage
/// @{
virtual void store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level) const;
virtual void retrieve(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level);
///
/// @copydoc eap::credentials::target_suffix()
/// \returns This implementation always returns `_T("pass")`
///
virtual LPCTSTR target_suffix() const;
/// @}
///
/// Combine credentials in the following order:
///
/// 1. Cached credentials
/// 2. Configured credentials (if \p cfg is derived from `config_method_with_cred`)
/// 3. Stored credentials
///
/// \param[in] dwFlags A combination of [EAP flags](https://msdn.microsoft.com/en-us/library/windows/desktop/bb891975.aspx) that describe the EAP authentication session behavior
/// \param[in] hTokenImpersonateUser Impersonation token for a logged-on user to collect user-related information
/// \param[in] cred_cached Cached credentials (optional, can be \c NULL)
/// \param[in] cfg Method configuration (when derived from `config_method_with_cred`, metod attempt to load credentials from \p cfg)
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL)
///
/// \returns
/// - \c source_cache Credentials were obtained from EapHost cache
/// - \c source_config Credentials were set by method configuration
/// - \c source_storage Credentials were loaded from Windows Credential Manager
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName);
};
///
/// Password based method credentials
///
class credentials_pass : public credentials
{
public:
@@ -374,46 +314,108 @@ namespace eap
///
credentials_pass& operator=(_Inout_ credentials_pass &&other);
///
/// Clones credentials
///
/// \returns Pointer to cloned credentials
///
virtual config* clone() const;
///
/// Resets credentials
///
virtual void clear();
///
/// Test credentials if blank
///
/// \returns
/// - \c true if blank
/// - \c false otherwise
///
virtual bool empty() const;
/// \name XML management
/// \name XML configuration management
/// @{
///
/// Save to XML document
///
/// \param[in] pDoc XML document
/// \param[in] pConfigRoot Suggested root element for saving
///
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
///
/// Load from XML document
///
/// \param[in] pConfigRoot Root element for loading
///
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name BLOB management
/// @{
///
/// Packs a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of a configuration
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
/// \name Storage
/// @{
///
/// Save credentials to Windows Credential Manager
///
/// \param[in] pszTargetName The name in Windows Credential Manager to store credentials as
/// \param[in] level Credential level (0=outer, 1=inner, 2=inner-inner...)
///
virtual void store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level) const;
///
/// Retrieve credentials from Windows Credential Manager
///
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from
/// \param[in] level Credential level (0=outer, 1=inner, 2=inner-inner...)
///
virtual void retrieve(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level);
///
/// @copydoc eap::credentials::target_suffix()
/// \returns This implementation always returns `_T("pass")`
/// Return target suffix for Windows Credential Manager credential name
///
virtual LPCTSTR target_suffix() const;
/// @}
///
/// Combine credentials in the following order:
///
/// 1. Cached credentials
/// 2. Configured credentials (if \p cfg is derived from `config_method_with_cred`)
/// 2. Pre-configured credentials
/// 3. Stored credentials
///
/// \param[in] dwFlags A combination of [EAP flags](https://msdn.microsoft.com/en-us/library/windows/desktop/bb891975.aspx) that describe the EAP authentication session behavior
/// \param[in] hTokenImpersonateUser Impersonation token for a logged-on user to collect user-related information
/// \param[in] cred_cached Cached credentials (optional, can be \c NULL)
/// \param[in] cfg Method configuration (when derived from `config_method_with_cred`, metod attempt to load credentials from \p cfg)
/// \param[in] cred_cached Cached credentials (optional, can be \c NULL, must be credentials_pass* type)
/// \param[in] cfg Method configuration (must be config_method_pap type)
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL)
///
/// \returns
@@ -422,10 +424,8 @@ namespace eap
/// - \c source_storage Credentials were loaded from Windows Credential Manager
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_ const credentials *cred_cached,
_In_ const config_method_with_cred &cfg,
_In_opt_z_ LPCTSTR pszTargetName);
public:
@@ -439,9 +439,6 @@ namespace eap
};
///
/// Connection credentials
///
class credentials_connection : public config
{
public:
@@ -485,19 +482,57 @@ namespace eap
///
credentials_connection& operator=(_Inout_ credentials_connection &&other);
///
/// Clones configuration
///
/// \returns Pointer to cloned configuration
///
virtual config* clone() const;
/// \name XML management
/// \name XML configuration management
/// @{
///
/// Save to XML document
///
/// \param[in] pDoc XML document
/// \param[in] pConfigRoot Suggested root element for saving
///
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
///
/// Load from XML document
///
/// \param[in] pConfigRoot Root element for loading
///
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name BLOB management
/// @{
///
/// Packs a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator<<(_Inout_ cursor_out &cursor) const;
///
/// Returns packed size of a configuration
///
/// \returns Size of data when packed (in bytes)
///
virtual size_t get_pk_size() const;
///
/// Unpacks a configuration
///
/// \param[inout] cursor Memory cursor
///
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
///
@@ -531,48 +566,23 @@ namespace eap
std::wstring m_id; ///< Provider ID
std::unique_ptr<credentials> m_cred; ///< Credentials
};
/// @}
}
/// \addtogroup EAPBaseStream
/// @{
///
/// Packs a credential encryption algorithm ID
///
/// \param[inout] cursor Memory cursor
/// \param[in] val Credential encryption algorithm ID to pack
///
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::credentials_pass::enc_alg_t &val)
{
cursor << (unsigned char)val;
}
///
/// Returns packed size of a credential encryption algorithm ID
///
/// \param[in] val Credential encryption algorithm ID to pack
///
/// \returns Size of data when packed (in bytes)
///
inline size_t pksizeof(_In_ const eap::credentials_pass::enc_alg_t &val)
{
return pksizeof((unsigned char)val);
}
///
/// Unpacks a credential encryption algorithm ID
///
/// \param[inout] cursor Memory cursor
/// \param[out] val Credential encryption algorithm ID to unpack to
///
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

@@ -21,44 +21,17 @@
#define IDR_EAP_KEY_PUBLIC 1
#define IDR_EAP_KEY_PRIVATE 2
///
/// \defgroup EAPBaseStream Memory Packaging
/// Simple serialization/deserialization of data to/from memory opaque BLOBs
///
/// @{
#ifndef EAP_ENCRYPT_BLOBS
///
/// Encrypt BLOBs leaving our module
///
#define EAP_ENCRYPT_BLOBS 1
#endif
/// @}
///
/// \defgroup EAPBaseModule Modules
/// Modules
///
/// @{
#ifndef __DANGEROUS__LOG_CONFIDENTIAL_DATA
///
/// Output passwords and other confidential information to event log
///
#define __DANGEROUS__LOG_CONFIDENTIAL_DATA 0
#endif
/// @}
///
/// \defgroup EAPBaseCred Credentials
/// Credential management
///
/// @{
#ifndef EAP_USE_NATIVE_CREDENTIAL_CACHE
///
/// Use EapHost credential cache
///
#define EAP_USE_NATIVE_CREDENTIAL_CACHE 0
#endif
/// @}
#define _HOST_LOW_ENDIAN
@@ -77,27 +50,33 @@
namespace eap
{
///
/// Output BLOB cursor
///
struct cursor_out;
///
/// Input BLOB cursor
///
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;
///
/// \defgroup EAPBaseSanitizing Sanitizing memory
/// Secure memory erasing after use
///
/// @{
///
/// Sanitizing dynamically allocated BLOB
///
typedef std::vector<unsigned char, winstd::sanitizing_allocator<unsigned char> > sanitizing_blob;
///
/// Sanitizing BLOB of fixed size (zero initialized in _DEBUG version, non-initialized in release version)
/// Sanitizing BLOB of fixed size
///
template<size_t N> struct sanitizing_blob_f;
///
/// Sanitizing BLOB of fixed size (zero initialized)
///
template<size_t N> struct sanitizing_blob_zf;
///
/// Sanitizing BLOB of fixed size (zero initialized in _DEBUG version)
///
#ifdef _DEBUG
#define sanitizing_blob_xf sanitizing_blob_zf
@@ -105,55 +84,27 @@ namespace eap
#define sanitizing_blob_xf sanitizing_blob_f
#endif
/// @}
/// \addtogroup EAPBaseDiameter
/// @{
///
/// Diameter AVP flags
///
enum diameter_avp_flags_t;
///
/// Diameter AVP header
///
struct diameter_avp_header;
///
/// Diameter AVP header with Vendor-ID
///
struct diameter_avp_header_ven;
///
/// Appends Diameter AVP to response packet
/// EAP packet
///
/// \param[in ] code AVP code
/// \param[in ] flags AVP flags
/// \param[in ] data AVP data (<16777212B)
/// \param[in ] size Size of \p data in bytes
/// \param[inout] packet Response packet to append data to
///
void diameter_avp_append(
_In_ unsigned int code,
_In_ unsigned char flags,
_In_bytecount_(size) const void *data,
_In_ unsigned int size,
_Inout_ sanitizing_blob &packet);
///
/// Appends Diameter AVP to response packet
///
/// \param[in ] code AVP code
/// \param[in ] vendor_id Vendor-ID
/// \param[in ] flags AVP flags
/// \param[in ] data AVP data (<16777212B)
/// \param[in ] size Size of \p data in bytes
/// \param[inout] packet Response packet to append data to
///
void diameter_avp_append(
_In_ unsigned int code,
_In_ unsigned int vendor_id,
_In_ unsigned char flags,
_In_bytecount_(size) const void *data,
_In_ unsigned int size,
_Inout_ sanitizing_blob &packet);
/// @}
class packet;
}
/// \addtogroup EAPBaseStream
/// @{
///
/// Packs a boolean
///
@@ -271,7 +222,7 @@ template<class _Elem, class _Traits, class _Ax> inline void operator<<(_Inout_ e
///
/// \returns Size of data when packed (in bytes)
///
template<class _Elem, class _Traits, class _Ax> inline size_t pksizeof(_In_ const std::basic_string<_Elem, _Traits, _Ax> &val);
template<class _Elem, class _Traits, class _Ax> inline size_t pksizeof(const std::basic_string<_Elem, _Traits, _Ax> &val);
///
/// Unpacks a string
@@ -296,7 +247,7 @@ template<class _Traits, class _Ax> inline void operator<<(_Inout_ eap::cursor_ou
///
/// \returns Size of data when packed (in bytes)
///
template<class _Traits, class _Ax> inline size_t pksizeof(_In_ const std::basic_string<wchar_t, _Traits, _Ax> &val);
template<class _Traits, class _Ax> inline size_t pksizeof(const std::basic_string<wchar_t, _Traits, _Ax> &val);
///
/// Unpacks a wide string
@@ -321,7 +272,7 @@ template<class _Ty, class _Ax> inline void operator<<(_Inout_ eap::cursor_out &c
///
/// \returns Size of data when packed (in bytes)
///
template<class _Ty, class _Ax> inline size_t pksizeof(_In_ const std::vector<_Ty, _Ax> &val);
template<class _Ty, class _Ax> inline size_t pksizeof(const std::vector<_Ty, _Ax> &val);
///
/// Unpacks a vector
@@ -346,7 +297,7 @@ template<class _Ty, class _Ax> inline void operator<<(_Inout_ eap::cursor_out &c
///
/// \returns Size of data when packed (in bytes)
///
template<class _Ty, class _Ax> inline size_t pksizeof(_In_ const std::list<_Ty, _Ax> &val);
template<class _Ty, class _Ax> inline size_t pksizeof(const std::list<_Ty, _Ax> &val);
///
/// Unpacks a list
@@ -371,9 +322,16 @@ template<class _Ty, class _Dx> inline void operator<<(_Inout_ eap::cursor_out &c
///
/// \returns Size of data when packed (in bytes)
///
template<class _Ty, class _Dx> inline size_t pksizeof(_In_ const std::unique_ptr<_Ty, _Dx> &val);
template<class _Ty, class _Dx> inline size_t pksizeof(const std::unique_ptr<_Ty, _Dx> &val);
// std::unique_ptr<> is generally not unpackable, since we do not know, how to create a new instance of unique_ptr.
/////
///// Unpacks a std::unique_ptr
/////
///// \note Not generally unpackable, since we do not know, how to create a new instance of unique_ptr.
/////
///// \param[inout] cursor Memory cursor
///// \param[out] val std::unique_ptr to unpack to
/////
//template<class _Ty, class _Dx> inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::unique_ptr<_Ty, _Dx> &val);
///
@@ -391,7 +349,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::cert_
///
/// \returns Size of data when packed (in bytes)
///
inline size_t pksizeof(_In_ const winstd::cert_context &val);
inline size_t pksizeof(const winstd::cert_context &val);
///
/// Unpacks a certificate context
@@ -416,7 +374,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::eap_t
///
/// \returns Size of data when packed (in bytes)
///
inline size_t pksizeof(_In_ const winstd::eap_type_t &val);
inline size_t pksizeof(const winstd::eap_type_t &val);
///
/// Unpacks an EAP method type
@@ -476,64 +434,6 @@ inline size_t pksizeof(_In_ const GUID &val);
///
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ GUID &val);
///
/// Packs a EAP_METHOD_TYPE
///
/// \param[inout] cursor Memory cursor
/// \param[in] val Variable with data to pack
///
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const EAP_METHOD_TYPE &val);
///
/// Returns packed size of a EAP_METHOD_TYPE
///
/// \param[in] val Data to pack
///
/// \returns Size of data when packed (in bytes)
///
inline size_t pksizeof(_In_ const EAP_METHOD_TYPE &val);
///
/// Unpacks a EAP_METHOD_TYPE
///
/// \param[inout] cursor Memory cursor
/// \param[out] val Variable to receive unpacked value
///
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);
/// @}
///
/// \defgroup EAPBaseConversion Data conversion
/// Data conversion
///
/// @{
#ifndef htonll
///
/// Converts an unsigned __int64 from host to TCP/IP network byte order.
@@ -546,7 +446,7 @@ inline unsigned __int64 htonll(unsigned __int64 val);
#endif
///
/// Converts a 24-bit integer from host to TCP/IP network byte order.
/// Converts an 24-bit integer from host to TCP/IP network byte order.
///
/// \param[in ] val A 24-bit unsigned number in host byte order
/// \param[out] out A 24-bit unsigned number in network byte order
@@ -554,7 +454,7 @@ inline unsigned __int64 htonll(unsigned __int64 val);
inline void hton24(_In_ unsigned int val, _Out_ unsigned char out[3]);
///
/// Converts a 24-bit integer from TCP/IP network to host byte order.
/// Converts an 24-bit integer from TCP/IP network to host byte order.
///
/// \param[in] val A 24-bit unsigned number in network byte order
///
@@ -562,24 +462,13 @@ inline void hton24(_In_ unsigned int val, _Out_ unsigned char out[3]);
///
inline unsigned int ntoh24(_In_ const unsigned char val[3]);
/// @}
#pragma once
namespace eap
{
/// \addtogroup EAPBaseStream
/// @{
///
/// Output BLOB cursor
///
struct cursor_out
{
///
/// Pointer to output data type
///
typedef unsigned char *ptr_type;
ptr_type ptr; ///< Pointer to first data unwritten
@@ -587,14 +476,8 @@ namespace eap
};
///
/// Input BLOB cursor
///
struct cursor_in
{
///
/// Pointer to input data type
///
typedef const unsigned char *ptr_type;
ptr_type ptr; ///< Pointer to first data unread
@@ -602,56 +485,11 @@ namespace eap
};
///
/// 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
/// @{
#pragma pack(push)
#pragma pack(1)
///
/// Sanitizing BLOB of fixed size
///
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_f<N>
template<size_t N>
struct __declspec(novtable) sanitizing_blob_f<N>
{
unsigned char data[N]; ///< BLOB data
@@ -774,11 +612,8 @@ namespace eap
}
};
///
/// Sanitizing BLOB of fixed size (zero initialized)
///
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_zf<N> : sanitizing_blob_f<N>
template<size_t N>
struct __declspec(novtable) sanitizing_blob_zf<N> : sanitizing_blob_f<N>
{
///
/// Constructor
@@ -810,17 +645,7 @@ namespace eap
};
#pragma pack(pop)
/// @}
///
/// \defgroup EAPBaseDiameter Diameter
/// Diameter authentication protocol
///
/// @{
///
/// Diameter AVP flags
///
#pragma warning(suppress: 4480)
enum diameter_avp_flags_t : unsigned char {
diameter_avp_flag_vendor = 0x80, ///< Vendor-ID present
@@ -832,9 +657,6 @@ namespace eap
#pragma pack(push)
#pragma pack(1)
///
/// Diameter AVP header
///
struct diameter_avp_header
{
unsigned char code[4]; ///< AVP Code
@@ -843,9 +665,6 @@ namespace eap
};
///
/// Diameter AVP header with Vendor-ID
///
struct diameter_avp_header_ven : public diameter_avp_header
{
unsigned char vendor[4]; ///< Vendor-ID
@@ -853,7 +672,57 @@ namespace eap
#pragma pack(pop)
/// @}
class packet
{
public:
///
/// Constructs an empty packet
///
packet();
///
/// Copies a packet
///
/// \param[in] other Packet to copy from
///
packet(_In_ const packet &other);
///
/// Moves a packet
///
/// \param[in] other Packet to move from
///
packet(_Inout_ packet &&other);
///
/// Copies a packet
///
/// \param[in] other Packet to copy from
///
/// \returns Reference to this object
///
packet& operator=(_In_ const packet &other);
///
/// Moves a packet
///
/// \param[in] other Packet to move from
///
/// \returns Reference to this object
///
packet& operator=(_Inout_ packet &&other);
///
/// Empty the packet
///
virtual void clear();
public:
EapCode m_code; ///< Packet code
unsigned char m_id; ///< Packet ID
sanitizing_blob m_data; ///< Packet data
};
}
@@ -973,7 +842,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_st
template<class _Elem, class _Traits, class _Ax>
inline size_t pksizeof(_In_ const std::basic_string<_Elem, _Traits, _Ax> &val)
inline size_t pksizeof(const std::basic_string<_Elem, _Traits, _Ax> &val)
{
return sizeof(_Elem)*(val.length() + 1);
}
@@ -1000,7 +869,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_st
template<class _Traits, class _Ax>
inline size_t pksizeof(_In_ const std::basic_string<wchar_t, _Traits, _Ax> &val)
inline size_t pksizeof(const std::basic_string<wchar_t, _Traits, _Ax> &val)
{
return sizeof(char)*(WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), NULL, 0, NULL, NULL) + 1);
}
@@ -1029,7 +898,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::vector<_
template<class _Ty, class _Ax>
inline size_t pksizeof(_In_ const std::vector<_Ty, _Ax> &val)
inline size_t pksizeof(const std::vector<_Ty, _Ax> &val)
{
// Since we do not know wheter vector elements are primitives or objects, iterate instead of sizeof().
// For performance critical vectors of flat opaque data types write specialized template instantiation.
@@ -1073,7 +942,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::list<_Ty
template<class _Ty, class _Ax>
inline size_t pksizeof(_In_ const std::list<_Ty, _Ax> &val)
inline size_t pksizeof(const std::list<_Ty, _Ax> &val)
{
// Since we do not know wheter list elements are primitives or objects, iterate instead of sizeof().
// For performance critical vectors of flat opaque data types write specialized template instantiation.
@@ -1112,7 +981,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::unique_p
template<class _Ty, class _Dx>
inline size_t pksizeof(_In_ const std::unique_ptr<_Ty, _Dx> &val)
inline size_t pksizeof(const std::unique_ptr<_Ty, _Dx> &val)
{
return
val ?
@@ -1138,7 +1007,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::cert_
}
inline size_t pksizeof(_In_ const winstd::cert_context &val)
inline size_t pksizeof(const winstd::cert_context &val)
{
return
val ?
@@ -1242,49 +1111,6 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ GUID &val)
}
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const EAP_METHOD_TYPE &val)
{
auto ptr_end = cursor.ptr + sizeof(EAP_METHOD_TYPE);
assert(ptr_end <= cursor.ptr_end);
memcpy(cursor.ptr, &val, sizeof(EAP_METHOD_TYPE));
cursor.ptr = ptr_end;
}
inline size_t pksizeof(_In_ const EAP_METHOD_TYPE &val)
{
UNREFERENCED_PARAMETER(val);
return sizeof(EAP_METHOD_TYPE);
}
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ EAP_METHOD_TYPE &val)
{
auto ptr_end = cursor.ptr + sizeof(EAP_METHOD_TYPE);
assert(ptr_end <= cursor.ptr_end);
memcpy(&val, cursor.ptr, sizeof(EAP_METHOD_TYPE));
cursor.ptr = ptr_end;
}
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

@@ -29,531 +29,39 @@
namespace eapxml
{
///
/// \defgroup EAPBaseXML XML DOM
/// Easy interaction with MSXML
///
/// @{
///
/// Returns owner document object for a given node
///
/// \param[in ] pXmlNode XML node
/// \param[out] ppXmlDoc XML document
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ winstd::com_obj<IXMLDOMDocument2> &ppXmlDoc);
///
/// Selects single child node by name
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrNodeName XML node selection name
/// \param[out] ppXmlNode Child XML node found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ winstd::com_obj<IXMLDOMNode> &ppXmlNode);
///
/// Selects child nodes by name
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrNodeName XML node selection name
/// \param[out] ppXmlNodes List of child XML nodes found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ winstd::com_obj<IXMLDOMNodeList> &ppXmlNodes);
///
/// Selects single child element by name
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementName XML element selection name
/// \param[out] ppXmlElement Child XML element found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ winstd::com_obj<IXMLDOMElement> &ppXmlElement);
///
/// Creates a new element
///
/// \param[in ] pDoc Owner XML document
/// \param[in ] bstrElementName XML element name
/// \param[in ] bstrNamespace XML element namespace
/// \param[out] ppXmlElement XML element created
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj<IXMLDOMElement> &ppXmlElement);
///
/// Creates a new child element if not already present
///
/// \param[in ] pDoc Owner XML document
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementNameSelect XML element selection name
/// \param[in ] bstrElementNameCreate XML element name
/// \param[in ] bstrNamespace XML element namespace
/// \param[out] ppXmlElement XML element found or created
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj<IXMLDOMElement> &ppXmlElement);
///
/// Tests if node has a parent set
///
/// \param[in] pXmlNode XML node
///
/// \returns
/// - Non zero when \p pXmlNode has a parent set;
/// - Zero otherwise.
///
inline bool has_parent(_In_ IXMLDOMNode *pXmlNode);
///
/// Returns child element text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementName XML element selection name
/// \param[out] pbstrValue XML element text
/// \param[out] ppXmlElement Child XML element found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ winstd::bstr &pbstrValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Returns child element text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementName XML element selection name
/// \param[out] sValue XML element text
/// \param[out] ppXmlElement Child XML element found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
template<class _Traits, class _Ax> inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Returns child element text converted to number
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementName XML element selection name
/// \param[out] pdwValue XML element text converted to number
/// \param[out] ppXmlElement Child XML element found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD &pdwValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Returns child element text converted to boolean
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementName XML element selection name
/// \param[out] pbValue XML element text converted to boolean
/// \param[out] ppXmlElement Child XML element found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool &pbValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Returns child element BLOB encoded as Base64 text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementName XML element selection name
/// \param[out] aValue XML element BLOB
/// \param[out] ppXmlElement Child XML element found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
template<class _Ty, class _Ax> inline HRESULT get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Returns child element BLOB encoded as hexadecimal text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementName XML element selection name
/// \param[out] aValue XML element BLOB
/// \param[out] ppXmlElement Child XML element found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
template<class _Ty, class _Ax> inline HRESULT get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Returns child element localizable text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementName XML element selection name
/// \param[in ] pszLang Desired localization
/// \param[out] pbstrValue XML element text
/// \param[out] ppXmlElement Child XML element found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ winstd::bstr &pbstrValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Returns child element localizable text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrElementName XML element selection name
/// \param[in ] pszLang Desired localization
/// \param[out] sValue XML element text
/// \param[out] ppXmlElement Child XML element found
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
template<class _Traits, class _Ax> inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Creates a new child element
///
/// \param[in ] pDoc Owner XML document
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrElementName XML element name
/// \param[in ] bstrNamespace XML element namespace
/// \param[out] ppXmlElement XML element created
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj<IXMLDOMElement> &ppXmlElement);
///
/// Creates a new child element with text
///
/// \param[in ] pDoc Owner XML document
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrElementName XML element name
/// \param[in ] bstrNamespace XML element namespace
/// \param[in ] bstrValue XML element text
/// \param[out] ppXmlElement XML element created
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Creates a new child element with text converted from number
///
/// \param[in ] pDoc Owner XML document
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrElementName XML element name
/// \param[in ] bstrNamespace XML element namespace
/// \param[in ] dwValue XML element number
/// \param[out] ppXmlElement XML element created
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Creates a new child element with text converted from boolean
///
/// \param[in ] pDoc Owner XML document
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrElementName XML element name
/// \param[in ] bstrNamespace XML element namespace
/// \param[in ] bValue XML element boolean
/// \param[out] ppXmlElement XML element created
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Creates a new child element with Base64 encoded text from BLOB
///
/// \param[in ] pDoc Owner XML document
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrElementName XML element name
/// \param[in ] bstrNamespace XML element namespace
/// \param[in ] pValue Pointer to BLOB data
/// \param[in ] nValueLen Size of \p pValue in bytes
/// \param[out] ppXmlElement XML element created
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Creates a new child element with hexadecimal encoded text from BLOB
///
/// \param[in ] pDoc Owner XML document
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrElementName XML element name
/// \param[in ] bstrNamespace XML element namespace
/// \param[in ] pValue Pointer to BLOB data
/// \param[in ] nValueLen Size of \p pValue in bytes
/// \param[out] ppXmlElement XML element created
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Returns attribute text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrAttributeName XML attribute selection name
/// \param[out] pbstrValue XML atribute value
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ winstd::bstr &pbstrValue);
///
/// Returns attribute text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrAttributeName XML attribute selection name
/// \param[out] sValue XML atribute value
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
template<class _Traits, class _Ax> inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue);
///
/// Returns attribute text converted to number
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrAttributeName XML attribute selection name
/// \param[out] pdwValue XML atribute value
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ DWORD &pdwValue);
///
/// Returns attribute text converted to boolean
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrAttributeName XML attribute selection name
/// \param[out] pbValue XML atribute value
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ bool &pbValue);
///
/// Returns attribute BLOB converted from Base64 encoded text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrAttributeName XML attribute selection name
/// \param[out] aValue XML atribute value
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
template<class _Ty, class _Ax> inline HRESULT get_attrib_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue);
///
/// Returns attribute BLOB converted from hexadecimal encoded text
///
/// \param[in ] pXmlParent Parent XML node
/// \param[in ] bstrAttributeName XML attribute selection name
/// \param[out] aValue XML atribute value
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
template<class _Ty, class _Ax> inline HRESULT get_attrib_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue);
///
/// Sets node attribute
///
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrAttributeName XML attribute name
/// \param[out] bstrValue XML atribute value
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_z_ const BSTR bstrValue);
///
/// Sets node attribute converted from number
///
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrAttributeName XML attribute name
/// \param[out] dwValue XML atribute value
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_ DWORD dwValue);
///
/// Sets node attribute converted from boolean
///
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrAttributeName XML attribute name
/// \param[out] bValue XML atribute value
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_ bool bValue);
///
/// Sets node attribute to Base64 encoded text from BLOB
///
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrAttributeName XML attribute name
/// \param[in ] pValue Pointer to BLOB data
/// \param[in ] nValueLen Size of \p pValue in bytes
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_base64(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
///
/// Sets node attribute to hexadecimal encoded text from BLOB
///
/// \param[in ] pCurrentDOMNode Parent XML node
/// \param[in ] bstrAttributeName XML attribute name
/// \param[in ] pValue Pointer to BLOB data
/// \param[in ] nValueLen Size of \p pValue in bytes
///
/// \returns
/// - >0 if succeeded with warnings;
/// - =0 (\c S_OK) if successful;
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_hex(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
///
/// Builds XPath for a given node
///
/// \param[in] pXmlNode XML node
///
/// \returns String with XPath for a given node up to node terminal parent
///
inline std::wstring get_xpath(_In_ IXMLDOMNode *pXmlNode);
/// @}
}
#pragma once

View File

@@ -20,9 +20,15 @@
namespace eap
{
///
/// EAP and non-EAP method base class
///
class method;
class method_tunnel;
class method_eap;
///
/// Non-EAP method base class
///
class method_noneap;
}
#pragma once
@@ -43,44 +49,37 @@ extern "C" {
namespace eap
{
///
/// \defgroup EAPBaseMethod Methods
/// Methods
///
/// @{
///
/// Method base class
///
class method
{
WINSTD_NONCOPYABLE(method)
public:
///
/// Constructs a method
/// Constructs an EAP method
///
/// \param[in] mod Module to use for global services
/// \param[in] mod EAP module to use for global services
/// \param[in] cfg Method configuration
/// \param[in] cred User credentials
///
method(_In_ module &mod);
method(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred);
///
/// Moves a method
/// Moves an EAP method
///
/// \param[in] other Method to move from
/// \param[in] other EAP method to move from
///
method(_Inout_ method &&other);
///
/// Moves a method
/// Moves an EAP method
///
/// \param[in] other Method to move from
/// \param[in] other EAP method to move from
///
/// \returns Reference to this object
///
method& operator=(_Inout_ method &&other);
/// \name Session management
/// \name Packet processing
/// @{
///
@@ -88,11 +87,6 @@ namespace eap
///
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
///
/// \param[in] dwFlags A combination of EAP flags that describe the new EAP authentication session behavior.
/// \param[in] pAttributeArray A pointer to an array structure that specifies the EAP attributes of the entity to authenticate.
/// \param[in] hTokenImpersonateUser Specifies a handle to the user impersonation token to use in this session.
/// \param[in] dwMaxSendPacketSize Specifies the maximum size in bytes of an EAP packet sent during the session. If the method needs to send a packet larger than the maximum size, the method must accommodate fragmentation and reassembly.
///
virtual void begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
@@ -106,266 +100,111 @@ namespace eap
///
virtual void end_session();
/// @}
/// \name Packet processing
/// @{
///
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///
/// \param[in] pReceivedPacket Received packet data
/// \param[in] dwReceivedPacketSize \p pReceivedPacket size in bytes
///
/// \returns Action peer wants EapHost to do next.
///
virtual EapPeerMethodResponseAction process_request_packet(
virtual void process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize) = 0;
_In_ DWORD dwReceivedPacketSize,
_Out_ EapPeerMethodOutput *pEapOutput) = 0;
///
/// Obtains a response packet from the EAP method.
///
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
///
/// \param[out] packet Response packet
/// \param[in] size_max The maximum size in bytes \p packet must not exceed. If the method needs to send a packet larger than the maximum size, the method must accommodate fragmentation and reassembly.
///
virtual void get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max = MAXDWORD) = 0;
/// @}
_Inout_bytecap_(*dwSendPacketSize) void *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize) = 0;
///
/// Obtains the result of an authentication session from the EAP method.
///
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
///
/// \param[in ] reason The reason code for the authentication result returned in \p pResult.
/// \param[out] pResult A pointer to a structure that contains the authentication results.
///
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{
///
/// Obtains the user interface context from the EAP method.
///
/// \note This function is always followed by the `EapPeerInvokeInteractiveUI()` function, which is followed by the `EapPeerSetUIContext()` function.
///
/// \sa [EapPeerGetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363612.aspx)
///
/// \param[out] context_data Supplicant user interface context data from EAPHost.
///
virtual void get_ui_context(_Out_ sanitizing_blob &context_data);
///
/// Provides a user interface context to the EAP method.
///
/// \note This function is called after the UI has been raised through the `EapPeerGetUIContext()` function.
///
/// \sa [EapPeerSetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363626.aspx)
///
/// \param[in] pUIContextData A pointer to an address that contains a byte buffer with the new supplicant UI context data to set on EAPHost.
/// \param[in] dwUIContextDataSize \p pUIContextData size in bytes
///
/// \returns Action peer wants EapHost to do next.
///
virtual EapPeerMethodResponseAction set_ui_context(
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ DWORD dwUIContextDataSize);
/// @}
/// \name EAP Response Attributes
/// @{
///
/// Obtains an array of EAP response attributes from the EAP method.
///
/// \sa [EapPeerGetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363609.aspx)
///
/// \param[out] pAttribs A pointer to a structure that contains an array of EAP authentication response attributes for the supplicant.
///
virtual void get_response_attributes(_Out_ EapAttributes *pAttribs);
///
/// Provides an updated array of EAP response attributes to the EAP method.
///
/// \sa [EapPeerSetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363625.aspx)
///
/// \param[in] pAttribs A pointer to a structure that contains an array of new EAP authentication response attributes to set for the supplicant on EAPHost.
///
/// \returns Action peer wants EapHost to do next.
///
virtual EapPeerMethodResponseAction set_response_attributes(_In_ const EapAttributes *pAttribs);
_Inout_ EapPeerMethodResult *pResult);
/// @}
public:
module &m_module; ///< Module for global services
module &m_module; ///< EAP module
config_method &m_cfg; ///< Connection configuration
credentials &m_cred; ///< User credentials
std::vector<winstd::eap_attr> m_eap_attr; ///< EAP attributes
};
///
/// Tunnel method base class
///
/// This is a base class for all the methods that encapsulate inner methods to provide stacking framework.
///
class method_tunnel : public method
class method_noneap : public method
{
WINSTD_NONCOPYABLE(method_tunnel)
WINSTD_NONCOPYABLE(method_noneap)
public:
///
/// Constructs a method
/// Constructs an EAP method
///
/// \param[in] mod Module to use for global services
/// \param[in] inner Inner method
/// \param[in] mod EAP module to use for global services
/// \param[in] cfg Method configuration
/// \param[in] cred User credentials
///
method_tunnel(_In_ module &mod, _In_ method *inner);
method_noneap(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred);
///
/// Moves a method
/// Moves an EAP method
///
/// \param[in] other Method to move from
/// \param[in] other EAP method to move from
///
method_tunnel(_Inout_ method_tunnel &&other);
method_noneap(_Inout_ method_noneap &&other);
///
/// Moves a method
/// Moves an EAP method
///
/// \param[in] other Method to move from
/// \param[in] other EAP method to move from
///
/// \returns Reference to this object
///
method_tunnel& operator=(_Inout_ method_tunnel &&other);
/// \name Session management
/// @{
virtual void begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize = MAXDWORD);
virtual void end_session();
/// @}
method_noneap& operator=(_Inout_ method_noneap &&other);
/// \name Packet processing
/// @{
virtual EapPeerMethodResponseAction process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize);
///
/// Obtains a response packet from the EAP method.
///
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
///
virtual void get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max = MAXDWORD);
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{
virtual void get_ui_context(_Out_ sanitizing_blob &context_data);
virtual EapPeerMethodResponseAction set_ui_context(
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ DWORD dwUIContextDataSize);
/// @}
/// \name EAP Response Attributes
/// @{
virtual void get_response_attributes(_Out_ EapAttributes *pAttribs);
virtual EapPeerMethodResponseAction set_response_attributes(_In_ const EapAttributes *pAttribs);
_Inout_bytecap_(*dwSendPacketSize) void *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize);
/// @}
protected:
std::unique_ptr<method> m_inner; ///< Inner method
};
///
/// Appends Diameter AVP to response packet
///
/// \param[in] code AVP code
/// \param[in] flags AVP flags
/// \param[in] data AVP data (<16777212B)
/// \param[in] size Size of \p data in bytes
///
void append_avp(_In_ unsigned int code, _In_ unsigned char flags, _In_bytecount_(size) const void *data, _In_ unsigned int size);
///
/// EAP tunnel method
/// Appends Diameter AVP to response packet
///
/// This method encapsulates inner data in EAP packets.
/// \param[in] code AVP code
/// \param[in] vendor_id Vendor-ID
/// \param[in] flags AVP flags
/// \param[in] data AVP data (<16777212B)
/// \param[in] size Size of \p data in bytes
///
class method_eap : public method_tunnel
{
WINSTD_NONCOPYABLE(method_eap)
public:
///
/// Constructs a method
///
/// \param[in] mod Module to use for global services
/// \param[in] eap_method EAP method type
/// \param[in] inner Inner method
///
method_eap(_In_ module &mod, _In_ winstd::eap_type_t eap_method, _In_ method *inner);
///
/// Moves a method
///
/// \param[in] other Method to move from
///
method_eap(_Inout_ method_eap &&other);
///
/// Moves a method
///
/// \param[in] other Method to move from
///
/// \returns Reference to this object
///
method_eap& operator=(_Inout_ method_eap &&other);
/// \name Session management
/// @{
virtual void begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize = MAXDWORD);
/// @}
/// \name Packet processing
/// @{
virtual EapPeerMethodResponseAction process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize);
virtual void get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max = MAXDWORD);
/// @}
void append_avp(_In_ unsigned int code, _In_ unsigned int vendor_id, _In_ unsigned char flags, _In_bytecount_(size) const void *data, _In_ unsigned int size);
protected:
const winstd::eap_type_t m_eap_method; ///< EAP method type
unsigned char m_id; ///< Request packet ID
bool m_send_nak; ///< Are we sending Legacy Nak response?
sanitizing_blob m_packet_res; ///< Response packet
};
/// @}
}

View File

@@ -20,7 +20,18 @@
namespace eap
{
///
/// EAP module base class
///
/// Provides basic services to EAP methods.
///
class module;
///
/// EAP peer base class
///
/// A group of methods all EAP peers must or should implement.
///
class peer;
}
@@ -47,14 +58,6 @@ extern "C" {
namespace eap
{
/// \addtogroup EAPBaseModule
/// @{
///
/// EAP module base class
///
/// Provides basic services to EAP methods.
///
class module
{
WINSTD_NONCOPYABLE(module)
@@ -85,11 +88,6 @@ namespace eap
///
EAP_ERROR* make_error(_In_ std::exception &err) const;
///
/// Allocate a EAP_ERROR and fill it according to another EAP_ERROR
///
EAP_ERROR* make_error(_In_ const EAP_ERROR *err) const;
///
/// Allocate BLOB
///
@@ -106,9 +104,7 @@ namespace eap
void free_error_memory(_In_ EAP_ERROR *err);
///
/// Makes a new method configuration
///
/// \returns New method configuration
/// Makes a new method config
///
virtual config_method* make_config_method();
@@ -133,7 +129,6 @@ namespace eap
/// Writes EAPMETHOD_TRACE_EVT_FN_CALL and returns auto event writer class
///
/// \param[in] pszFnName Function name
/// \param[in] result Reference to function return variable
///
/// \returns A new auto event writer that writes EAPMETHOD_TRACE_EVT_FN_RETURN_DWORD event on destruction
///
@@ -228,9 +223,6 @@ namespace eap
///
/// If \c _DEBUG is set the value is masked.
///
/// \param[in] name Variable name
/// \param[in] value Variable value
///
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_z_ LPCWSTR value) const
{
#if __DANGEROUS__LOG_CONFIDENTIAL_DATA
@@ -246,10 +238,6 @@ namespace eap
///
/// If \c _DEBUG is set the value is masked.
///
/// \param[in] name Variable name
/// \param[in] data Variable data
/// \param[in] size \p data size in bytes
///
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_bytecount_(size) const void *data, _In_ ULONG size) const
{
#if __DANGEROUS__LOG_CONFIDENTIAL_DATA
@@ -263,8 +251,6 @@ namespace eap
///
/// Logs event
///
/// \param[in] EventDescriptor Event descriptor
///
inline void log_event(_In_ PCEVENT_DESCRIPTOR EventDescriptor, ...) const
{
va_list arg;
@@ -284,6 +270,7 @@ namespace eap
/// \param[in ] hProv Handle of cryptographics provider
/// \param[in ] data Pointer to data to encrypt
/// \param[in ] size Size of \p data in bytes
/// \param[out] enc Encrypted data
/// \param[out] hHash Handle of hashing object
///
/// \returns Encrypted data
@@ -533,6 +520,11 @@ namespace eap
///
/// \param[in ] pDataIn Pointer to encrypted BLOB
/// \param[in ] dwDataInSize Size of \p pDataIn
/// \param[out ] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
///
/// \returns
/// - \c true if succeeded
/// - \c false otherwise. See \p ppEapError for details.
///
/// \returns Encrypted BLOB
///
@@ -690,11 +682,6 @@ namespace eap
};
///
/// EAP peer base class
///
/// A group of methods all EAP peers must or should implement.
///
class peer : public module
{
WINSTD_NONCOPYABLE(peer)
@@ -726,43 +713,23 @@ namespace eap
///
/// \sa [EapPeerGetIdentity function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363607.aspx)
///
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in ] pConnectionData Connection data used for the EAP method. If set to \c NULL, the static property of the method, as configured in the registry, is returned.
/// \param[in ] dwConnectionDataSize The size, in bytes, of the connection data buffer provided in \p pConnectionData.
/// \param[in ] pUserData A pointer to a byte buffer that contains the opaque user data BLOB. This parameter can be \c NULL.
/// \param[in ] dwUserDataSize The size, in bytes, of the user data buffer provided in \p pUserData.
/// \param[out] ppUserDataOut A pointer to a pointer to the returned user data. The data is passed to \p EapPeerBeginSession() as input \p pUserData.
/// \param[out] pdwUserDataOutSize Specifies the size, in bytes, of the \p ppUserDataOut buffer.
/// \param[in ] hTokenImpersonateUser A handle to the user impersonation token to use in this session.
/// \param[out] pfInvokeUI Returns \c TRUE if the user identity and user data blob aren't returned successfully, and the method seeks to collect the information from the user through the user interface dialog.
/// \param[out] ppwszIdentity A pointer to the returned user identity. The pointer will be included in the identity response packet and returned to the server.
///
virtual void get_identity(
_In_ DWORD dwFlags,
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
_In_ DWORD dwConnectionDataSize,
_In_count_(dwUserDataSize) const BYTE *pUserData,
_In_ DWORD dwUserDataSize,
_Out_ BYTE **ppUserDataOut,
_Out_ DWORD *pdwUserDataOutSize,
_Inout_ BYTE **ppUserDataOut,
_Inout_ DWORD *pdwUserDataOutSize,
_In_ HANDLE hTokenImpersonateUser,
_Out_ BOOL *pfInvokeUI,
_Out_ WCHAR **ppwszIdentity) = 0;
_Inout_ BOOL *pfInvokeUI,
_Inout_ WCHAR **ppwszIdentity) = 0;
///
/// Defines the implementation of an EAP method-specific function that retrieves the properties of an EAP method given the connection and user data.
///
/// \sa [EapPeerGetMethodProperties function](https://msdn.microsoft.com/en-us/library/windows/desktop/hh706636.aspx)
///
/// \param[in ] dwVersion The version number of the API.
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in ] hUserImpersonationToken A handle to the user impersonation token to use in this session.
/// \param[in ] pConnectionData Connection data used for the EAP method. If set to \c NULL, the static property of the method, as configured in the registry, is returned.
/// \param[in ] dwConnectionDataSize The size, in bytes, of the connection data buffer provided in \p pConnectionData.
/// \param[in ] pUserData A pointer to a byte buffer that contains the opaque user data BLOB. This parameter can be \c NULL.
/// \param[in ] dwUserDataSize The size, in bytes, of the user data buffer provided in \p pUserData.
/// \param[out] pMethodPropertyArray A pointer to the method properties array. Caller should free the inner pointers using `EapHostPeerFreeMemory()` starting at the innermost pointer. The caller should free an \c empvtString value only when the type is \c empvtString.
///
virtual void get_method_properties(
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
@@ -771,107 +738,72 @@ namespace eap
_In_ DWORD dwConnectionDataSize,
_In_count_(dwUserDataSize) const BYTE *pUserData,
_In_ DWORD dwUserDataSize,
_Out_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray) = 0;
_Inout_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray) = 0;
///
/// Converts XML into the configuration BLOB. The XML based credentials can come from group policy or from a system administrator.
///
/// \sa [EapPeerCredentialsXml2Blob function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363603.aspx)
///
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in ] pConfigRoot A pointer to an XML node that contains credentials, which are either user or machine credentials depending on the configuration passed in. The XML document is created with the EapHostUserCredentials Schema.
/// \param[in ] dwConnectionDataSize The size of the EAP SSO configuration data pointed to by \p pConnectionData, in bytes.
/// \param[in ] pConnectionData A pointer to an opaque byte buffer that contains the EAP SSO configuration data BLOB.
/// \param[out] ppCredentialsOut A pointer to the byte buffer that receives the credentials BLOB buffer generated by the input XML. The buffer can is of size \p pdwCredentialsOutSize. After consuming the data, this memory must be freed by calling `EapPeerFreeMemory()`.
/// \param[out] pdwCredentialsOutSize The size, in bytes, of the buffer pointed to by \p ppCredentialsOut.
///
virtual void credentials_xml2blob(
_In_ DWORD dwFlags,
_In_ IXMLDOMNode *pConfigRoot,
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
_In_ DWORD dwConnectionDataSize,
_Out_ BYTE **ppCredentialsOut,
_Out_ DWORD *pdwCredentialsOutSize) = 0;
_Inout_ BYTE **ppCredentialsOut,
_Inout_ DWORD *pdwCredentialsOutSize) = 0;
///
/// Defines the implementation of an EAP method-specific function that obtains the EAP Single-Sign-On (SSO) credential input fields for an EAP method.
///
/// \sa [EapPeerQueryCredentialInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363622.aspx)
///
/// \param[in ] hUserImpersonationToken An impersonation token for the user whose credentials are to be requested and obtained.
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in ] dwConnectionDataSize The size of the EAP SSO configuration data pointed to by \p pConnectionData, in bytes.
/// \param[in ] pConnectionData A pointer to an opaque byte buffer that contains the EAP SSO configuration data BLOB.
/// \param[out] pEapConfigInputFieldsArray A Pointer to a structure that contains the input fields to display to the supplicant user. The `pwszData` fields in the individual `EAP_CONFIG_INPUT_FIELD_DATA` elements are initialized to \c NULL.
///
virtual void query_credential_input_fields(
_In_ HANDLE hUserImpersonationToken,
_In_ DWORD dwFlags,
_In_ DWORD dwConnectionDataSize,
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
_Out_ EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldsArray) const;
_Inout_ EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldsArray) const;
///
/// Defines the implementation of an EAP method function that obtains the user BLOB data provided in an interactive Single-Sign-On (SSO) UI raised on the supplicant.
///
/// \sa [EapPeerQueryUserBlobFromCredentialInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204697.aspx)
///
/// \param[in ] hUserImpersonationToken An impersonation token for the user whose credentials are to be requested and obtained.
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in ] dwConnectionDataSize The size of the EAP SSO configuration data pointed to by \p pConnectionData, in bytes.
/// \param[in ] pConnectionData A pointer to an opaque byte buffer that contains the EAP SSO configuration data BLOB.
/// \param[in ] pEapConfigInputFieldArray A pointer to a structure that contains the input fields to display to the supplicant user. The `pwszData` fields in the individual `EAP_CONFIG_INPUT_FIELD_DATA` elements are initialized to \c NULL.
/// \param[out] pdwUsersBlobSize A pointer to a buffer that contains the size, in bytes, of the opaque user configuration data BLOB in \p ppUserBlob.
/// \param[out] ppUserBlob A pointer that contains the opaque user data BLOB.
///
virtual void query_user_blob_from_credential_input_fields(
_In_ HANDLE hUserImpersonationToken,
_In_ DWORD dwFlags,
_In_ DWORD dwConnectionDataSize,
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
_In_ const EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldArray,
_Out_ DWORD *pdwUsersBlobSize,
_Out_ BYTE **ppUserBlob) const;
_Inout_ DWORD *pdwUsersBlobSize,
_Inout_ BYTE **ppUserBlob) const;
///
/// Defines the implementation of an EAP method API that provides the input fields for interactive UI components to be raised on the supplicant.
///
/// \sa [EapPeerQueryInteractiveUIInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204695.aspx)
///
/// \param[in ] dwVersion The version number of the API.
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in ] dwUIContextDataSize The size of the context data in \p pUIContextData, in bytes.
/// \param[in ] pUIContextData A pointer to a BLOB that contains UI context data, represented as inner pointers to field data. The supplicant obtained these inner pointers from EAPHost run-time APIs.
/// \param[out] pEapInteractiveUIData Pointer that receives a structure that contains configuration information for interactive UI components raised on an EAP supplicant.
///
virtual void query_interactive_ui_input_fields(
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
_In_ DWORD dwUIContextDataSize,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_Out_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData) const;
_Inout_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData) const;
///
/// Converts user information into a user BLOB that can be consumed by EapHost run-time functions.
///
/// \sa [EapPeerQueryUIBlobFromInteractiveUIInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204696.aspx)
///
/// \param[in ] dwVersion The version number of the API.
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in ] dwUIContextDataSize The size of the context data in \p pUIContextData, in bytes.
/// \param[in ] pUIContextData A pointer to a BLOB that contains UI context data, represented as inner pointers to field data. The supplicant obtained these inner pointers from EAPHost run-time APIs.
/// \param[in ] pEapInteractiveUIData Pointer with a structure that contains configuration information for interactive user interface components raised on an EAP supplicant.
/// \param[out] pdwDataFromInteractiveUISize A pointer to a `DWORD` that specifies the size of the buffer pointed to by the \p ppDataFromInteractiveUI parameter, in bytes. If this value is not set to \c 0, then a pointer to a buffer of the size specified in this parameter must be supplied in the \p ppDataFromInteractiveUI parameter.
/// \param[out] ppDataFromInteractiveUI A pointer that receives a credentials BLOB that can be used in authentication. The caller should free the inner pointers using the function \p EapPeerFreeMemory(), starting at the innermost pointer. If a non-NULL value is supplied for this parameter, meaning that an existing data BLOB is passed to it, the supplied data BLOB will be updated and returned in this parameter.
///
virtual void query_ui_blob_from_interactive_ui_input_fields(
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
_In_ DWORD dwUIContextDataSize,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ const EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
_Out_ DWORD *pdwDataFromInteractiveUISize,
_Out_ BYTE **ppDataFromInteractiveUI) const;
_Inout_ DWORD *pdwDataFromInteractiveUISize,
_Inout_ BYTE **ppDataFromInteractiveUI) const;
/// \name Session management
/// @{
@@ -881,15 +813,6 @@ namespace eap
///
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
///
/// \param[in] dwFlags A combination of EAP flags that describe the new EAP authentication session behavior.
/// \param[in] pAttributeArray A pointer to an array structure that specifies the EAP attributes of the entity to authenticate.
/// \param[in] hTokenImpersonateUser Specifies a handle to the user impersonation token to use in this session.
/// \param[in] pConnectionData Connection data specific to this method used to decide the user data returned from this API, where the user data depends on certain connection data configuration. When this parameter is NULL the method implementation should use default values for connection.
/// \param[in] dwConnectionDataSize Specifies the size, in bytes, of the connection data buffer provided in \p pConnectionData.
/// \param[in] pUserData A pointer to a byte buffer that contains the opaque user data BLOB.
/// \param[in] dwUserDataSize Specifies the size in bytes of the user data buffer provided in \p pUserData.
/// \param[in] dwMaxSendPacketSize Specifies the maximum size in bytes of an EAP packet sent during the session. If the method needs to send a packet larger than the maximum size, the method must accommodate fragmentation and reassembly.
///
/// \returns Session handle
///
virtual EAP_SESSION_HANDLE begin_session(
@@ -907,25 +830,13 @@ namespace eap
///
/// \sa [EapPeerEndSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363604.aspx)
///
/// \param[in] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
///
virtual void end_session(_In_ EAP_SESSION_HANDLE hSession) = 0;
/// @}
/// \name Packet processing
/// @{
///
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///
/// \param[in] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
/// \param[in] pReceivedPacket Received packet data
/// \param[in] dwReceivedPacketSize \p pReceivedPacket size in bytes
/// \param[in] pEapOutput A pointer to a structure that contains the output of the packet process operation.
///
virtual void process_request_packet(
_In_ EAP_SESSION_HANDLE hSession,
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
@@ -937,33 +848,20 @@ namespace eap
///
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
///
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
/// \param[inout] pSendPacket A pointer to a structure that contains the response packet.
/// \param[inout] pdwSendPacketSize A pointer to a value that contains the size in bytes of the buffer allocated for the response packet. On return, this parameter receives a pointer to the actual size in bytes of \p pSendPacket.
///
virtual void get_response_packet(
_In_ EAP_SESSION_HANDLE hSession,
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize) = 0;
/// @}
///
/// Obtains the result of an authentication session from the EAP method.
///
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
///
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
/// \param[in ] reason The reason code for the authentication result returned in \p pResult.
/// \param[out] pResult A pointer to a structure that contains the authentication results.
///
virtual void get_result(
_In_ EAP_SESSION_HANDLE hSession,
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult) = 0;
/// \name User Interaction
/// @{
_Inout_ EapPeerMethodResult *pResult) = 0;
///
/// Obtains the user interface context from the EAP method.
@@ -972,14 +870,10 @@ namespace eap
///
/// \sa [EapPeerGetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363612.aspx)
///
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
/// \param[out] ppUIContextData A pointer to an address that contains a byte buffer with the supplicant user interface context data from EAPHost.
/// \param[out] pdwUIContextDataSize A pointer to a value that specifies the size of the user interface context data byte buffer returned in \p ppUIContextData.
///
virtual void get_ui_context(
_In_ EAP_SESSION_HANDLE hSession,
_Out_ BYTE **ppUIContextData,
_Out_ DWORD *pdwUIContextDataSize) = 0;
_Inout_ BYTE **ppUIContextData,
_Inout_ DWORD *pdwUIContextDataSize) = 0;
///
/// Provides a user interface context to the EAP method.
@@ -988,43 +882,26 @@ namespace eap
///
/// \sa [EapPeerSetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363626.aspx)
///
/// \param[in] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
/// \param[in] pUIContextData A pointer to an address that contains a byte buffer with the new supplicant UI context data to set on EAPHost.
/// \param[in] dwUIContextDataSize \p pUIContextData size in bytes
/// \param[in] pEapOutput A pointer to a structure that contains the output of the packet process operation.
///
virtual void set_ui_context(
_In_ EAP_SESSION_HANDLE hSession,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ DWORD dwUIContextDataSize,
_Out_ EapPeerMethodOutput *pEapOutput) = 0;
/// @}
/// \name EAP Response Attributes
/// @{
///
/// Obtains an array of EAP response attributes from the EAP method.
///
/// \sa [EapPeerGetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363609.aspx)
///
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
/// \param[out] pAttribs A pointer to a structure that contains an array of EAP authentication response attributes for the supplicant.
///
virtual void get_response_attributes(
_In_ EAP_SESSION_HANDLE hSession,
_Out_ EapAttributes *pAttribs) = 0;
_Inout_ EapAttributes *pAttribs) = 0;
///
/// Provides an updated array of EAP response attributes to the EAP method.
///
/// \sa [EapPeerSetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363625.aspx)
///
/// \param[in] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
/// \param[in] pAttribs A pointer to a structure that contains an array of new EAP authentication response attributes to set for the supplicant on EAPHost.
/// \param[in] pEapOutput A pointer to a structure that contains the output of the packet process operation.
///
virtual void set_response_attributes(
_In_ EAP_SESSION_HANDLE hSession,
_In_ const EapAttributes *pAttribs,
@@ -1032,6 +909,4 @@ namespace eap
/// @}
};
/// @}
}

View File

@@ -1,102 +0,0 @@
/*
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/>.
*/
namespace eap
{
class ui_context;
}
#pragma once
#include "Config.h"
#include "Credentials.h"
#include "Module.h"
#include "../../../include/Version.h"
namespace eap
{
///
/// \defgroup EAPBaseUICtx UI Context
/// Back and front-end inter-process data exchange
///
/// @{
///
/// UI context
///
class ui_context : public packable
{
public:
///
/// Constructs context
///
/// \param[in] cfg Connection configuration
/// \param[in] cred Connection credentials
///
ui_context(_In_ config_connection &cfg, _In_ credentials_connection &cred);
///
/// Copies context
///
/// \param[in] other Credentials to copy from
///
ui_context(_In_ const ui_context &other);
///
/// Moves context
///
/// \param[in] other Credentials to move from
///
ui_context(_Inout_ ui_context &&other);
///
/// Copies context
///
/// \param[in] other Credentials to copy from
///
/// \returns Reference to this object
///
ui_context& operator=(_In_ const ui_context &other);
///
/// Moves context
///
/// \param[in] other Configuration to move from
///
/// \returns Reference to this object
///
ui_context& operator=(_Inout_ ui_context &&other);
/// \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);
/// @}
public:
config_connection &m_cfg; ///< Connection configuration
credentials_connection &m_cred; ///< Connection credentials
};
/// @}
}

View File

@@ -77,6 +77,24 @@ 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

@@ -163,183 +163,6 @@ tstring eap::credentials::get_name() const
}
//////////////////////////////////////////////////////////////////////
// eap::credentials_identity
//////////////////////////////////////////////////////////////////////
eap::credentials_identity::credentials_identity(_In_ module &mod) : credentials(mod)
{
}
eap::credentials_identity::credentials_identity(_In_ const credentials_identity &other) : credentials(other)
{
}
eap::credentials_identity::credentials_identity(_Inout_ credentials_identity &&other) : credentials(std::move(other))
{
}
eap::credentials_identity& eap::credentials_identity::operator=(_In_ const credentials_identity &other)
{
if (this != &other)
(credentials&)*this = other;
return *this;
}
eap::credentials_identity& eap::credentials_identity::operator=(_Inout_ credentials_identity &&other)
{
if (this != &other)
(credentials&)*this = std::move(other);
return *this;
}
eap::config* eap::credentials_identity::clone() const
{
return new credentials_identity(*this);
}
void eap::credentials_identity::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
{
assert(pDoc);
assert(pConfigRoot);
// We could have used credentials::save() to save identity,
// but that method tolerates absence of <UserName> element,
// whereas for this class the absence of <UserName> is fatal.
config::save(pDoc, pConfigRoot);
HRESULT hr;
// <UserName>
if (FAILED(hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"UserName"), namespace_eapmetadata, bstr(m_identity))))
throw com_runtime_error(hr, __FUNCTION__ " Error creating <UserName> element.");
}
void eap::credentials_identity::load(_In_ IXMLDOMNode *pConfigRoot)
{
assert(pConfigRoot);
HRESULT hr;
// We could have used credentials::load() to load identity,
// but that method tolerates absence of <UserName> element,
// whereas for this class the absence of <UserName> is fatal.
config::load(pConfigRoot);
wstring xpath(eapxml::get_xpath(pConfigRoot));
if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:UserName"), m_identity)))
throw com_runtime_error(hr, __FUNCTION__ " Error reading <UserName> element.");
m_module.log_config((xpath + L"/UserName").c_str(), m_identity.c_str());
}
void eap::credentials_identity::store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level) const
{
assert(pszTargetName);
tstring target(target_name(pszTargetName, level));
// Write credentials.
assert(m_identity.length() < CRED_MAX_USERNAME_LENGTH);
CREDENTIAL cred = {
0, // Flags
CRED_TYPE_GENERIC, // Type
const_cast<LPTSTR>(target.c_str()), // TargetName
_T(""), // Comment
{ 0, 0 }, // LastWritten
0, // CredentialBlobSize
NULL, // CredentialBlob
CRED_PERSIST_ENTERPRISE, // Persist
0, // AttributeCount
NULL, // Attributes
NULL, // TargetAlias
const_cast<LPTSTR>(m_identity.c_str()) // UserName
};
if (!CredWrite(&cred, 0))
throw win_runtime_error(__FUNCTION__ " CredWrite failed.");
}
void eap::credentials_identity::retrieve(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level)
{
assert(pszTargetName);
// Read credentials.
unique_ptr<CREDENTIAL, CredFree_delete<CREDENTIAL> > cred;
if (!CredRead(target_name(pszTargetName, level).c_str(), CRED_TYPE_GENERIC, 0, (PCREDENTIAL*)&cred))
throw win_runtime_error(__FUNCTION__ " CredRead failed.");
if (cred->UserName)
m_identity = cred->UserName;
else
m_identity.clear();
wstring xpath(pszTargetName);
m_module.log_config((xpath + L"/Identity").c_str(), m_identity.c_str());
}
LPCTSTR eap::credentials_identity::target_suffix() const
{
return _T("id");
}
eap::credentials::source_t eap::credentials_identity::combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName)
{
UNREFERENCED_PARAMETER(dwFlags);
if (cred_cached) {
// Using EAP service cached credentials.
*this = *dynamic_cast<const credentials_identity*>(cred_cached);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CACHED2, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_identity::get_name()), event_data(pszTargetName), event_data::blank);
return source_cache;
}
auto cfg_with_cred = dynamic_cast<const config_method_with_cred*>(&cfg);
if (cfg_with_cred && cfg_with_cred->m_use_cred) {
// Using configured credentials.
*this = *dynamic_cast<const credentials_identity*>(cfg_with_cred->m_cred.get());
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CONFIG2, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_identity::get_name()), event_data(pszTargetName), event_data::blank);
return source_config;
}
if (pszTargetName) {
// Switch user context.
user_impersonator impersonating(hTokenImpersonateUser);
try {
credentials_identity cred_loaded(m_module);
cred_loaded.retrieve(pszTargetName, cfg.m_level);
// Using stored credentials.
*this = std::move(cred_loaded);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_STORED2, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_identity::get_name()), event_data(pszTargetName), event_data::blank);
return source_storage;
} catch (...) {
// Not actually an error.
}
}
return source_unknown;
}
//////////////////////////////////////////////////////////////////////
// eap::credentials_pass
//////////////////////////////////////////////////////////////////////
@@ -602,40 +425,32 @@ LPCTSTR eap::credentials_pass::target_suffix() const
eap::credentials::source_t eap::credentials_pass::combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_ const credentials *cred_cached,
_In_ const config_method_with_cred &cfg,
_In_opt_z_ LPCTSTR pszTargetName)
{
UNREFERENCED_PARAMETER(dwFlags);
if (cred_cached) {
// Using EAP service cached credentials.
*this = *dynamic_cast<const credentials_pass*>(cred_cached);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CACHED2, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_pass::get_name()), event_data(pszTargetName), event_data::blank);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CACHED1, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_pass::get_name()), event_data::blank);
return source_cache;
}
auto cfg_with_cred = dynamic_cast<const config_method_with_cred*>(&cfg);
if (cfg_with_cred && cfg_with_cred->m_use_cred) {
if (cfg.m_use_cred) {
// Using configured credentials.
*this = *dynamic_cast<const credentials_pass*>(cfg_with_cred->m_cred.get());
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CONFIG2, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_pass::get_name()), event_data(pszTargetName), event_data::blank);
*this = *dynamic_cast<const credentials_pass*>(cfg.m_cred.get());
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CONFIG1, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_pass::get_name()), event_data::blank);
return source_config;
}
if (pszTargetName) {
// Switch user context.
user_impersonator impersonating(hTokenImpersonateUser);
try {
credentials_pass cred_loaded(m_module);
cred_loaded.retrieve(pszTargetName, cfg.m_level);
// Using stored credentials.
*this = std::move(cred_loaded);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_STORED2, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_pass::get_name()), event_data(pszTargetName), event_data::blank);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_STORED1, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_pass::get_name()), event_data::blank);
return source_storage;
} catch (...) {
// Not actually an error.
@@ -646,7 +461,6 @@ eap::credentials::source_t eap::credentials_pass::combine(
}
/// \cond internal
const unsigned char eap::credentials_pass::s_entropy[1024] = {
0x40, 0x88, 0xd3, 0x13, 0x81, 0x8a, 0xf6, 0x74, 0x55, 0x8e, 0xcc, 0x73, 0x2c, 0xf8, 0x93, 0x37,
0x4f, 0xeb, 0x1d, 0x66, 0xb7, 0xfb, 0x47, 0x75, 0xb4, 0xfd, 0x07, 0xbb, 0xf6, 0xb3, 0x05, 0x30,
@@ -713,7 +527,6 @@ const unsigned char eap::credentials_pass::s_entropy[1024] = {
0x30, 0x29, 0x39, 0x9a, 0xd6, 0xab, 0x2e, 0xc6, 0x42, 0x47, 0x5e, 0x54, 0xbb, 0x90, 0xe6, 0x98,
0xe6, 0x52, 0x58, 0x58, 0x1e, 0xd0, 0x00, 0x9c, 0x8f, 0x4a, 0x17, 0x7e, 0x8a, 0x5a, 0xef, 0x3e,
};
/// \endcond
//////////////////////////////////////////////////////////////////////
@@ -838,7 +651,8 @@ void eap::credentials_connection::load(_In_ IXMLDOMNode *pConfigRoot)
// Matching provider found. Create matching blank credential set, then load.
if (cfg_prov->m_methods.empty())
throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()));
m_cred.reset(cfg_prov->m_methods.front().get()->make_credentials());
const config_method_with_cred *cfg_method = dynamic_cast<const config_method_with_cred*>(cfg_prov->m_methods.front().get());
m_cred.reset(cfg_method->make_credentials());
m_cred->load(pXmlElClientSideCredential);
break;
}
@@ -880,7 +694,8 @@ void eap::credentials_connection::operator>>(_Inout_ cursor_in &cursor)
// Matching provider found. Create matching blank credential set, then read.
if (cfg_prov->m_methods.empty())
throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()));
m_cred.reset(cfg_prov->m_methods.front().get()->make_credentials());
const config_method_with_cred *cfg_method = dynamic_cast<const config_method_with_cred*>(cfg_prov->m_methods.front().get());
m_cred.reset(cfg_method->make_credentials());
cursor >> *m_cred;
break;
}

View File

@@ -20,106 +20,64 @@
#include "StdAfx.h"
#pragma comment(lib, "Ws2_32.lib")
using namespace std;
using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::packable
// eap::packet
//////////////////////////////////////////////////////////////////////
eap::packable::packable()
eap::packet::packet() :
m_code((EapCode)0),
m_id(0)
{
}
void eap::packable::operator<<(_Inout_ cursor_out &cursor) const
eap::packet::packet(_In_ const packet &other) :
m_code(other.m_code),
m_id (other.m_id ),
m_data(other.m_data)
{
UNREFERENCED_PARAMETER(cursor);
}
size_t eap::packable::get_pk_size() const
eap::packet::packet(_Inout_ packet &&other) :
m_code(std::move(other.m_code)),
m_id (std::move(other.m_id )),
m_data(std::move(other.m_data))
{
return 0;
}
void eap::packable::operator>>(_Inout_ cursor_in &cursor)
eap::packet& eap::packet::operator=(_In_ const packet &other)
{
UNREFERENCED_PARAMETER(cursor);
if (this != std::addressof(other)) {
m_code = other.m_code;
m_id = other.m_id ;
m_data = other.m_data;
}
return *this;
}
//////////////////////////////////////////////////////////////////////
// eap::diameter_avp_append
//////////////////////////////////////////////////////////////////////
void eap::diameter_avp_append(
_In_ unsigned int code,
_In_ unsigned char flags,
_In_bytecount_(size) const void *data,
_In_ unsigned int size,
_Inout_ sanitizing_blob &packet)
eap::packet& eap::packet::operator=(_Inout_ packet &&other)
{
unsigned int
padding = (unsigned int)((4 - size) % 4),
size_outer;
if (this != std::addressof(other)) {
m_code = std::move(other.m_code);
m_id = std::move(other.m_id );
m_data = std::move(other.m_data);
}
packet.reserve(
packet.size() +
(size_outer =
sizeof(diameter_avp_header) + // Diameter header
size) + // Data
padding); // Data padding
// Diameter AVP header
diameter_avp_header hdr;
*reinterpret_cast<unsigned int*>(hdr.code) = htonl(code);
hdr.flags = flags;
hton24(size_outer, hdr.length);
packet.insert(packet.end(), reinterpret_cast<const unsigned char*>(&hdr), reinterpret_cast<const unsigned char*>(&hdr + 1));
// Data
packet.insert(packet.end(), reinterpret_cast<const unsigned char*>(data), reinterpret_cast<const unsigned char*>(data) + size);
packet.insert(packet.end(), padding, 0);
return *this;
}
//////////////////////////////////////////////////////////////////////
// eap::diameter_avp_append
//////////////////////////////////////////////////////////////////////
void eap::diameter_avp_append(
_In_ unsigned int code,
_In_ unsigned int vendor_id,
_In_ unsigned char flags,
_In_bytecount_(size) const void *data,
_In_ unsigned int size,
_Inout_ sanitizing_blob &packet)
void eap::packet::clear()
{
unsigned int
padding = (unsigned int)((4 - size) % 4),
size_outer;
packet.reserve(
packet.size() +
(size_outer =
sizeof(diameter_avp_header_ven) + // Diameter header
size) + // Data
padding); // Data padding
// Diameter AVP header
diameter_avp_header_ven hdr;
*reinterpret_cast<unsigned int*>(hdr.code) = htonl(code);
hdr.flags = flags | diameter_avp_flag_vendor;
hton24(size_outer, hdr.length);
*reinterpret_cast<unsigned int*>(hdr.vendor) = htonl(vendor_id);
packet.insert(packet.end(), reinterpret_cast<const unsigned char*>(&hdr), reinterpret_cast<const unsigned char*>(&hdr + 1));
// Data
packet.insert(packet.end(), reinterpret_cast<const unsigned char*>(data), reinterpret_cast<const unsigned char*>(data) + size);
packet.insert(packet.end(), padding, 0);
m_code = (EapCode)0;
m_id = 0;
m_data.clear();
}

View File

@@ -28,14 +28,19 @@ using namespace winstd;
// eap::method
//////////////////////////////////////////////////////////////////////
eap::method::method(_In_ module &mod) :
m_module(mod)
eap::method::method(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred) :
m_module(module),
m_cfg(cfg),
m_cred(cred)
{
}
eap::method::method(_Inout_ method &&other) :
m_module(other.m_module)
m_module ( other.m_module ),
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_eap_attr(std::move(other.m_eap_attr))
{
}
@@ -44,6 +49,9 @@ eap::method& eap::method::operator=(_Inout_ method &&other)
{
if (this != std::addressof(other)) {
assert(std::addressof(m_module) == std::addressof(other.m_module)); // Move method within same module only!
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method with same configuration only!
assert(std::addressof(m_cred ) == std::addressof(other.m_cred )); // Move method with same credentials only!
m_eap_attr = std::move(other.m_eap_attr);
}
return *this;
@@ -60,6 +68,11 @@ void eap::method::begin_session(
UNREFERENCED_PARAMETER(pAttributeArray);
UNREFERENCED_PARAMETER(hTokenImpersonateUser);
UNREFERENCED_PARAMETER(dwMaxSendPacketSize);
// Presume authentication will fail with generic protocol failure. (Pesimist!!!)
// We will reset once we get get_result(Success) call.
m_cfg.m_last_status = config_method::status_auth_failed;
m_cfg.m_last_msg.clear();
}
@@ -72,282 +85,123 @@ void eap::method::get_result(
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult)
{
UNREFERENCED_PARAMETER(reason);
UNREFERENCED_PARAMETER(pResult);
}
assert(pResult);
switch (reason) {
case EapPeerMethodResultSuccess: {
m_module.log_event(&EAPMETHOD_METHOD_SUCCESS, event_data((unsigned int)m_cfg.get_method_id()), event_data::blank);
m_cfg.m_last_status = config_method::status_success;
break;
}
void eap::method::get_ui_context(_Out_ sanitizing_blob &context_data)
{
// Default implementation returns blank context data.
context_data.clear();
}
case EapPeerMethodResultFailure:
m_module.log_event(&EAPMETHOD_METHOD_FAILURE_ERROR2, event_data((unsigned int)m_cfg.get_method_id()), event_data((unsigned int)m_cfg.m_last_status), event_data::blank);
break;
default:
throw win_runtime_error(ERROR_NOT_SUPPORTED, __FUNCTION__ " Not supported.");
}
EapPeerMethodResponseAction eap::method::set_ui_context(
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ DWORD dwUIContextDataSize)
{
UNREFERENCED_PARAMETER(pUIContextData);
UNREFERENCED_PARAMETER(dwUIContextDataSize);
// Default implementation does nothing with context data.
return EapPeerMethodResponseActionNone;
}
void eap::method::get_response_attributes(_Inout_ EapAttributes *pAttribs)
{
assert(pAttribs);
// Default implementation returns no EAP attributes.
pAttribs->dwNumberOfAttributes = 0;
pAttribs->pAttribs = NULL;
}
EapPeerMethodResponseAction eap::method::set_response_attributes(_In_ const EapAttributes *pAttribs)
{
UNREFERENCED_PARAMETER(pAttribs);
// Default implementation does nothing with EAP attributes.
return EapPeerMethodResponseActionNone;
// Always ask EAP host to save the connection data. And it will save it *only* when we report "success".
// Don't worry. EapHost is well aware of failed authentication condition.
pResult->fSaveConnectionData = TRUE;
pResult->fIsSuccess = TRUE;
}
//////////////////////////////////////////////////////////////////////
// eap::method_tunnel
// eap::method_noneap
//////////////////////////////////////////////////////////////////////
eap::method_tunnel::method_tunnel(_In_ module &mod, _In_ method *inner) :
m_inner(inner),
method(mod)
eap::method_noneap::method_noneap(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred) : method(module, cfg, cred)
{
}
eap::method_tunnel::method_tunnel(_Inout_ method_tunnel &&other) :
m_inner(std::move(other.m_inner)),
eap::method_noneap::method_noneap(_Inout_ method_noneap &&other) :
m_packet_res(std::move(other.m_packet_res)),
method (std::move(other ))
{
}
eap::method_tunnel& eap::method_tunnel::operator=(_Inout_ method_tunnel &&other)
eap::method_noneap& eap::method_noneap::operator=(_Inout_ method_noneap &&other)
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move method with same credentials only!
(method&)*this = std::move(other );
m_inner = std::move(other.m_inner);
m_packet_res = std::move(other.m_packet_res);
}
return *this;
}
void eap::method_tunnel::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize)
void eap::method_noneap::get_response_packet(
_Inout_bytecap_(*dwSendPacketSize) void *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize)
{
method::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
assert(pdwSendPacketSize);
assert(pSendPacket);
assert(m_inner);
m_inner->begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
size_t size_packet = m_packet_res.size();
if (size_packet > *pdwSendPacketSize)
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).", size_packet, *pdwSendPacketSize));
memcpy(pSendPacket, m_packet_res.data(), size_packet);
*pdwSendPacketSize = (DWORD)size_packet;
m_packet_res.clear();
}
void eap::method_tunnel::end_session()
void eap::method_noneap::append_avp(_In_ unsigned int code, _In_ unsigned char flags, _In_bytecount_(size) const void *data, _In_ unsigned int size)
{
assert(m_inner);
m_inner->end_session();
unsigned int
padding = (unsigned int)((4 - size) % 4),
size_outer;
method::end_session();
m_packet_res.reserve(
m_packet_res.size() +
(size_outer =
sizeof(diameter_avp_header) + // Diameter header
size) + // Data
padding); // Data padding
// Diameter AVP header
diameter_avp_header hdr;
*reinterpret_cast<unsigned int*>(hdr.code) = htonl(code);
hdr.flags = flags;
hton24(size_outer, hdr.length);
m_packet_res.insert(m_packet_res.end(), reinterpret_cast<const unsigned char*>(&hdr), reinterpret_cast<const unsigned char*>(&hdr + 1));
// Data
m_packet_res.insert(m_packet_res.end(), reinterpret_cast<const unsigned char*>(data), reinterpret_cast<const unsigned char*>(data) + size);
m_packet_res.insert(m_packet_res.end(), padding, 0);
}
EapPeerMethodResponseAction eap::method_tunnel::process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize)
void eap::method_noneap::append_avp(_In_ unsigned int code, _In_ unsigned int vendor_id, _In_ unsigned char flags, _In_bytecount_(size) const void *data, _In_ unsigned int size)
{
assert(m_inner);
return m_inner->process_request_packet(pReceivedPacket, dwReceivedPacketSize);
}
void eap::method_tunnel::get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max)
{
assert(m_inner);
m_inner->get_response_packet(packet, size_max);
}
void eap::method_tunnel::get_result(
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult)
{
assert(m_inner);
m_inner->get_result(reason, pResult);
}
void eap::method_tunnel::get_ui_context(_Out_ sanitizing_blob &context_data)
{
assert(m_inner);
// Default implementation forwards UI context handling to the inner method.
m_inner->get_ui_context(context_data);
}
EapPeerMethodResponseAction eap::method_tunnel::set_ui_context(
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ DWORD dwUIContextDataSize)
{
assert(m_inner);
// Default implementation forwards UI context handling to the inner method.
return m_inner->set_ui_context(pUIContextData, dwUIContextDataSize);
}
void eap::method_tunnel::get_response_attributes(_Inout_ EapAttributes *pAttribs)
{
assert(m_inner);
m_inner->get_response_attributes(pAttribs);
}
EapPeerMethodResponseAction eap::method_tunnel::set_response_attributes(_In_ const EapAttributes *pAttribs)
{
assert(m_inner);
return m_inner->set_response_attributes(pAttribs);
}
//////////////////////////////////////////////////////////////////////
// eap::method_eap
//////////////////////////////////////////////////////////////////////
eap::method_eap::method_eap(_In_ module &mod, _In_ winstd::eap_type_t eap_method, _In_ method *inner) :
m_eap_method(eap_method),
m_id(0),
m_send_nak(false),
method_tunnel(mod, inner)
{
}
eap::method_eap::method_eap(_Inout_ method_eap &&other) :
m_eap_method (std::move(other.m_eap_method)),
m_id (std::move(other.m_id )),
m_send_nak (std::move(other.m_send_nak )),
method_tunnel(std::move(other ))
{
}
eap::method_eap& eap::method_eap::operator=(_Inout_ method_eap &&other)
{
if (this != std::addressof(other)) {
assert(m_eap_method == other.m_eap_method); // Move method within same EAP method type only!
(method_tunnel&)*this = std::move(other );
m_id = std::move(other.m_id );
m_send_nak = std::move(other.m_send_nak);
}
return *this;
}
void eap::method_eap::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize)
{
// Initialize tunnel method session only.
method::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
// Inner method can generate packets of up to 64kB (less the EAP packet header).
// Initialize inner method with appropriately less packet size maximum.
if (dwMaxSendPacketSize < sizeof(EapPacket))
throw invalid_argument(string_printf(__FUNCTION__ " Maximum packet size too small (minimum: %u, available: %u).", sizeof(EapPacket) + 1, dwMaxSendPacketSize));
assert(m_inner);
m_inner->begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, std::min<DWORD>(dwMaxSendPacketSize, MAXWORD) - sizeof(EapPacket));
}
EapPeerMethodResponseAction eap::method_eap::process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize)
{
assert(dwReceivedPacketSize >= sizeof(EapPacket)); // Request packet should contain an EAP packet header at least.
auto hdr = reinterpret_cast<const EapPacket*>(pReceivedPacket);
// This must be an EAP-Request packet.
if (hdr->Code != EapCodeRequest)
throw invalid_argument(string_printf(__FUNCTION__ " Unknown EAP packet received (expected: %u, received: %u).", EapCodeRequest, (int)hdr->Code));
// Check packet size.
DWORD size_packet = ntohs(*reinterpret_cast<const unsigned short*>(hdr->Length));
if (size_packet > dwReceivedPacketSize)
throw invalid_argument(string_printf(__FUNCTION__ " Incorrect EAP packet length (expected: %uB, received: %uB).", size_packet, dwReceivedPacketSize));
// Save request packet ID to make matching response packet in get_response_packet() later.
m_id = hdr->Id;
if (hdr->Data[0] != m_eap_method) {
// Unsupported EAP method. Respond with Legacy Nak.
m_send_nak = true;
return EapPeerMethodResponseActionSend;
} else {
// Process the data with underlying method.
m_send_nak = false;
return method_tunnel::process_request_packet(hdr->Data + 1, size_packet - sizeof(EapPacket));
}
}
void eap::method_eap::get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max)
{
assert(size_max >= sizeof(EapPacket)); // We should be able to respond with at least an EAP packet header.
if (size_max > MAXWORD) size_max = MAXWORD; // EAP packets maximum size is 64kB.
// Prepare EAP packet header.
EapPacket hdr;
hdr.Code = (BYTE)EapCodeResponse;
hdr.Id = m_id;
if (!m_send_nak) {
hdr.Data[0] = m_eap_method;
packet.reserve(size_max); // To avoid reallocation when inserting EAP packet header later.
// Get data from underlying method.
method_tunnel::get_response_packet(packet, size_max - sizeof(EapPacket));
} else {
// Respond with Legacy Nak suggesting our EAP method to continue.
hdr.Data[0] = eap_type_nak;
// Check packet size. We will suggest one EAP method alone, so we need one byte for data.
size_t size_packet = sizeof(EapPacket) + 1;
if (size_packet > 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).", size_packet, size_max));
packet.reserve(size_packet); // To avoid reallocation when inserting EAP packet header later.
// Data of Legacy Nak packet is a list of supported EAP types: our method alone.
packet.assign(1, m_eap_method);
}
size_t size_packet = packet.size() + sizeof(EapPacket);
assert(size_packet <= MAXWORD); // Packets spanning over 64kB are not supported.
*reinterpret_cast<unsigned short*>(hdr.Length) = htons((unsigned short)size_packet);
// Insert EAP packet header before data.
packet.insert(packet.begin(), reinterpret_cast<const unsigned char*>(&hdr), reinterpret_cast<const unsigned char*>(&hdr + 1));
unsigned int
padding = (unsigned int)((4 - size) % 4),
size_outer;
m_packet_res.reserve(
m_packet_res.size() +
(size_outer =
sizeof(diameter_avp_header_ven) + // Diameter header
size) + // Data
padding); // Data padding
// Diameter AVP header
diameter_avp_header_ven hdr;
*reinterpret_cast<unsigned int*>(hdr.code) = htonl(code);
hdr.flags = flags | diameter_avp_flag_vendor;
hton24(size_outer, hdr.length);
*reinterpret_cast<unsigned int*>(hdr.vendor) = htonl(vendor_id);
m_packet_res.insert(m_packet_res.end(), reinterpret_cast<const unsigned char*>(&hdr), reinterpret_cast<const unsigned char*>(&hdr + 1));
// Data
m_packet_res.insert(m_packet_res.end(), reinterpret_cast<const unsigned char*>(data), reinterpret_cast<const unsigned char*>(data) + size);
m_packet_res.insert(m_packet_res.end(), padding, 0);
}

View File

@@ -90,12 +90,6 @@ EAP_ERROR* eap::module::make_error(_In_ std::exception &err) const
wstring what;
MultiByteToWideChar(CP_ACP, 0, err.what(), -1, what);
{
eap_runtime_error *e = dynamic_cast<eap_runtime_error*>(&err);
if (e)
return make_error(e->number(), e->root_cause(), e->repair(), e->reason(), &e->root_cause_id(), &e->repair_id(), &e->help_link_id());
}
{
win_runtime_error *e = dynamic_cast<win_runtime_error*>(&err);
if (e)
@@ -128,19 +122,6 @@ EAP_ERROR* eap::module::make_error(_In_ std::exception &err) const
}
EAP_ERROR* eap::module::make_error(_In_ const EAP_ERROR *err) const
{
return make_error(
err->dwWinError,
err->pRootCauseString,
err->pRepairString,
err->dwReasonCode,
&(err->rootCauseGuid),
&(err->repairGuid),
&(err->helpLinkGuid));
}
BYTE* eap::module::alloc_memory(_In_ size_t size)
{
BYTE *p = (BYTE*)HeapAlloc(m_heap, 0, size);
@@ -270,7 +251,7 @@ void eap::peer::query_credential_input_fields(
_In_ DWORD dwFlags,
_In_ DWORD dwConnectionDataSize,
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
_Out_ EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldsArray) const
_Inout_ EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldsArray) const
{
UNREFERENCED_PARAMETER(hUserImpersonationToken);
UNREFERENCED_PARAMETER(dwFlags);
@@ -288,8 +269,8 @@ void eap::peer::query_user_blob_from_credential_input_fields(
_In_ DWORD dwConnectionDataSize,
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
_In_ const EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldArray,
_Out_ DWORD *pdwUsersBlobSize,
_Out_ BYTE **ppUserBlob) const
_Inout_ DWORD *pdwUsersBlobSize,
_Inout_ BYTE **ppUserBlob) const
{
UNREFERENCED_PARAMETER(hUserImpersonationToken);
UNREFERENCED_PARAMETER(dwFlags);
@@ -308,7 +289,7 @@ void eap::peer::query_interactive_ui_input_fields(
_In_ DWORD dwFlags,
_In_ DWORD dwUIContextDataSize,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_Out_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData) const
_Inout_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData) const
{
UNREFERENCED_PARAMETER(dwVersion);
UNREFERENCED_PARAMETER(dwFlags);
@@ -326,8 +307,8 @@ void eap::peer::query_ui_blob_from_interactive_ui_input_fields(
_In_ DWORD dwUIContextDataSize,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ const EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
_Out_ DWORD *pdwDataFromInteractiveUISize,
_Out_ BYTE **ppDataFromInteractiveUI) const
_Inout_ DWORD *pdwDataFromInteractiveUISize,
_Inout_ BYTE **ppDataFromInteractiveUI) const
{
UNREFERENCED_PARAMETER(dwVersion);
UNREFERENCED_PARAMETER(dwFlags);

View File

@@ -24,7 +24,6 @@
#include "../include/Credentials.h"
#include "../include/Method.h"
#include "../include/Module.h"
#include "../include/UIContext.h"
#include "../include/EAP.h"
#include "../include/EAPXML.h"

View File

@@ -1,100 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"
using namespace std;
using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::ui_context
//////////////////////////////////////////////////////////////////////
eap::ui_context::ui_context(_In_ config_connection &cfg, _In_ credentials_connection &cred) :
m_cfg(cfg),
m_cred(cred)
{
}
eap::ui_context::ui_context(_In_ const ui_context &other) :
m_cfg (other.m_cfg ),
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 ),
packable(std::move(other ))
{
}
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!
(packable&)*this = other;
}
return *this;
}
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!
(packable&)*this = std::move(other);
}
return *this;
}
void eap::ui_context::operator<<(_Inout_ cursor_out &cursor) const
{
packable::operator<<(cursor);
cursor << m_cfg ;
cursor << m_cred;
}
size_t eap::ui_context::get_pk_size() const
{
return
packable::get_pk_size() +
pksizeof(m_cfg ) +
pksizeof(m_cred);
}
void eap::ui_context::operator>>(_Inout_ cursor_in &cursor)
{
packable::operator>>(cursor);
cursor >> m_cfg ;
cursor >> m_cred;
}

View File

@@ -27,76 +27,101 @@
#include <Windows.h>
///
/// Reusable EAP dialog banner for `wxEAPConfigDialog` and `wxEAPCredentialsDialog`
///
class wxEAPBannerPanel;
template <class _wxT> class wxEAPConfigDialog;
class wxEAPGeneralDialog;
class wxEAPCredentialsDialog;
class wxEAPNotePanel;
class wxEAPProviderLockedPanel;
class wxEAPCredentialWarningPanel;
#if __DANGEROUS__LOG_CONFIDENTIAL_DATA
class wxEAPCredentialLogWarningPanel;
#endif
class wxEAPConfigWindow;
class wxEAPProviderContactInfoPanel;
class wxEAPProviderIDPanel;
class wxEAPConfigProvider;
template <class _Tcred, class _wxT> class wxEAPCredentialsConfigPanel;
template <class _Tcred, class _Tbase> class wxEAPCredentialsPanel;
template <class _Tcred, class _Tbase> class wxIdentityCredentialsPanel;
template <class _Tcred, class _Tbase> class wxPasswordCredentialsPanel;
class wxEAPProviderSelectDialog;
///
/// \defgroup EAPBaseGUI GUI
/// Graphical User Interface
/// EAP top-most configuration dialog
///
/// @{
template <class _wxT> class wxEAPConfigDialog;
///
/// EAP general-use dialog
///
class wxEAPGeneralDialog;
///
/// EAP method credential dialog
///
class wxEAPCredentialsDialog;
///
/// EAP connection credential dialog
///
class wxEAPCredentialsConnectionDialog;
///
/// EAP general note
///
class wxEAPNotePanel;
///
/// EAP provider-locked congifuration note
///
class wxEAPProviderLockedPanel;
///
/// EAP credential warning note
///
class wxEAPCredentialWarningPanel;
#if __DANGEROUS__LOG_CONFIDENTIAL_DATA
///
/// EAP credential logging enabled warning note
///
class wxEAPCredentialLogWarningPanel;
#endif
///
/// EAP Configuration window
///
class wxEAPConfigWindow;
///
/// EAP provider contact info config panel
///
class wxEAPProviderContactInfoPanel;
///
/// EAP provider identity config panel
///
class wxEAPProviderIDPanel;
///
/// EAP provider configuration dialog
///
class wxEAPConfigProvider;
///
/// Base template for credential configuration panel
///
template <class _Tcred, class _wxT> class wxEAPCredentialsConfigPanel;
///
/// Helper template for all credential entry panels
///
template <class _Tcred, class _Tbase> class wxEAPCredentialsPanel;
///
/// Generic password credential entry panel
///
template <class _Tcred, class _Tbase> class wxPasswordCredentialsPanel;
///
/// Loads icon from resource
///
/// When icon of desired \p cx × \p cy dimensions is not found, the most appropriate variant (larger if available) is loaded and scaled to \p cx × \p cy.
///
/// \sa [LoadIconWithScaleDown function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb775703.aspx)
///
/// \param[in] hinst Resource module instance handle
/// \param[in] pszName Resource name (`MAKEINTRESOURCE()` macro can be used for numerical resources)
/// \param[in] cx Desired width of the icon
/// \param[in] cy Desired height of the icon
///
/// \returns
/// - Loaded icon when successful;
/// - \c wxNullIcon otherwise.
///
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, int cx = GetSystemMetrics(SM_CXICON), int cy = GetSystemMetrics(SM_CYICON));
///
/// Loads icon from resource
///
/// When icon of desired \p size dimensions is not found, the most appropriate variant (larger if available) is loaded and scaled to \p size.
///
/// \sa [LoadIconWithScaleDown function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb775703.aspx)
///
/// \param[in] hinst Resource module instance handle
/// \param[in] pszName Resource name (`MAKEINTRESOURCE()` macro can be used for numerical resources)
/// \param[in] size Desired width and height of the icon
///
/// \returns
/// - Loaded icon when successful;
/// - \c wxNullIcon otherwise.
///
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, const wxSize &size);
///
/// Returns GUI displayable provider name
///
/// \param[in] id Provider name
///
/// \returns
/// - \p id when \p id is not blank;
/// - localized "<Your Organization>" otherwise.
///
inline wxString wxEAPGetProviderName(const std::wstring &id);
///
@@ -104,10 +129,12 @@ inline wxString wxEAPGetProviderName(const std::wstring &id);
///
inline void wxInitializeConfig();
/// @}
namespace eap
{
///
/// Base class to prevent multiple instances of the same dialog
///
class monitor_ui;
}
@@ -131,20 +158,13 @@ namespace eap
#include <list>
#include <memory>
/// \addtogroup EAPBaseGUI
/// @{
///
/// Reusable EAP dialog banner for `wxEAPConfigDialog` and `wxEAPCredentialsDialog`
///
class wxEAPBannerPanel : public wxEAPBannerPanelBase
{
public:
///
/// Constructs a banner pannel and set the title text to product name
///
/// \param[in] parent Parent window
///
wxEAPBannerPanel(wxWindow* parent);
protected:
@@ -154,9 +174,6 @@ protected:
};
///
/// EAP top-most configuration dialog template
///
template <class _wxT>
class wxEAPConfigDialog : public wxEAPConfigDialogBase
{
@@ -316,22 +333,12 @@ protected:
};
///
/// EAP general-use dialog
///
class wxEAPGeneralDialog : public wxEAPGeneralDialogBase
{
public:
///
/// Constructs a dialog
///
/// \param[in] parent Parent window
/// \param[in] id An identifier for the dialog. A value of \c wxID_ANY 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.
///
wxEAPGeneralDialog(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString &title = wxEmptyString, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
///
@@ -351,62 +358,31 @@ protected:
};
///
/// EAP method credential dialog
///
class wxEAPCredentialsDialog : public wxEAPGeneralDialog
{
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);
};
///
/// EAP provider select dialog
///
class wxEAPProviderSelectDialog : public wxEAPProviderSelectDialogBase
class wxEAPCredentialsConnectionDialog : public wxEAPCredentialsConnectionDialogBase
{
public:
///
/// Constructs a provider select dialog
/// Constructs a credential dialog
///
/// \param[inout] cfg Connection configuration
/// \param[in] parent Parent window
///
wxEAPProviderSelectDialog(eap::config_connection &cfg, wxWindow* parent);
///
/// Returns pointer to selected provider or NULL if no provider is selected.
///
inline eap::config_provider* GetSelection() const
{
return m_selected;
}
wxEAPCredentialsConnectionDialog(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString &title = _("EAP Credentials"), const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
protected:
/// \cond internal
virtual void OnProvSelect(wxCommandEvent& event);
virtual void OnInitDialog(wxInitDialogEvent& event);
/// \endcond
protected:
eap::config_provider* m_selected; ///< Pointer to selected provider (or NULL if none selected).
};
///
/// EAP general note
///
class wxEAPNotePanel : public wxEAPNotePanelBase
{
public:
@@ -446,19 +422,16 @@ protected:
/// \endcond
protected:
wxStaticText *m_provider_notice; ///< Identity provider notice
wxStaticText *m_help_web_label; ///< Helpdesk URL label
wxHyperlinkCtrl *m_help_web_value; ///< Helpdesk URL
wxStaticText *m_help_email_label; ///< Helpdesk e-mail label
wxHyperlinkCtrl *m_help_email_value; ///< Helpdesk e-mail
wxStaticText *m_help_phone_label; ///< Helpdesk phone number label
wxHyperlinkCtrl *m_help_phone_value; ///< Helpdesk phone number
wxStaticText *m_provider_notice;
wxStaticText *m_help_web_label;
wxHyperlinkCtrl *m_help_web_value;
wxStaticText *m_help_email_label;
wxHyperlinkCtrl *m_help_email_value;
wxStaticText *m_help_phone_label;
wxHyperlinkCtrl *m_help_phone_value;
};
///
/// EAP provider-locked congifuration note
///
class wxEAPProviderLockedPanel : public wxEAPNotePanel
{
public:
@@ -469,9 +442,6 @@ public:
};
///
/// EAP credential warning note
///
class wxEAPCredentialWarningPanel : public wxEAPNotePanel
{
public:
@@ -482,9 +452,6 @@ public:
};
///
/// EAP credential logging enabled warning note
///
#if __DANGEROUS__LOG_CONFIDENTIAL_DATA
class wxEAPCredentialLogWarningPanel : public wxEAPNotePanel
{
@@ -496,9 +463,7 @@ public:
};
#endif
///
/// EAP Configuration window
///
class wxEAPConfigWindow : public wxScrolledWindow
{
public:
@@ -506,7 +471,7 @@ public:
/// Constructs a configuration window
///
/// \param[in] prov Provider configuration data
/// \param[inout] cfg Method configuration data
/// \param[inout] cfg Configuration data
/// \param[in] parent Parent window
///
wxEAPConfigWindow(eap::config_provider &prov, eap::config_method &cfg, wxWindow* parent);
@@ -517,21 +482,8 @@ public:
virtual ~wxEAPConfigWindow();
public:
///
/// Returns reference to configuration provider
///
inline eap::config_provider& GetProvider() const
{
return m_prov;
}
///
/// Returns reference to method configuration
///
inline eap::config_method& GetConfig() const
{
return m_cfg;
}
inline eap::config_provider& GetProvider() const { return m_prov; }
inline eap::config_method & GetConfig () const { return m_cfg ; }
protected:
/// \cond internal
@@ -544,9 +496,6 @@ protected:
};
///
/// EAP provider contact info config panel
///
class wxEAPProviderContactInfoPanel : public wxEAPProviderContactInfoPanelBase
{
public:
@@ -571,9 +520,6 @@ protected:
};
///
/// EAP provider identity config panel
///
class wxEAPProviderIDPanel : public wxEAPProviderIDPanelBase
{
public:
@@ -596,9 +542,6 @@ protected:
};
///
/// EAP provider lock config panel
///
class wxEAPProviderLockPanel : public wxEAPProviderLockPanelBase
{
public:
@@ -621,9 +564,6 @@ protected:
};
///
/// EAP provider configuration dialog
///
class wxEAPConfigProvider : public wxEAPGeneralDialog
{
public:
@@ -632,11 +572,6 @@ public:
///
/// \param[inout] prov Provider configuration data
/// \param[in] parent Parent window
/// \param[in] id An identifier for the dialog. A value of \c wxID_ANY 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.
///
wxEAPConfigProvider(eap::config_provider &prov, wxWindow *parent, wxWindowID id = wxID_ANY, const wxString &title = _("Provider Settings"), const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
@@ -648,9 +583,6 @@ protected:
};
///
/// Base template for credential configuration panel
///
template <class _Tcred, class _wxT>
class wxEAPCredentialsConfigPanel : public wxEAPCredentialsConfigPanelBase
{
@@ -659,9 +591,8 @@ public:
/// Constructs a credential configuration panel
///
/// \param[in] prov Provider configuration data
/// \param[inout] cfg Method configuration data
/// \param[inout] cfg Configuration data
/// \param[in] parent Parent window
/// \param[in] method Method name to display
///
wxEAPCredentialsConfigPanel(const eap::config_provider &prov, eap::config_method_with_cred &cfg, wxWindow *parent, const wxString &method = wxEmptyString) :
m_prov(prov),
@@ -824,7 +755,9 @@ protected:
wxEAPCredentialsConfigPanelBase::OnSetConfig(event);
wxEAPCredentialsDialog dlg(m_prov, this);
_wxT *panel = new _wxT(m_prov, m_cfg, m_cred_config, &dlg, true);
dlg.AddContent(panel);
if (dlg.ShowModal() == wxID_OK)
UpdateConfigIdentity();
@@ -892,18 +825,20 @@ private:
};
///
/// Helper template for all credential entry panels
///
template <class _Tcred, class _Tbase>
class wxEAPCredentialsPanel : public _Tbase
{
private:
/// \cond internal
typedef wxEAPCredentialsPanel<_Tcred, _Tbase> _Tthis;
/// \endcond
public:
///
/// Constructs a credentials panel
///
/// \param[in] prov Provider configuration data
/// \param[in] cfg Method configuration data
/// \param[in] cfg Configuration data
/// \param[inout] cred Credentials data
/// \param[in] parent Parent window
/// \param[in] is_config Is this panel used to config credentials?
@@ -923,20 +858,12 @@ public:
m_remember = NULL;
}
///
/// (Un)checks "Remember credentials" checkbox
///
/// \param[in] val If \c true, checkbox is checked; otherwise cleared
///
virtual void SetRemember(bool val)
{
if (m_remember)
m_remember->SetValue(val);
}
///
/// Returns \c true if "Remember credentials" checkbox is checked
///
virtual bool GetRemember() const
{
return m_remember ?
@@ -953,29 +880,27 @@ protected:
};
///
/// Generic identity credential entry panel
///
template <class _Tcred, class _Tbase>
class wxIdentityCredentialsPanel : public wxEAPCredentialsPanel<_Tcred, _Tbase>
class wxPasswordCredentialsPanel : public wxEAPCredentialsPanel<_Tcred, _Tbase>
{
public:
///
/// Constructs a identity credentials panel
/// Constructs a password credentials panel
///
/// \param[in] prov Provider configuration data
/// \param[in] cfg Method configuration data
/// \param[in] cfg Configuration data
/// \param[inout] cred Credentials data
/// \param[in] parent Parent window
/// \param[in] is_config Is this panel used to config credentials?
///
wxIdentityCredentialsPanel(const eap::config_provider &prov, const eap::config_method_with_cred &cfg, _Tcred &cred, wxWindow* parent, bool is_config = false) :
wxPasswordCredentialsPanel(const eap::config_provider &prov, const eap::config_method_with_cred &cfg, _Tcred &cred, wxWindow* parent, bool is_config = false) :
m_password_set(false),
wxEAPCredentialsPanel<_Tcred, _Tbase>(prov, cfg, cred, parent, is_config)
{
// Load and set icon.
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_credentials_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(/*16770*/269)));
if (lib_shell32.load(_T("imageres.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_credentials_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(82)));
bool layout = false;
if (!m_prov.m_lbl_alt_credential.empty()) {
@@ -989,6 +914,11 @@ public:
layout = true;
}
if (!m_prov.m_lbl_alt_password.empty()) {
m_password_label->SetLabel(m_prov.m_lbl_alt_password);
layout = true;
}
if (layout)
this->Layout();
}
@@ -1000,85 +930,26 @@ protected:
{
m_identity->SetValue(m_cred.m_identity);
m_identity->SetSelection(0, -1);
if (!m_is_config && m_cfg.m_use_cred) {
// Credential prompt mode & Using configured credentials
m_identity_label->Enable(false);
m_identity ->Enable(false);
}
return wxEAPCredentialsPanel<_Tcred, _Tbase>::TransferDataToWindow();
}
virtual bool TransferDataFromWindow()
{
if (!wxEAPCredentialsPanel<_Tcred, _Tbase>::TransferDataFromWindow())
return false;
m_cred.m_identity = m_identity->GetValue();
return true;
}
/// \endcond
};
/// @}
///
/// Generic password credential entry panel
///
template <class _Tcred, class _Tbase>
class wxPasswordCredentialsPanel : public wxIdentityCredentialsPanel<_Tcred, _Tbase>
{
public:
///
/// Constructs a password credentials panel
///
/// \param[in] prov Provider configuration data
/// \param[in] cfg Method configuration data
/// \param[inout] cred Credentials data
/// \param[in] parent Parent window
/// \param[in] is_config Is this panel used to config credentials?
///
wxPasswordCredentialsPanel(const eap::config_provider &prov, const eap::config_method_with_cred &cfg, _Tcred &cred, wxWindow* parent, bool is_config = false) :
m_password_set(false),
wxIdentityCredentialsPanel<_Tcred, _Tbase>(prov, cfg, cred, parent, is_config)
{
// Load and set icon.
winstd::library lib_shell32;
if (lib_shell32.load(_T("imageres.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_credentials_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(82)));
if (!m_prov.m_lbl_alt_password.empty()) {
m_password_label->SetLabel(m_prov.m_lbl_alt_password);
this->Layout();
}
}
protected:
/// \cond internal
virtual bool TransferDataToWindow()
{
m_password->SetValue(m_cred.m_password.empty() ? wxEmptyString : wxT("dummypass"));
m_password_set = false;
if (!m_is_config && m_cfg.m_use_cred) {
// Credential prompt mode & Using configured credentials
m_identity_label->Enable(false);
m_identity ->Enable(false);
m_password_label->Enable(false);
m_password ->Enable(false);
}
return wxIdentityCredentialsPanel<_Tcred, _Tbase>::TransferDataToWindow();
return wxEAPCredentialsPanel<_Tcred, wxPasswordCredentialsPanelBase>::TransferDataToWindow();
}
virtual bool TransferDataFromWindow()
{
if (!wxIdentityCredentialsPanel<_Tcred, _Tbase>::TransferDataFromWindow())
if (!wxEAPCredentialsPanel<_Tcred, wxPasswordCredentialsPanelBase>::TransferDataFromWindow())
return false;
m_cred.m_identity = m_identity->GetValue();
if (m_password_set)
m_cred.m_password = m_password->GetValue();
@@ -1087,7 +958,7 @@ protected:
virtual void OnPasswordText(wxCommandEvent& event)
{
wxIdentityCredentialsPanel<_Tcred, _Tbase>::OnPasswordText(event);
wxEAPCredentialsPanel<_Tcred, _Tbase>::OnPasswordText(event);
m_password_set = true;
}
@@ -1098,8 +969,6 @@ private:
bool m_password_set;
};
/// @}
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, int cx, int cy)
{
@@ -1141,67 +1010,31 @@ inline void wxInitializeConfig()
namespace eap
{
/// \addtogroup EAPBaseGUI
/// @{
///
/// Base class to enable single instance of the same dialog (master) return result to multiple threads (slaves)
///
class monitor_ui
{
public:
///
/// Constructs a UI monitor
///
monitor_ui(_In_ HINSTANCE module, _In_ const GUID &guid);
///
/// Destructs the UI monitor
///
virtual ~monitor_ui();
///
/// Sets pop-up window handle
///
/// \param[in] hwnd Handle of window to set as a new pop-up
///
void set_popup(_In_ HWND hwnd);
///
/// Notifies all slaves waiting for this master and send them result data
///
/// \param[in] data Pointer to result data
/// \param[in] size \p data size in bytes
///
void release_slaves(_In_bytecount_(size) const void *data, _In_ size_t size) const;
///
/// Returns true if this is a master
///
inline bool is_master() const
{
return m_is_master;
}
///
/// Returns true if this is a slave
///
inline bool is_slave() const
{
return !is_master();
}
///
/// Returns the data master send
///
inline const std::vector<unsigned char>& master_data() const
{
return m_data;
}
protected:
/// \cond internal
virtual LRESULT winproc(
_In_ UINT msg,
_In_ WPARAM wparam,
@@ -1213,8 +1046,6 @@ namespace eap
_In_ WPARAM wparam,
_In_ LPARAM lparam);
/// \endcond
protected:
bool m_is_master; ///< Is this monitor master?
HWND m_hwnd; ///< Message window handle
@@ -1226,6 +1057,4 @@ namespace eap
static const UINT s_msg_attach; ///< Slave sends this message to attach to master
static const UINT s_msg_finish; ///< Master sends this message to slaves to notify them it has finished (wparam has size, lparam has data)
};
/// @}
}

View File

@@ -20,6 +20,11 @@
namespace eap
{
///
/// EAP UI peer base abstract class
///
/// A group of methods all EAP UI peers must or should implement.
///
class peer_ui;
}
@@ -30,14 +35,6 @@ namespace eap
namespace eap
{
/// \addtogroup EAPBaseModule
/// @{
///
/// EAP UI peer base abstract class
///
/// A group of methods all EAP UI peers must or should implement.
///
class peer_ui : public module
{
public:
@@ -53,16 +50,11 @@ namespace eap
///
/// \sa [EapPeerConfigXml2Blob function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363602.aspx)
///
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in ] pConfigRoot Pointer to the XML configuration to be converted.
/// \param[out] pConnectionDataOut A pointer to a pointer to a byte buffer that contains the configuration data converted from XML. The configuration data is created inside the EapHostConfig Schema element. The buffer is of size \p pdwConnectionDataOutSize. After consuming the data, this memory must be freed by calling \p EapPeerFreeMemory().
/// \param[out] pdwConnectionDataOutSize A pointer to the size, in bytes, of the configuration BLOB in \p pConnectionDataOut.
///
virtual void config_xml2blob(
_In_ DWORD dwFlags,
_In_ IXMLDOMNode *pConfigRoot,
_Out_ BYTE **pConnectionDataOut,
_Out_ DWORD *pdwConnectionDataOutSize) = 0;
_Inout_ BYTE **pConnectionDataOut,
_Inout_ DWORD *pdwConnectionDataOutSize) = 0;
///
/// Converts the configuration BLOB to XML.
@@ -71,12 +63,6 @@ namespace eap
///
/// \sa [EapPeerConfigBlob2Xml function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363601.aspx)
///
/// \param[in] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in] pConnectionData A pointer to a buffer that contains the configuration BLOB to convert. The buffer is of size \p dwConnectionDataSize.
/// \param[in] dwConnectionDataSize The size, in bytes, of the configuration BLOB in \p pConnectionData.
/// \param[in] pDoc A pointer to a pointer to an XML document that contains the converted configuration. If the EAP method does not support the \p EapPeerConfigBlob2Xml() function, the XML document will contain the \p ConfigBlob node with the BLOB in string form. The EAP method should create configuration inside the EapHostConfig Schema configuration element.
/// \param[in] pConfigRoot Configuration root XML node
///
virtual void config_blob2xml(
_In_ DWORD dwFlags,
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
@@ -89,34 +75,18 @@ namespace eap
///
/// \sa [EapPeerInvokeConfigUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363614.aspx)
///
/// \param[in ] hwndParent A handle to the parent window which will spawn the connection configuration user interface dialog.
/// \param[in ] pConnectionDataIn A pointer to a buffer that contains the configuration BLOB to convert. The buffer is of size \p dwConnectionDataInSize.
/// \param[in ] dwConnectionDataInSize The size, in bytes, of the configuration BLOB in \p pConnectionDataIn.
/// \param[out] ppConnectionDataOut Receives a pointer to a pointer that contains a byte buffer with the user-configured connection data.
/// \param[out] pdwConnectionDataOutSize Receives a pointer to the size, in bytes, of the \p ppConnectionDataOut parameter.
///
virtual void invoke_config_ui(
_In_ HWND hwndParent,
_In_count_(dwConnectionDataInSize) const BYTE *pConnectionDataIn,
_In_ DWORD dwConnectionDataInSize,
_Out_ BYTE **ppConnectionDataOut,
_Out_ DWORD *pdwConnectionDataOutSize) = 0;
_Inout_ BYTE **ppConnectionDataOut,
_Inout_ DWORD *pdwConnectionDataOutSize) = 0;
///
/// Raises a custom interactive user interface dialog to obtain user identity information for the EAP method on the client.
///
/// \sa [EapPeerInvokeIdentityUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363615.aspx)
///
/// \param[in ] hwndParent A handle to the parent window which will spawn the interactive user interface dialog to obtain the identity data. Can be \c NULL.
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
/// \param[in ] pConnectionData A pointer to a buffer that contains the configuration BLOB to convert. The buffer is of size \p dwConnectionDataSize.
/// \param[in ] dwConnectionDataSize The size, in bytes, of the configuration BLOB in \p pConnectionData.
/// \param[in ] pUserData A pointer to the user data specific to this authentication used to pre-populate the user data. When this API is called for the first time, or when a new authentication session starts, this parameter is \c NULL. Otherwise, set this parameter to the `pUserData` member of the structure pointed to by the \p pResult parameter received by `EapPeerGetResult()`.
/// \param[in ] dwUserDataSize Specifies the size, in bytes, of the user identity data returned in \p pUserData.
/// \param[out] ppUserDataOut A pointer to the pointer of the returned user data. The data is passed to `EapPeerBeginSession()` as input \p pUserData.
/// \param[out] pdwUserDataOutSize Specifies the size, in bytes, of the \p ppUserDataOut buffer.
/// \param[out] ppwszIdentity A pointer to the returned user identity. The pointer will be included in the identity response packet and returned to the server.
///
virtual void invoke_identity_ui(
_In_ HWND hwndParent,
_In_ DWORD dwFlags,
@@ -124,21 +94,15 @@ namespace eap
_In_ DWORD dwConnectionDataSize,
_In_count_(dwUserDataSize) const BYTE *pUserData,
_In_ DWORD dwUserDataSize,
_Out_ BYTE **ppUserDataOut,
_Out_ DWORD *pdwUserDataOutSize,
_Out_ LPWSTR *ppwszIdentity) = 0;
_Inout_ BYTE **ppUserDataOut,
_Inout_ DWORD *pdwUserDataOutSize,
_Inout_ LPWSTR *ppwszIdentity) = 0;
///
/// Raises a custom interactive user interface dialog for the EAP method on the client.
///
/// \sa [EapPeerInvokeInteractiveUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363616.aspx)
///
/// \param[in ] hwndParent A handle to the parent window which will spawn the interactive user interface dialog.
/// \param[in ] pUIContextData A pointer to an opaque byte buffer that contains the context data used to create the user interface dialog.
/// \param[in ] dwUIContextDataSize The size, in bytes, of the user interface context data specified by \p pUIContextData.
/// \param[out] ppDataFromInteractiveUI A pointer to the address of an opaque byte buffer that contains data obtained from the interactive user interface dialog.
/// \param[out] pdwDataFromInteractiveUISize A pointer to the size, in bytes, of the data returned in \p ppDataFromInteractiveUI.
///
virtual void invoke_interactive_ui(
_In_ HWND hwndParent,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
@@ -146,6 +110,4 @@ namespace eap
_Inout_ BYTE **ppDataFromInteractiveUI,
_Inout_ DWORD *pdwDataFromInteractiveUISize) = 0;
};
/// @}
}

View File

@@ -18,6 +18,9 @@
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
///
/// Base class for all credential entry panel that must provide "Remember" credentials checkbox
///
class wxEAPCredentialsPanelBase;
#pragma once
@@ -25,28 +28,12 @@ class wxEAPCredentialsPanelBase;
#include <wx/panel.h>
///
/// \defgroup EAPBaseGUI GUI
/// Graphical User Interface
///
/// @{
///
/// Base class for all credential entry panel that must provide "Remember" credentials checkbox
///
class wxEAPCredentialsPanelBase : public wxPanel
{
public:
///
/// Constructs a wxPanel with "Remember" credentials checkbox
///
/// \param[in] parent The parent window
/// \param[in] winid An identifier for the panel. \c wxID_ANY is taken to mean a default.
/// \param[in] pos The panel position. The value \c wxDefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform.
/// \param[in] size The panel 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. See `wxPanel`.
/// \param[in] name Window name
///
wxEAPCredentialsPanelBase(wxWindow *parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
@@ -56,17 +43,6 @@ public:
{
}
///
/// (Un)checks "Remember credentials" checkbox
///
/// \param[in] val If \c true, checkbox is checked; otherwise cleared
///
virtual void SetRemember(bool val) = 0;
///
/// Returns \c true if "Remember credentials" checkbox is checked
///
virtual bool GetRemember() const = 0;
};
/// @}

View File

@@ -418,55 +418,6 @@ wxPasswordCredentialsPanelBase::~wxPasswordCredentialsPanelBase()
}
wxIdentityCredentialsPanelBase::wxIdentityCredentialsPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxEAPCredentialsPanelBase( parent, id, pos, size, style )
{
m_sb_credentials = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User ID") ), wxVERTICAL );
wxBoxSizer* sb_credentials_horiz;
sb_credentials_horiz = new wxBoxSizer( wxHORIZONTAL );
m_credentials_icon = new wxStaticBitmap( m_sb_credentials->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
sb_credentials_horiz->Add( m_credentials_icon, 0, wxALL, 5 );
m_sb_credentials_vert = new wxBoxSizer( wxVERTICAL );
m_credentials_label = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Please provide your user ID."), wxDefaultPosition, wxDefaultSize, 0 );
m_credentials_label->Wrap( 440 );
m_sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* sb_credentials_tbl;
sb_credentials_tbl = new wxFlexGridSizer( 0, 2, 5, 5 );
sb_credentials_tbl->AddGrowableCol( 1 );
sb_credentials_tbl->SetFlexibleDirection( wxBOTH );
sb_credentials_tbl->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_identity_label = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("User ID:"), wxDefaultPosition, wxDefaultSize, 0 );
m_identity_label->Wrap( -1 );
sb_credentials_tbl->Add( m_identity_label, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_identity = new wxTextCtrl( m_sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_identity->SetToolTip( _("Enter your user name here (user@domain.org, DOMAIN\\User, etc.)") );
sb_credentials_tbl->Add( m_identity, 2, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_sb_credentials_vert->Add( sb_credentials_tbl, 0, wxEXPAND|wxALL, 5 );
sb_credentials_horiz->Add( m_sb_credentials_vert, 1, wxEXPAND, 5 );
m_sb_credentials->Add( sb_credentials_horiz, 0, wxEXPAND, 5 );
this->SetSizer( m_sb_credentials );
this->Layout();
}
wxIdentityCredentialsPanelBase::~wxIdentityCredentialsPanelBase()
{
}
wxEAPProviderContactInfoPanelBase::wxEAPProviderContactInfoPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxStaticBoxSizer* sb_provider_contact;
@@ -680,43 +631,3 @@ wxEAPProviderLockPanelBase::wxEAPProviderLockPanelBase( wxWindow* parent, wxWind
wxEAPProviderLockPanelBase::~wxEAPProviderLockPanelBase()
{
}
wxEAPProviderSelectDialogBase::wxEAPProviderSelectDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* sb_content;
sb_content = new wxBoxSizer( wxVERTICAL );
m_banner = new wxEAPBannerPanel( this );
sb_content->Add( m_banner, 0, wxEXPAND|wxBOTTOM, 5 );
m_providers = new wxBoxSizer( wxVERTICAL );
m_providers->SetMinSize( wxSize( 350,-1 ) );
sb_content->Add( m_providers, 1, wxEXPAND|wxALL, 5 );
m_buttons = new wxStdDialogButtonSizer();
m_buttonsCancel = new wxButton( this, wxID_CANCEL );
m_buttons->AddButton( m_buttonsCancel );
m_buttons->Realize();
sb_content->Add( m_buttons, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( sb_content );
this->Layout();
sb_content->Fit( this );
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPProviderSelectDialogBase::OnInitDialog ) );
}
wxEAPProviderSelectDialogBase::~wxEAPProviderSelectDialogBase()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPProviderSelectDialogBase::OnInitDialog ) );
}

View File

@@ -3116,446 +3116,6 @@
</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">wxIdentityCredentialsPanelBase</property>
<property name="pos"></property>
<property name="size">500,-1</property>
<property name="subclass">wxEAPCredentialsPanelBase; ../include/wxEAP_UIBase.h</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"></event>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">User ID</property>
<property name="minimum_size"></property>
<property name="name">m_sb_credentials</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_credentials_horiz</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" 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="bitmap">Load From Icon Resource; ; [32; 32]</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_credentials_icon</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="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>
<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="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_sb_credentials_vert</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</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">Please provide your user ID.</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_credentials_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">440</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|wxALL</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">5</property>
<property name="minimum_size"></property>
<property name="name">sb_credentials_tbl</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">5</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</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">User ID:</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_identity_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|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">2</property>
<object class="wxTextCtrl" 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="maxlength"></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_identity</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">Enter your user name here (user@domain.org, DOMAIN\User, etc.)</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></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="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
@@ -5751,196 +5311,5 @@
</object>
</object>
</object>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center"></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="extra_style"></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">wxEAPProviderSelectDialogBase</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="subclass"></property>
<property name="title">EAP Identity Provider</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<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="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog">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"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_content</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="CustomControl" 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="class">wxEAPBannerPanel</property>
<property name="close_button">1</property>
<property name="construction">m_banner = new wxEAPBannerPanel( this );&#x0A;</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="declaration">wxEAPBannerPanel *m_banner;</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="include">class wxEAPBannerPanel;</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_banner</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="settings"></property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="subclass">; ../include/EAP_UI.h</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>
<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|wxALL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size">350,-1</property>
<property name="name">m_providers</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">0</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_buttons</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@@ -222,28 +222,6 @@ class wxPasswordCredentialsPanelBase : public wxEAPCredentialsPanelBase
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxIdentityCredentialsPanelBase
///////////////////////////////////////////////////////////////////////////////
class wxIdentityCredentialsPanelBase : public wxEAPCredentialsPanelBase
{
private:
protected:
wxStaticBoxSizer* m_sb_credentials;
wxStaticBitmap* m_credentials_icon;
wxBoxSizer* m_sb_credentials_vert;
wxStaticText* m_credentials_label;
wxStaticText* m_identity_label;
wxTextCtrl* m_identity;
public:
wxIdentityCredentialsPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
~wxIdentityCredentialsPanelBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxEAPProviderContactInfoPanelBase
///////////////////////////////////////////////////////////////////////////////
@@ -314,28 +292,4 @@ class wxEAPProviderLockPanelBase : public wxPanel
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxEAPProviderSelectDialogBase
///////////////////////////////////////////////////////////////////////////////
class wxEAPProviderSelectDialogBase : public wxDialog
{
private:
protected:
wxEAPBannerPanel *m_banner;
wxBoxSizer* m_providers;
wxStdDialogButtonSizer* m_buttons;
wxButton* m_buttonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
public:
wxEAPProviderSelectDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EAP Identity Provider"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
~wxEAPProviderSelectDialogBase();
};
#endif //__WXEAP_UI_H__

View File

@@ -30,12 +30,10 @@ wxEAPBannerPanel::wxEAPBannerPanel(wxWindow* parent) : wxEAPBannerPanelBase(pare
}
/// \cond internal
bool wxEAPBannerPanel::AcceptsFocusFromKeyboard() const
{
return false;
}
/// \endcond
//////////////////////////////////////////////////////////////////////
@@ -81,7 +79,6 @@ void wxEAPGeneralDialog::AddContent(wxPanel *content)
}
/// \cond internal
void wxEAPGeneralDialog::OnInitDialog(wxInitDialogEvent& event)
{
wxEAPGeneralDialogBase::OnInitDialog(event);
@@ -89,7 +86,6 @@ void wxEAPGeneralDialog::OnInitDialog(wxInitDialogEvent& event)
for (wxSizerItemList::compatibility_iterator panel = m_panels->GetChildren().GetFirst(); panel; panel = panel->GetNext())
panel->GetData()->GetWindow()->GetEventHandler()->ProcessEvent(event);
}
/// \endcond
//////////////////////////////////////////////////////////////////////
@@ -108,6 +104,46 @@ wxEAPCredentialsDialog::wxEAPCredentialsDialog(const eap::config_provider &prov,
}
//////////////////////////////////////////////////////////////////////
// wxEAPCredentialsConnectionDialog
//////////////////////////////////////////////////////////////////////
wxEAPCredentialsConnectionDialog::wxEAPCredentialsConnectionDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) :
wxEAPCredentialsConnectionDialogBase(parent, id, title, pos, size, style)
{
// Set extra style here, as wxFormBuilder overrides all default flags.
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
// Load window icons.
#ifdef __WINDOWS__
wxIconBundle icons;
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)));
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
this->SetIcons(icons);
#else
this->SetIcon(wxIcon(wxICON(product.ico)));
#endif
// Set banner title.
m_banner->m_title->SetLabel(_("EAP Credentials"));
m_buttonsOK->SetDefault();
}
void wxEAPCredentialsConnectionDialog::OnInitDialog(wxInitDialogEvent& event)
{
wxEAPCredentialsConnectionDialogBase::OnInitDialog(event);
// Forward the event to child panels.
for (wxWindowList::compatibility_iterator provider = m_providers->GetChildren().GetFirst(); provider; provider = provider->GetNext()) {
wxWindow *prov = wxDynamicCast(provider->GetData(), wxWindow);
if (prov)
prov->GetEventHandler()->ProcessEvent(event);
}
}
//////////////////////////////////////////////////////////////////////
// wxEAPNotePanel
//////////////////////////////////////////////////////////////////////
@@ -125,8 +161,6 @@ wxEAPNotePanel::wxEAPNotePanel(wxWindow* parent) :
}
/// \cond internal
bool wxEAPNotePanel::AcceptsFocusFromKeyboard() const
{
return m_help_web_value || m_help_email_value || m_help_phone_label;
@@ -186,8 +220,6 @@ void wxEAPNotePanel::CreateContactFields(const eap::config_provider &prov)
}
}
/// \endcond
//////////////////////////////////////////////////////////////////////
// wxEAPProviderLockedPanel
@@ -279,7 +311,6 @@ wxEAPConfigWindow::~wxEAPConfigWindow()
}
/// \cond internal
void wxEAPConfigWindow::OnInitDialog(wxInitDialogEvent& event)
{
// Call TransferDataToWindow() manually, as wxScrolledWindow somehow skips that.
@@ -287,7 +318,6 @@ void wxEAPConfigWindow::OnInitDialog(wxInitDialogEvent& event)
event.Skip();
}
/// \endcond
//////////////////////////////////////////////////////////////////////
@@ -305,8 +335,6 @@ wxEAPProviderContactInfoPanel::wxEAPProviderContactInfoPanel(eap::config_provide
}
/// \cond internal
bool wxEAPProviderContactInfoPanel::TransferDataToWindow()
{
m_provider_name ->SetValue(m_prov.m_name );
@@ -330,8 +358,6 @@ bool wxEAPProviderContactInfoPanel::TransferDataFromWindow()
return true;
}
/// \endcond
//////////////////////////////////////////////////////////////////////
// wxEAPProviderIDPanel
@@ -348,8 +374,6 @@ wxEAPProviderIDPanel::wxEAPProviderIDPanel(eap::config_provider &prov, wxWindow*
}
/// \cond internal
bool wxEAPProviderIDPanel::TransferDataToWindow()
{
m_provider_namespace->SetStringSelection(m_prov.m_namespace);
@@ -369,8 +393,6 @@ bool wxEAPProviderIDPanel::TransferDataFromWindow()
return true;
}
/// \endcond
//////////////////////////////////////////////////////////////////////
// wxEAPProviderLockPanel
@@ -387,8 +409,6 @@ wxEAPProviderLockPanel::wxEAPProviderLockPanel(eap::config_provider &prov, wxWin
}
/// \cond internal
bool wxEAPProviderLockPanel::TransferDataToWindow()
{
m_provider_lock->SetValue(m_prov.m_read_only);
@@ -406,8 +426,6 @@ bool wxEAPProviderLockPanel::TransferDataFromWindow()
return true;
}
/// \endcond
//////////////////////////////////////////////////////////////////////
// wxEAPConfigProvider
@@ -433,42 +451,6 @@ wxEAPConfigProvider::wxEAPConfigProvider(eap::config_provider &prov, wxWindow *p
}
//////////////////////////////////////////////////////////////////////
// wxEAPProviderSelectDialog
//////////////////////////////////////////////////////////////////////
wxEAPProviderSelectDialog::wxEAPProviderSelectDialog(eap::config_connection &cfg, wxWindow *parent) :
m_selected(NULL),
wxEAPProviderSelectDialogBase(parent)
{
// Set banner title.
std::unique_ptr<eap::config_method> cfg_dummy(cfg.m_module.make_config_method());
m_banner->m_title->SetLabel(wxString::Format("%s %s", wxT(PRODUCT_NAME_STR), cfg_dummy->get_method_str()));
// Iterate over providers.
for (auto cfg_prov = cfg.m_providers.cbegin(), cfg_prov_end = cfg.m_providers.cend(); cfg_prov != cfg_prov_end; ++cfg_prov) {
wxCommandLinkButton *btn = new wxCommandLinkButton(this, wxID_ANY, wxEAPGetProviderName(cfg_prov->m_name));
m_providers->Add(btn, 0, wxALL|wxEXPAND, 5);
btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxEAPProviderSelectDialog::OnProvSelect), new wxVariant((void*)&*cfg_prov), this);
}
this->Layout();
this->GetSizer()->Fit(this);
}
/// \cond internal
void wxEAPProviderSelectDialog::OnProvSelect(wxCommandEvent& event)
{
// Set selected provider and dismiss dialog.
m_selected = static_cast<eap::config_provider*>(dynamic_cast<const wxVariant*>(event.GetEventUserData())->GetVoidPtr());
this->EndModal(wxID_OK);
event.Skip();
}
/// \endcond
using namespace std;
using namespace winstd;
@@ -594,8 +576,6 @@ void eap::monitor_ui::release_slaves(_In_bytecount_(size) const void *data, _In_
}
/// \cond internal
LRESULT eap::monitor_ui::winproc(
_In_ UINT msg,
_In_ WPARAM wparam,
@@ -659,8 +639,6 @@ LRESULT CALLBACK eap::monitor_ui::winproc(
}
}
/// \endcond
const UINT eap::monitor_ui::s_msg_attach = RegisterWindowMessage(_T(PRODUCT_NAME_STR) _T("-Attach"));
const UINT eap::monitor_ui::s_msg_finish = RegisterWindowMessage(_T(PRODUCT_NAME_STR) _T("-Finish"));

View File

@@ -24,5 +24,3 @@
#include "../include/EAP_UI.h"
#include "../include/Module.h"
#include <wx/commandlinkbutton.h>

View File

@@ -1,2 +0,0 @@
/temp
/*.user

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\..\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\..\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

View File

@@ -1,106 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B385EC2B-C3F4-48BB-9BAC-8B996DE7F754}</ProjectGuid>
<RootNamespace>EapHost</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\Win32.props" />
<Import Project="..\..\..\include\Debug.props" />
<Import Project="EapHost.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\x64.props" />
<Import Project="..\..\..\include\Debug.props" />
<Import Project="EapHost.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\Win32.props" />
<Import Project="..\..\..\include\Release.props" />
<Import Project="EapHost.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\x64.props" />
<Import Project="..\..\..\include\Release.props" />
<Import Project="EapHost.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<ItemGroup>
<ClInclude Include="..\include\Config.h" />
<ClInclude Include="..\include\Credentials.h" />
<ClInclude Include="..\include\Method.h" />
<ClInclude Include="..\src\StdAfx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\Config.cpp" />
<ClCompile Include="..\src\Credentials.cpp" />
<ClCompile Include="..\src\Method.cpp" />
<ClCompile Include="..\src\StdAfx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Events\build\Events.vcxproj">
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\StdAfx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\Config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\Method.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\Credentials.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\StdAfx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\Config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\Method.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\Credentials.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -1,143 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include <sal.h>
namespace eap
{
class config_method_eaphost;
}
#pragma once
#include "../../EAPBase/include/Config.h"
#include <Windows.h>
#include <sal.h>
#include <tchar.h>
namespace eap
{
/// \addtogroup EAPBaseConfig
/// @{
///
/// EapHost peer method configuration
///
class config_method_eaphost : public config_method
{
public:
///
/// Constructs configuration
///
/// \param[in] mod EAP module to use for global services
/// \param[in] level Config level (0=outer, 1=inner, 2=inner-inner...)
///
config_method_eaphost(_In_ module &mod, _In_ unsigned int level);
///
/// Copies configuration
///
/// \param[in] other Configuration to copy from
///
config_method_eaphost(_In_ const config_method_eaphost &other);
///
/// Moves configuration
///
/// \param[in] other Configuration to move from
///
config_method_eaphost(_Inout_ config_method_eaphost &&other);
///
/// Copies configuration
///
/// \param[in] other Configuration to copy from
///
/// \returns Reference to this object
///
config_method_eaphost& operator=(_In_ const config_method_eaphost &other);
///
/// Moves configuration
///
/// \param[in] other Configuration to move from
///
/// \returns Reference to this object
///
config_method_eaphost& operator=(_Inout_ config_method_eaphost &&other);
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);
/// @}
virtual winstd::eap_type_t get_method_id() const;
virtual const wchar_t* get_method_str() const;
///
/// @copydoc eap::config_method::make_credentials()
/// \returns This implementation always returns `eap::credentials_eaphost` type of credentials
///
virtual credentials* make_credentials() const;
///
/// Returns method EAP_METHOD_TYPE
///
inline const EAP_METHOD_TYPE& get_type() const
{
return m_type;
}
///
/// Set method EAP_METHOD_TYPE
///
inline void set_type(_In_ const EAP_METHOD_TYPE &type)
{
m_type = type;
update_type();
}
protected:
/// \cond internal
void update_type();
/// \endcond
protected:
EAP_METHOD_TYPE m_type; ///< EapHost method type: (EAP type, vendor ID, vendor type, author ID) tuple
std::wstring m_type_str; ///< EAP method type as a string
public:
sanitizing_blob m_cfg_blob; ///< Method configuration BLOB
};
/// @}
}

View File

@@ -1,154 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include <sal.h>
namespace eap
{
class credentials_eaphost;
}
#pragma once
#include "Config.h"
#include "../../EAPBase/include/Credentials.h"
#include <WinStd/Crypt.h>
#include <Windows.h>
#include <vector>
namespace eap
{
/// \addtogroup EAPBaseCred
/// @{
///
/// EapHost peer method credentials
///
class credentials_eaphost : public credentials
{
public:
///
/// Constructs credentials
///
/// \param[in] mod EAP module to use for global services
///
credentials_eaphost(_In_ module &mod);
///
/// Copies credentials
///
/// \param[in] other Credentials to copy from
///
credentials_eaphost(_In_ const credentials_eaphost &other);
///
/// Moves credentials
///
/// \param[in] other Credentials to move from
///
credentials_eaphost(_Inout_ credentials_eaphost &&other);
///
/// Copies credentials
///
/// \param[in] other Credentials to copy from
///
/// \returns Reference to this object
///
credentials_eaphost& operator=(_In_ const credentials_eaphost &other);
///
/// Moves credentials
///
/// \param[in] other Credentials to move from
///
/// \returns Reference to this object
///
credentials_eaphost& operator=(_Inout_ credentials_eaphost &&other);
virtual config* clone() const;
virtual void clear();
virtual bool empty() 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);
/// @}
/// \name Storage
/// @{
virtual void store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level) const;
virtual void retrieve(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level);
///
/// @copydoc eap::credentials::target_suffix()
/// \returns This implementation always returns `_T("BLOB")`
///
virtual LPCTSTR target_suffix() const;
/// @}
///
/// Combine credentials in the following order:
///
/// 1. Cached credentials
/// 2. Configured credentials (if \p cfg is derived from `config_method_with_cred`)
/// 3. Stored credentials
///
/// \param[in] dwFlags A combination of [EAP flags](https://msdn.microsoft.com/en-us/library/windows/desktop/bb891975.aspx) that describe the EAP authentication session behavior
/// \param[in] hTokenImpersonateUser Impersonation token for a logged-on user to collect user-related information
/// \param[in] cred_cached Cached credentials (optional, can be \c NULL, must be `credentials_eaphost*` type)
/// \param[in] cfg Method configuration (unused, as must be as config_method_eaphost is not derived from `config_method_with_cred`)
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL)
///
/// \returns
/// - \c source_cache Credentials were obtained from EapHost cache
/// - \c source_config Credentials were set by method configuration
/// - \c source_storage Credentials were loaded from Windows Credential Manager
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName);
public:
sanitizing_blob m_cred_blob; ///< Credentials BLOB
private:
/// \cond internal
static const unsigned char s_entropy[1024];
/// \endcond
};
/// @}
}

View File

@@ -1,155 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
namespace eap
{
class method_eaphost;
}
#pragma once
#include "Config.h"
#include "Credentials.h"
#include "../../EAPBase/include/Method.h"
namespace eap
{
/// \addtogroup EAPBaseMethod
/// @{
///
/// EapHost peer method
///
/// A wrapper class to provide system installed 3rd party EAP methods integration.
///
class method_eaphost : public method
{
WINSTD_NONCOPYABLE(method_eaphost)
public:
///
/// Constructs an EAP method
///
/// \param[in] mod EAP module to use for global services
/// \param[in] cfg Method configuration
/// \param[in] cred User credentials
///
method_eaphost(_In_ module &mod, _In_ config_method_eaphost &cfg, _In_ credentials_eaphost &cred);
///
/// Moves an EAP method
///
/// \param[in] other EAP method to move from
///
method_eaphost(_Inout_ method_eaphost &&other);
///
/// Moves an EAP method
///
/// \param[in] other EAP method to move from
///
/// \returns Reference to this object
///
method_eaphost& operator=(_Inout_ method_eaphost &&other);
/// \name Session management
/// @{
virtual void begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize = MAXDWORD);
virtual void end_session();
/// @}
/// \name Packet processing
/// @{
virtual EapPeerMethodResponseAction process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize);
virtual void get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max = MAXDWORD);
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{
virtual void get_ui_context(_Out_ sanitizing_blob &context_data);
virtual EapPeerMethodResponseAction set_ui_context(
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ DWORD dwUIContextDataSize);
/// @}
/// \name EAP Response Attributes
/// @{
virtual void get_response_attributes(_Out_ EapAttributes *pAttribs);
virtual EapPeerMethodResponseAction set_response_attributes(_In_ const EapAttributes *pAttribs);
/// @}
protected:
///
/// Converts EapHost peer action to output structure.
///
/// \param[in] action EapHost peer action
///
/// \returns EAP method output action
///
inline EapPeerMethodResponseAction action_h2p(_In_ EapHostPeerResponseAction action)
{
switch (action) {
case EapHostPeerResponseDiscard : return EapPeerMethodResponseActionDiscard ;
case EapHostPeerResponseSend : return EapPeerMethodResponseActionSend ;
case EapHostPeerResponseResult : return EapPeerMethodResponseActionResult ;
case EapHostPeerResponseInvokeUi : return EapPeerMethodResponseActionInvokeUI;
case EapHostPeerResponseRespond : return EapPeerMethodResponseActionRespond ;
case EapHostPeerResponseStartAuthentication: return EapPeerMethodResponseActionDiscard ; // The session could not be found. So the supplicant either needs to start session again with the same packet or discard the packet.
case EapHostPeerResponseNone : return EapPeerMethodResponseActionNone ;
default : throw std::invalid_argument(winstd::string_printf(__FUNCTION__ " Unknown action (%u).", action));
}
}
protected:
config_method_eaphost &m_cfg; ///< Method configuration
credentials_eaphost &m_cred; ///< Method user credentials
EAP_SESSIONID m_session_id; ///< EAP session ID
};
/// @}
}

View File

@@ -1,211 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"
using namespace std;
using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::config_method_eaphost
//////////////////////////////////////////////////////////////////////
eap::config_method_eaphost::config_method_eaphost(_In_ module &mod, _In_ unsigned int level) :
config_method(mod, level),
m_type_str(L"EapHost")
{
memset(&m_type, 0, sizeof(EAP_METHOD_TYPE));
}
eap::config_method_eaphost::config_method_eaphost(_In_ const config_method_eaphost &other) :
m_type (other.m_type ),
m_type_str (other.m_type_str),
m_cfg_blob (other.m_cfg_blob),
config_method(other )
{
}
eap::config_method_eaphost::config_method_eaphost(_Inout_ config_method_eaphost &&other) :
m_type (std::move(other.m_type )),
m_type_str (std::move(other.m_type_str)),
m_cfg_blob (std::move(other.m_cfg_blob)),
config_method(std::move(other ))
{
}
eap::config_method_eaphost& eap::config_method_eaphost::operator=(_In_ const config_method_eaphost &other)
{
if (this != &other) {
(config_method&)*this = other;
m_type = other.m_type;
m_type_str = other.m_type_str;
m_cfg_blob = other.m_cfg_blob;
}
return *this;
}
eap::config_method_eaphost& eap::config_method_eaphost::operator=(_Inout_ config_method_eaphost &&other)
{
if (this != &other) {
(config_method&&)*this = std::move(other );
m_type = std::move(other.m_type );
m_type_str = std::move(other.m_type_str);
m_cfg_blob = std::move(other.m_cfg_blob);
}
return *this;
}
eap::config* eap::config_method_eaphost::clone() const
{
return new config_method_eaphost(*this);
}
void eap::config_method_eaphost::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
{
assert(pDoc);
assert(pConfigRoot);
config_method::save(pDoc, pConfigRoot);
// Convert configuration BLOB to XML using EapHost (and ultimately method peer's EapPeerConfigBlob2Xml).
com_obj<IXMLDOMDocument2> pConfigDoc;
eap_error error;
DWORD dwResult = EapHostPeerConfigBlob2Xml(0, m_type, (DWORD)m_cfg_blob.size(), const_cast<BYTE*>(m_cfg_blob.data()), &pConfigDoc, &error._Myptr);
if (dwResult == ERROR_SUCCESS) {
HRESULT hr;
com_obj<IXMLDOMElement> pXmlElConfigDoc;
if (FAILED(hr = pConfigDoc->get_documentElement(&pXmlElConfigDoc)))
throw com_runtime_error(hr, __FUNCTION__ " Error getting XML document element.");
// Insert method configuration into our XML configuration.
if (FAILED(hr = pConfigRoot->appendChild(pXmlElConfigDoc, NULL)))
throw com_runtime_error(hr, __FUNCTION__ " Error appending configuration document element.");
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerConfigBlob2Xml failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerConfigBlob2Xml failed.");
}
void eap::config_method_eaphost::load(_In_ IXMLDOMNode *pConfigRoot)
{
assert(pConfigRoot);
config_method::load(pConfigRoot);
// <EapHostConfig>
winstd::com_obj<IXMLDOMElement> pXmlElEapHostConfig;
if (SUCCEEDED(eapxml::select_element(pConfigRoot, winstd::bstr(L"eaphostconfig:EapHostConfig"), pXmlElEapHostConfig))) {
// Convert configuration XML to BLOB using EapHost (and ultimately method peer's EapPeerConfigXml2Blob).
DWORD cfg_data_size = 0;
eap_blob cfg_data;
eap_error error;
DWORD dwResult = EapHostPeerConfigXml2Blob(0, pXmlElEapHostConfig, &cfg_data_size, &cfg_data._Myptr, &m_type, &error._Myptr);
if (dwResult == ERROR_SUCCESS) {
update_type();
const BYTE *_cfg_data = cfg_data.get();
m_cfg_blob.assign(_cfg_data, _cfg_data + cfg_data_size);
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerConfigXml2Blob failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerConfigXml2Blob failed.");
}
}
void eap::config_method_eaphost::operator<<(_Inout_ cursor_out &cursor) const
{
config_method::operator<<(cursor);
cursor << m_type ;
cursor << m_cfg_blob;
}
size_t eap::config_method_eaphost::get_pk_size() const
{
return
config_method::get_pk_size() +
pksizeof(m_type ) +
pksizeof(m_cfg_blob);
}
void eap::config_method_eaphost::operator>>(_Inout_ cursor_in &cursor)
{
config_method::operator>>(cursor);
cursor >> m_type ; update_type();
cursor >> m_cfg_blob;
}
eap_type_t eap::config_method_eaphost::get_method_id() const
{
return (eap_type_t)m_type.eapType.type;
}
const wchar_t* eap::config_method_eaphost::get_method_str() const
{
return m_type_str.c_str();
}
eap::credentials* eap::config_method_eaphost::make_credentials() const
{
return new credentials_eaphost(m_module);
}
/// \cond internal
void eap::config_method_eaphost::update_type()
{
// Query registry for EAP method name and save it to m_type_str.
// get_method_str() can return pointer to static string only, therefore we need to have the method name ready in advance.
reg_key key;
if (key.open(HKEY_LOCAL_MACHINE,
m_type.dwAuthorId == 0 ? tstring_printf(_T("SYSTEM\\CurrentControlSet\\services\\RasMan\\PPP\\EAP\\%u" ), m_type.eapType.type ).c_str() : // Legacy EAP method (RasMan)
m_type.eapType.type == 254 ? tstring_printf(_T("SYSTEM\\CurrentControlSet\\services\\EapHost\\Methods\\%u\\%u\\%u\\%u"), m_type.dwAuthorId, m_type.eapType.type, m_type.eapType.dwVendorId, m_type.eapType.dwVendorType).c_str() : // EapHost Expanded Type Peer
tstring_printf(_T("SYSTEM\\CurrentControlSet\\services\\EapHost\\Methods\\%u\\%u" ), m_type.dwAuthorId, m_type.eapType.type ).c_str(), // EapHost Peer
0,
KEY_READ) &&
RegLoadMUIStringW(key,
m_type.dwAuthorId == 0 ? L"FriendlyName" :
L"PeerFriendlyName",
m_type_str,
0,
NULL) == ERROR_SUCCESS)
return;
// Query failed. Provide generic name.
if (m_type.dwAuthorId == 0 ) sprintf(m_type_str, L"RasMan-%u" , m_type.eapType.type );
else if (m_type.eapType.type == 254) sprintf(m_type_str, L"EapHost-%u-%u-%u-%u", m_type.dwAuthorId, m_type.eapType.type, m_type.eapType.dwVendorId, m_type.eapType.dwVendorType);
else sprintf(m_type_str, L"EapHost-%u-%u" , m_type.dwAuthorId, m_type.eapType.type );
}
/// \endcond

View File

@@ -1,379 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"
#pragma comment(lib, "Eappprxy.lib")
using namespace std;
using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::credentials_eaphost
//////////////////////////////////////////////////////////////////////
eap::credentials_eaphost::credentials_eaphost(_In_ module &mod) : credentials(mod)
{
}
eap::credentials_eaphost::credentials_eaphost(_In_ const credentials_eaphost &other) :
m_cred_blob(other.m_cred_blob),
credentials(other )
{
}
eap::credentials_eaphost::credentials_eaphost(_Inout_ credentials_eaphost &&other) :
m_cred_blob(std::move(other.m_cred_blob)),
credentials(std::move(other ))
{
}
eap::credentials_eaphost& eap::credentials_eaphost::operator=(_In_ const credentials_eaphost &other)
{
if (this != &other) {
(credentials&)*this = other;
m_cred_blob = other.m_cred_blob;
}
return *this;
}
eap::credentials_eaphost& eap::credentials_eaphost::operator=(_Inout_ credentials_eaphost &&other)
{
if (this != &other) {
(credentials&)*this = std::move(other);
m_cred_blob = std::move(other.m_cred_blob);
}
return *this;
}
eap::config* eap::credentials_eaphost::clone() const
{
return new credentials_eaphost(*this);
}
void eap::credentials_eaphost::clear()
{
credentials::clear();
m_cred_blob.clear();
}
bool eap::credentials_eaphost::empty() const
{
return m_cred_blob.empty();
}
void eap::credentials_eaphost::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
{
assert(pDoc);
assert(pConfigRoot);
credentials::save(pDoc, pConfigRoot);
HRESULT hr;
// <Credentials>
if (FAILED(hr = eapxml::put_element_base64(pDoc, pConfigRoot, bstr(L"Credentials"), namespace_eapmetadata, m_cred_blob.data(), m_cred_blob.size())))
throw com_runtime_error(hr, __FUNCTION__ " Error creating <Credentials> element.");
}
void eap::credentials_eaphost::load(_In_ IXMLDOMNode *pConfigRoot)
{
assert(pConfigRoot);
HRESULT hr;
credentials::load(pConfigRoot);
std::wstring xpath(eapxml::get_xpath(pConfigRoot));
m_cred_blob.clear();
if (FAILED(hr = eapxml::get_element_base64(pConfigRoot, bstr(L"eap-metadata:Credentials"), m_cred_blob)))
throw com_runtime_error(hr, __FUNCTION__ " Error reading <Credentials> element.");
m_module.log_config_discrete((xpath + L"/Credentials").c_str(), m_cred_blob.data(), (ULONG)m_cred_blob.size());
}
void eap::credentials_eaphost::operator<<(_Inout_ cursor_out &cursor) const
{
credentials::operator<<(cursor);
cursor << m_cred_blob;
}
size_t eap::credentials_eaphost::get_pk_size() const
{
return
credentials::get_pk_size() +
pksizeof(m_cred_blob);
}
void eap::credentials_eaphost::operator>>(_Inout_ cursor_in &cursor)
{
credentials::operator>>(cursor);
cursor >> m_cred_blob;
}
void eap::credentials_eaphost::store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level) const
{
assert(pszTargetName);
data_blob cred_enc;
if (!m_cred_blob.empty()) {
// Encrypt credentials BLOB using user's key.
DATA_BLOB cred_blob = { (DWORD)m_cred_blob.size(), const_cast<LPBYTE>(m_cred_blob.data()) };
DATA_BLOB entropy_blob = { sizeof(s_entropy) , const_cast<LPBYTE>(s_entropy) };
if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN | CRYPTPROTECT_AUDIT, &cred_enc))
throw win_runtime_error(__FUNCTION__ " CryptProtectData failed.");
}
tstring target(target_name(pszTargetName, level));
// Write credentials.
assert(cred_enc.cbData < CRED_MAX_CREDENTIAL_BLOB_SIZE);
assert(m_identity.length() < CRED_MAX_USERNAME_LENGTH );
CREDENTIAL cred = {
0, // Flags
CRED_TYPE_GENERIC, // Type
const_cast<LPTSTR>(target.c_str()), // TargetName
_T(""), // Comment
{ 0, 0 }, // LastWritten
cred_enc.cbData, // CredentialBlobSize
cred_enc.pbData, // CredentialBlob
CRED_PERSIST_ENTERPRISE, // Persist
0, // AttributeCount
NULL, // Attributes
NULL, // TargetAlias
const_cast<LPTSTR>(m_identity.c_str()) // UserName
};
if (!CredWrite(&cred, 0))
throw win_runtime_error(__FUNCTION__ " CredWrite failed.");
}
void eap::credentials_eaphost::retrieve(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level)
{
// Read credentials.
unique_ptr<CREDENTIAL, CredFree_delete<CREDENTIAL> > cred;
if (!CredRead(target_name(pszTargetName, level).c_str(), CRED_TYPE_GENERIC, 0, (PCREDENTIAL*)&cred))
throw win_runtime_error(__FUNCTION__ " CredRead failed.");
if (cred->CredentialBlobSize) {
// Decrypt the credentials BLOB using user's key.
DATA_BLOB cred_enc = { cred->CredentialBlobSize, cred->CredentialBlob };
DATA_BLOB entropy_blob = { sizeof(s_entropy) , const_cast<LPBYTE>(s_entropy) };
data_blob cred_int;
if (!CryptUnprotectData(&cred_enc, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN | CRYPTPROTECT_VERIFY_PROTECTION, &cred_int))
throw win_runtime_error(__FUNCTION__ " CryptUnprotectData failed.");
m_cred_blob.assign(cred_int.pbData, cred_int.pbData + cred_int.cbData);
SecureZeroMemory(cred_int.pbData, cred_int.cbData);
} else
m_cred_blob.clear();
if (cred->UserName)
m_identity = cred->UserName;
else
m_identity.clear();
wstring xpath(pszTargetName);
m_module.log_config((xpath + L"/Identity").c_str(), m_identity.c_str());
m_module.log_config_discrete((xpath + L"/Credentials").c_str(), m_cred_blob.data(), (ULONG)m_cred_blob.size());
}
LPCTSTR eap::credentials_eaphost::target_suffix() const
{
return _T("BLOB");
}
eap::credentials::source_t eap::credentials_eaphost::combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName)
{
// When cached credentials are available, EapHost calls EapPeerGetIdentity() anyway.
// This allows each peer to decide to reuse or drop cached credentials itself.
// To mimic that behaviour, we do the same:
// 1. Retrieve credentials from cache, store, or configuration
// 2. Call EapHostPeerGetIdentity()
source_t src = source_unknown;
if (cred_cached) {
// Using EAP service cached credentials.
*this = *dynamic_cast<const credentials_eaphost*>(cred_cached);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CACHED2, event_data((unsigned int)cfg.get_method_id()), event_data(get_name()), event_data(pszTargetName), event_data::blank);
src = source_cache;
}
// Note: Currently we do not provide credential storage for EapHost methods within configuration.
// EapHost credentials will never get loaded from configuration, since config_method_eaphost is config_method based, not config_method_with_cred.
// The code is kept (and maintained) for consistency with another methods, if we choose to provide that feature at a later time.
if (src == source_unknown) {
auto cfg_with_cred = dynamic_cast<const config_method_with_cred*>(&cfg);
if (cfg_with_cred && cfg_with_cred->m_use_cred) {
// Using configured credentials.
*this = *dynamic_cast<const credentials_eaphost*>(cfg_with_cred->m_cred.get());
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_CONFIG2, event_data((unsigned int)cfg.get_method_id()), event_data(credentials_eaphost::get_name()), event_data(pszTargetName), event_data::blank);
src = source_config;
}
}
if (src == source_unknown && pszTargetName) {
// Switch user context.
user_impersonator impersonating(hTokenImpersonateUser);
try {
credentials_eaphost cred_loaded(m_module);
cred_loaded.retrieve(pszTargetName, cfg.m_level);
// Using stored credentials.
*this = std::move(cred_loaded);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_STORED2, event_data((unsigned int)cfg.get_method_id()), event_data(get_name()), event_data(pszTargetName), event_data::blank);
src = source_storage;
} catch (...) {
// Not actually an error.
}
}
auto cfg_eaphost = dynamic_cast<const config_method_eaphost*>(&cfg);
BOOL fInvokeUI = FALSE;
DWORD cred_data_size = 0;
eap_blob_runtime cred_data;
unique_ptr<WCHAR[], EapHostPeerFreeRuntimeMemory_delete> identity;
eap_error error; // MSDN says to use EapHostPeerFreeErrorMemory()/eap_error, but given the context of execution, eap_error_runtime might be the right choice.
DWORD dwResult = EapHostPeerGetIdentity(
0,
dwFlags,
cfg_eaphost->get_type(),
(DWORD)cfg_eaphost->m_cfg_blob.size(), cfg_eaphost->m_cfg_blob.data(),
src != source_unknown ? (DWORD)m_cred_blob.size() : 0, src != source_unknown ? m_cred_blob.data() : NULL,
hTokenImpersonateUser,
&fInvokeUI,
&cred_data_size, &cred_data._Myptr,
&identity._Myptr,
&error._Myptr,
NULL);
if (dwResult == ERROR_SUCCESS) {
if (identity && !fInvokeUI) {
// Inner EAP method provided identity and does not require additional UI prompt.
m_identity = identity.get();
m_cred_blob.assign(cred_data.get(), cred_data.get() + cred_data_size);
SecureZeroMemory(cred_data.get(), cred_data_size);
m_module.log_event(&EAPMETHOD_TRACE_EVT_CRED_EAPHOST, event_data((unsigned int)cfg.get_method_id()), event_data(get_name()), event_data(pszTargetName), event_data::blank);
return source_lower;
} else
SecureZeroMemory(cred_data.get(), cred_data_size);
} else if (error) {
// An EAP error in inner EAP method occurred.
m_module.log_error(error.get());
} else {
// A runtime error in inner EAP method occurred.
m_module.log_event(&EAPMETHOD_TRACE_EVT_WIN_ERROR, event_data((unsigned int)dwResult), event_data(__FUNCTION__ " EapHostPeerGetIdentity failed."), event_data::blank);
}
return source_unknown;
}
/// \cond internal
const unsigned char eap::credentials_eaphost::s_entropy[1024] = {
0xe6, 0x01, 0x7b, 0x5f, 0xe5, 0x32, 0xee, 0x8c, 0x57, 0x41, 0x52, 0x95, 0xab, 0xe5, 0x65, 0xdd,
0xb3, 0x12, 0x7c, 0xcb, 0xdb, 0x37, 0x03, 0x76, 0xfc, 0x53, 0x4a, 0xf9, 0x3f, 0xf1, 0xd8, 0x7e,
0x60, 0x9a, 0x49, 0x93, 0xeb, 0x2e, 0x18, 0xd0, 0xfb, 0x40, 0xa9, 0x95, 0x66, 0x8a, 0xdd, 0x99,
0x51, 0x1c, 0xfb, 0x73, 0xa9, 0x7c, 0x31, 0x2b, 0xe6, 0x54, 0x61, 0x64, 0x25, 0x86, 0x36, 0xd4,
0xde, 0xc8, 0x6d, 0x3e, 0x6f, 0x47, 0x40, 0x6f, 0xd6, 0x5b, 0xe2, 0x0c, 0x92, 0x16, 0xe2, 0xdc,
0x45, 0x2f, 0x44, 0xf4, 0x87, 0x64, 0x6d, 0x4e, 0x5c, 0x24, 0x8a, 0x10, 0xb1, 0x2f, 0xa7, 0xe3,
0x7d, 0x60, 0x98, 0x1c, 0xd4, 0x8d, 0xbb, 0x27, 0xb9, 0x02, 0xb1, 0x4a, 0x49, 0xd9, 0x80, 0xe1,
0x7d, 0x20, 0xac, 0xba, 0x12, 0x23, 0x67, 0x28, 0x9e, 0xe8, 0xb6, 0x27, 0x4a, 0x90, 0x47, 0xcf,
0x92, 0x00, 0xde, 0x95, 0xeb, 0x23, 0x3b, 0x0d, 0x5e, 0x08, 0xe9, 0x45, 0x42, 0x7a, 0x6a, 0x73,
0xbb, 0x44, 0xfb, 0x92, 0xc0, 0x24, 0xe2, 0x41, 0xdf, 0x97, 0xb9, 0x02, 0xd4, 0xfd, 0x75, 0x72,
0x99, 0x6d, 0xbc, 0xf8, 0x20, 0xa4, 0x25, 0x99, 0x5b, 0xb6, 0xfe, 0xf9, 0x1e, 0x4c, 0x02, 0x81,
0xe8, 0xb7, 0x5f, 0x5f, 0x01, 0xbc, 0xa3, 0xf6, 0xef, 0x8e, 0x28, 0x9d, 0x20, 0x80, 0xc1, 0xb2,
0xd5, 0x80, 0x44, 0x8d, 0xf3, 0x01, 0x71, 0x3c, 0x0c, 0xb8, 0xc1, 0x0f, 0xc4, 0x79, 0x5a, 0x4d,
0xd3, 0xd6, 0xe8, 0x6d, 0xe2, 0x6c, 0x50, 0x49, 0x54, 0x27, 0x9b, 0x2f, 0xf2, 0x79, 0xbd, 0xa3,
0x25, 0xa5, 0x2c, 0x5c, 0x62, 0x89, 0x13, 0xc3, 0x81, 0x31, 0xdd, 0x31, 0x61, 0x43, 0xce, 0xa6,
0x67, 0x63, 0x25, 0xa4, 0xd0, 0xa7, 0x4c, 0x6c, 0x51, 0x7b, 0xaf, 0x8e, 0xdb, 0xaf, 0x77, 0xeb,
0x31, 0xfc, 0xb2, 0xdb, 0xc1, 0x89, 0x6a, 0xa8, 0x5e, 0xae, 0xf4, 0xff, 0x55, 0x84, 0xb0, 0x62,
0x5f, 0x41, 0xde, 0x43, 0x97, 0x2c, 0xe8, 0x86, 0xbe, 0x94, 0xb6, 0xb3, 0x08, 0x38, 0x32, 0xc6,
0x71, 0x10, 0x5c, 0x82, 0x6c, 0x5d, 0x31, 0x5b, 0x09, 0xd7, 0x92, 0x14, 0xab, 0xcf, 0x8d, 0xc7,
0xc3, 0xdd, 0x2f, 0xef, 0x20, 0x6e, 0x84, 0x4d, 0xb5, 0x9a, 0x44, 0xac, 0x3f, 0xe4, 0x30, 0xa7,
0x7a, 0xff, 0xe3, 0xf6, 0x90, 0xa9, 0xeb, 0xca, 0x49, 0x52, 0x89, 0xd6, 0xca, 0x7b, 0xf2, 0x68,
0xda, 0xe0, 0x88, 0xb0, 0xa2, 0x47, 0xbc, 0x81, 0x2e, 0x58, 0xe0, 0x48, 0xac, 0x6f, 0xf3, 0x66,
0xd1, 0xa7, 0xd6, 0xda, 0x16, 0x88, 0x69, 0x46, 0x95, 0x5f, 0x35, 0x0c, 0x8d, 0x50, 0xbc, 0x27,
0xdb, 0xc5, 0x49, 0x9a, 0xf4, 0x4a, 0x7a, 0x03, 0xad, 0xfc, 0x0f, 0x72, 0x5d, 0x6c, 0x62, 0x06,
0x48, 0x68, 0x75, 0x02, 0xbd, 0xdd, 0xf3, 0xb1, 0xa1, 0x20, 0x64, 0xaf, 0x6f, 0xf2, 0xc0, 0x8c,
0xe8, 0x3c, 0x58, 0x3b, 0xa7, 0x05, 0x2f, 0x4b, 0xef, 0x29, 0x8b, 0x6f, 0x64, 0x39, 0x03, 0x97,
0x8b, 0x91, 0x41, 0xbc, 0xa2, 0x02, 0xa9, 0x0c, 0x5c, 0x52, 0x32, 0xf3, 0xe5, 0x4d, 0x5b, 0x7d,
0xfe, 0x67, 0xe1, 0x82, 0x21, 0x9e, 0x83, 0xf3, 0xd1, 0x5e, 0x37, 0xd9, 0xc6, 0x38, 0x2d, 0x02,
0x1e, 0x18, 0xa3, 0x47, 0xcf, 0xad, 0x99, 0xe7, 0xe1, 0xc9, 0x86, 0x52, 0xdc, 0x18, 0xe7, 0x3b,
0x5f, 0x1d, 0xd8, 0x9c, 0xbe, 0xfb, 0x24, 0x09, 0xe9, 0x51, 0x02, 0x51, 0x01, 0xd4, 0xc5, 0x49,
0xb5, 0x87, 0xd4, 0x5f, 0x7c, 0xdc, 0xf9, 0xc7, 0x7a, 0xf5, 0xb7, 0x1e, 0x6d, 0xc9, 0xc1, 0x1f,
0x27, 0xd1, 0x77, 0x0e, 0xbb, 0xf8, 0x79, 0x48, 0x55, 0x73, 0x8e, 0xc9, 0x14, 0x8d, 0x6f, 0xf6,
0xe5, 0xbe, 0x6c, 0xff, 0xa4, 0x4a, 0xa9, 0x03, 0x08, 0xa2, 0xe4, 0xda, 0xcd, 0x8a, 0x83, 0x86,
0xbd, 0x6e, 0x99, 0xce, 0x98, 0x11, 0xfb, 0x2a, 0x17, 0xd6, 0x79, 0x80, 0x92, 0x11, 0x8d, 0xc4,
0x4a, 0xef, 0x97, 0xb8, 0x0c, 0x9d, 0xce, 0x2a, 0xda, 0xc9, 0x8f, 0xd9, 0x63, 0x89, 0xf0, 0x44,
0x94, 0x75, 0xbf, 0x69, 0x8a, 0xe2, 0x6d, 0x40, 0x75, 0x47, 0xd8, 0x4c, 0x91, 0x85, 0x8d, 0x51,
0xe6, 0xa2, 0x31, 0x13, 0xe5, 0x87, 0x59, 0xb0, 0xf3, 0x89, 0x51, 0xc1, 0xe0, 0xa7, 0xb4, 0x8f,
0x5e, 0xdd, 0x10, 0x80, 0xd8, 0x4a, 0x69, 0x93, 0x14, 0xf5, 0x2c, 0xef, 0xfb, 0xf0, 0xcb, 0x70,
0x72, 0x95, 0xb7, 0xec, 0xa4, 0x79, 0xa3, 0xa2, 0x44, 0xfa, 0x02, 0x9f, 0x2a, 0xbf, 0x8b, 0xe7,
0x87, 0xd4, 0xc2, 0x72, 0x46, 0xd4, 0xf7, 0x57, 0xbe, 0x9a, 0x4e, 0xd4, 0xb5, 0x0f, 0x8d, 0x46,
0x81, 0x6e, 0x1b, 0xe2, 0x85, 0x3b, 0x78, 0x78, 0x9f, 0xa1, 0xd7, 0x27, 0x2d, 0x92, 0x28, 0x62,
0x6d, 0xcd, 0xfe, 0x48, 0x18, 0x19, 0x6c, 0x61, 0x6c, 0x8b, 0xbe, 0xe5, 0xb0, 0xff, 0x80, 0x4d,
0x60, 0x71, 0x89, 0x79, 0x41, 0x08, 0x8e, 0x81, 0x84, 0x71, 0xb8, 0xcd, 0x00, 0x27, 0x37, 0xa2,
0xad, 0x47, 0xc5, 0x6a, 0xf9, 0xb3, 0x00, 0x67, 0x11, 0x60, 0x93, 0xd1, 0xe1, 0x89, 0x9f, 0xec,
0x92, 0xb4, 0x48, 0xa6, 0x11, 0x5f, 0xc1, 0x62, 0xb9, 0xd2, 0x3f, 0xb0, 0x4e, 0xd2, 0xdb, 0x1d,
0x80, 0xd6, 0x02, 0x82, 0x39, 0xb4, 0xbb, 0x3b, 0x51, 0x26, 0xb5, 0x0c, 0xb9, 0xff, 0x9a, 0x38,
0xa8, 0x49, 0x58, 0x70, 0xdd, 0xec, 0x71, 0x27, 0xec, 0x3c, 0x13, 0x8b, 0x2f, 0xf3, 0x38, 0xa8,
0x6e, 0xf2, 0xe2, 0xa0, 0xcd, 0xa4, 0x2a, 0x8b, 0xd4, 0xaa, 0x31, 0x83, 0x4c, 0xe6, 0x98, 0xf5,
0x11, 0xea, 0x40, 0xf9, 0x22, 0xf8, 0x30, 0x56, 0x58, 0xe6, 0xe2, 0x69, 0x49, 0xec, 0x50, 0xbf,
0x39, 0x10, 0x77, 0xa1, 0x54, 0xf8, 0x82, 0x19, 0x7b, 0xa2, 0xc0, 0x45, 0x25, 0x9a, 0xb0, 0xff,
0x3e, 0x7a, 0x61, 0xd6, 0xf4, 0xfb, 0xb9, 0x3a, 0x1e, 0x07, 0xee, 0xd4, 0xf2, 0x73, 0x98, 0x1b,
0xfa, 0xae, 0xe2, 0x3e, 0x5f, 0x5a, 0xd1, 0xda, 0x86, 0x48, 0xfd, 0x43, 0xf4, 0x97, 0x69, 0x58,
0x0e, 0xb8, 0xca, 0xd2, 0x65, 0xb9, 0x64, 0xdb, 0x2b, 0xe8, 0x26, 0x4c, 0x35, 0xc8, 0x86, 0x9a,
0xe7, 0xc1, 0x99, 0x39, 0x85, 0x87, 0xd9, 0x1c, 0x5d, 0xea, 0xa2, 0x6f, 0x5b, 0x81, 0x1a, 0x73,
0x08, 0xf8, 0xf3, 0x07, 0xcb, 0x9c, 0x32, 0x3a, 0x2c, 0x8b, 0x44, 0xe6, 0x48, 0x1e, 0x66, 0x1b,
0x5e, 0xe3, 0x54, 0xef, 0x68, 0xf7, 0x28, 0xf8, 0xd6, 0x16, 0xe5, 0xde, 0xb0, 0xbc, 0x2d, 0x15,
0xa0, 0x9f, 0xa6, 0x91, 0x4c, 0x1c, 0x91, 0xc9, 0xf2, 0x63, 0x32, 0xf2, 0xfb, 0xd9, 0x5e, 0x53,
0xd6, 0x72, 0x8c, 0x1b, 0xe5, 0xf1, 0x80, 0xcc, 0x21, 0xa9, 0x87, 0xaf, 0x64, 0x8d, 0x0f, 0xae,
0xe9, 0x0c, 0x31, 0x26, 0xa4, 0x72, 0x30, 0x8d, 0x0c, 0xfe, 0x5a, 0x25, 0x2d, 0x18, 0xe5, 0x39,
0xcc, 0x04, 0x56, 0xa3, 0x65, 0x84, 0x95, 0x43, 0x40, 0x94, 0x6d, 0x16, 0x15, 0x79, 0x35, 0xa1,
0x7f, 0x4b, 0x3e, 0x08, 0xf1, 0x53, 0xf2, 0xc6, 0x31, 0x7e, 0xb8, 0x29, 0x9b, 0xa4, 0xe9, 0x9d,
0x6b, 0x95, 0xae, 0x37, 0xdf, 0x1d, 0x8c, 0xea, 0xc2, 0x50, 0x14, 0x48, 0x05, 0xd0, 0xcd, 0xd1,
0x25, 0x25, 0x10, 0xa2, 0x85, 0x6f, 0x88, 0xe1, 0x22, 0x9d, 0xd2, 0xbe, 0x59, 0x88, 0x86, 0x20,
0x93, 0x6a, 0x44, 0xed, 0xc8, 0xee, 0x73, 0xe7, 0x1a, 0xc3, 0x16, 0x23, 0xff, 0x69, 0x8c, 0xd0,
};
/// \endcond

View File

@@ -1,60 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"
//////////////////////////////////////////////////////////////////////
// eap::credentials_eaphost
//////////////////////////////////////////////////////////////////////
eap::credentials_eaphost::credentials_eaphost(_In_ module &mod) : credentials_pass(mod)
{
}
eap::credentials_eaphost::credentials_eaphost(_In_ const credentials_eaphost &other) :
credentials_pass(other)
{
}
eap::credentials_eaphost::credentials_eaphost(_Inout_ credentials_eaphost &&other) :
credentials_pass(std::move(other))
{
}
eap::credentials_eaphost& eap::credentials_eaphost::operator=(_In_ const credentials_eaphost &other)
{
if (this != &other)
(credentials_pass&)*this = other;
return *this;
}
eap::credentials_eaphost& eap::credentials_eaphost::operator=(_Inout_ credentials_eaphost &&other)
{
if (this != &other)
(credentials_pass&&)*this = std::move(other);
return *this;
}

View File

@@ -1,293 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"
using namespace std;
using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::method_eaphost
//////////////////////////////////////////////////////////////////////
eap::method_eaphost::method_eaphost(_In_ module &mod, _In_ config_method_eaphost &cfg, _In_ credentials_eaphost &cred) :
m_cfg(cfg),
m_cred(cred),
m_session_id(0),
method(mod)
{
}
eap::method_eaphost::method_eaphost(_Inout_ method_eaphost &&other) :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_session_id(std::move(other.m_session_id)),
method (std::move(other ))
{
}
eap::method_eaphost& eap::method_eaphost::operator=(_Inout_ method_eaphost &&other)
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move method within same credentials only!
(method&)*this = std::move(other );
m_session_id = std::move(other.m_session_id);
}
return *this;
}
void eap::method_eaphost::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize)
{
method::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
// Presume authentication will fail with generic protocol failure. (Pesimist!!!)
// We will reset once we get get_result(Success) call.
m_cfg.m_last_status = config_method::status_auth_failed;
m_cfg.m_last_msg.clear();
// Create EapHost peer session using available connection data (m_cfg) and user data (m_cred).
eap_error_runtime error;
DWORD dwResult = EapHostPeerBeginSession(
dwFlags,
m_cfg.get_type(),
pAttributeArray,
hTokenImpersonateUser,
(DWORD)m_cfg.m_cfg_blob.size(),
m_cfg.m_cfg_blob.data(),
(DWORD)m_cred.m_cred_blob.size(),
m_cred.m_cred_blob.data(),
dwMaxSendPacketSize,
NULL, NULL, NULL,
&m_session_id,
&error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// Session succesfully created.
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerBeginSession failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerBeginSession failed.");
}
void eap::method_eaphost::end_session()
{
// End EapHost peer session.
eap_error_runtime error;
DWORD dwResult = EapHostPeerEndSession(m_session_id, &error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// Session successfuly ended.
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerEndSession failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerEndSession failed.");
method::end_session();
}
EapPeerMethodResponseAction eap::method_eaphost::process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize)
{
assert(pReceivedPacket || dwReceivedPacketSize == 0);
// Let EapHost peer process the packet.
EapHostPeerResponseAction action;
eap_error_runtime error;
DWORD dwResult = EapHostPeerProcessReceivedPacket(
m_session_id,
dwReceivedPacketSize,
reinterpret_cast<const BYTE*>(pReceivedPacket),
&action,
&error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// Packet successfuly processed.
return action_h2p(action);
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerProcessReceivedPacket failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerProcessReceivedPacket failed.");
}
void eap::method_eaphost::get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max)
{
// Let EapHost peer prepare response packet.
eap_blob_runtime _packet;
eap_error_runtime error;
DWORD dwResult = EapHostPeerGetSendPacket(
m_session_id,
&size_max,
&_packet._Myptr,
&error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// Packet successfuly prepared.
packet.assign(_packet.get(), _packet.get() + size_max);
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerGetSendPacket failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerGetSendPacket failed.");
}
void eap::method_eaphost::get_result(
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult)
{
// Let EapHost peer return result.
eap_error_runtime error;
EapHostPeerMethodResult result = {};
DWORD dwResult = EapHostPeerGetResult(
m_session_id,
EapHostPeerMethodResultFromMethod,
&result,
&error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// Result successfuly returned.
method::get_result(reason, pResult);
pResult->dwFailureReasonCode = result.dwFailureReasonCode;
pResult->pAttribArray = result.pAttribArray;
if (result.pEapError) {
// Transfer error to our module memory space.
pResult->pEapError = m_module.make_error(result.pEapError);
EapHostPeerFreeEapError(result.pEapError);
result.pEapError = NULL;
}
if (result.fSaveConnectionData) {
// Update configuration BLOB.
m_cfg.m_cfg_blob.assign(result.pConnectionData, result.pConnectionData + result.dwSizeofConnectionData);
}
if (result.fSaveUserData) {
// Update credentials BLOB.
m_cred.m_cred_blob.assign(result.pUserData, result.pUserData + result.dwSizeofUserData);
}
if (reason == EapPeerMethodResultSuccess)
m_cfg.m_last_status = config_method::status_success;
// Always ask EAP host to save the connection data. And it will save it *only* when we report "success".
// Don't worry. EapHost is well aware of failed authentication condition.
pResult->fSaveConnectionData = TRUE;
pResult->fIsSuccess = TRUE;
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerGetResult failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerGetResult failed.");
}
void eap::method_eaphost::get_ui_context(_Out_ sanitizing_blob &context_data)
{
// Get EapHost peer UI context data.
DWORD dwUIContextDataSize;
LPBYTE pUIContextData;
eap_error_runtime error;
DWORD dwResult = EapHostPeerGetUIContext(
m_session_id,
&dwUIContextDataSize,
&pUIContextData,
&error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// UI context data successfuly returned.
context_data.assign(pUIContextData, pUIContextData + dwUIContextDataSize);
// TODO: Test if EapHostPeerGetUIContext() requires us to free the buffer.
//EapHostPeerFreeMemory(pUIContextData);
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerGetUIContext failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerGetUIContext failed.");
}
EapPeerMethodResponseAction eap::method_eaphost::set_ui_context(
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ DWORD dwUIContextDataSize)
{
// Set EapHost peer UI context data.
EapHostPeerResponseAction action;
eap_error_runtime error;
DWORD dwResult = EapHostPeerSetUIContext(
m_session_id,
dwUIContextDataSize,
pUIContextData,
&action,
&error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// UI context data successfuly returned.
return action_h2p(action);
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerSetUIContext failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerSetUIContext failed.");
}
void eap::method_eaphost::get_response_attributes(_Inout_ EapAttributes *pAttribs)
{
// Get response attributes from EapHost peer.
eap_error_runtime error;
DWORD dwResult = EapHostPeerGetResponseAttributes(
m_session_id,
pAttribs,
&error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// Response attributes successfuly returned.
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerGetResponseAttributes failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerGetResponseAttributes failed.");
}
EapPeerMethodResponseAction eap::method_eaphost::set_response_attributes(_In_ const EapAttributes *pAttribs)
{
// Set response attributes for EapHost peer.
EapHostPeerResponseAction action;
eap_error_runtime error;
DWORD dwResult = EapHostPeerSetResponseAttributes(
m_session_id,
pAttribs,
&action,
&error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// Response attributes successfuly set.
return action_h2p(action);
} else if (error)
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerGetResponseAttributes failed.");
else
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerGetResponseAttributes failed.");
}

View File

@@ -1,21 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"

View File

@@ -1,33 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#pragma once
#include "../include/Config.h"
#include "../include/Credentials.h"
#include "../include/Method.h"
#include <WinStd/Cred.h>
#include <WinStd/Win.h>
#include <Windows.h>
#include <EapHostError.h> // include after Windows.h
#include <EapHostPeerTypes.h>
#include <eappapis.h>

View File

@@ -1,2 +0,0 @@
/temp
/*.user

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\..\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\..\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{13D2D8B5-F6AA-459D-B5F7-29B95DD9D583}</ProjectGuid>
<RootNamespace>EapHost_UI</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\Win32.props" />
<Import Project="..\..\..\include\Debug.props" />
<Import Project="EapHost_UI.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\x64.props" />
<Import Project="..\..\..\include\Debug.props" />
<Import Project="EapHost_UI.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\Win32.props" />
<Import Project="..\..\..\include\Release.props" />
<Import Project="EapHost_UI.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\x64.props" />
<Import Project="..\..\..\include\Release.props" />
<Import Project="EapHost_UI.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<ItemGroup>
<ClInclude Include="..\include\EapHost_UI.h" />
<ClInclude Include="..\res\wxEapHost_UI.h" />
<ClInclude Include="..\src\StdAfx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\res\wxEapHost_UI.cpp" />
<ClCompile Include="..\src\EapHost_UI.cpp" />
<ClCompile Include="..\src\StdAfx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Events\build\Events.vcxproj">
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\res\wxEapHost_UI.fbp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\StdAfx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\EapHost_UI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\res\wxEapHost_UI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\StdAfx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\EapHost_UI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\res\wxEapHost_UI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\res\wxEapHost_UI.fbp">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@@ -1,126 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "../../EAPBase_UI/include/EAP_UI.h"
#include "../../EapHost/include/Config.h"
class wxEAPMethodTypeClientData;
class wxEapHostMethodConfigPanel;
class wxEapHostConfigPanel;
/// \addtogroup EAPBaseGUI
/// @{
///
/// EapHost peer method credential configuration panel
///
typedef wxEAPCredentialsConfigPanel<eap::credentials_pass, wxPasswordCredentialsPanel<eap::credentials_pass, wxPasswordCredentialsPanelBase> > wxEapHostCredentialsConfigPanel;
/// @}
#pragma once
#include "../res/wxEapHost_UI.h"
#include <wx/panel.h>
#include <wx/stattext.h>
#include <Windows.h>
/// \addtogroup EAPBaseGUI
/// @{
///
/// Helper class for auto-destroyable EAP_METHOD_TYPE used in wxWidget's item containers
///
class wxEAPMethodTypeClientData : public wxClientData
{
public:
///
/// Constructs client data object with existing handle
///
wxEAPMethodTypeClientData(const EAP_METHOD_TYPE &type, DWORD properties);
public:
EAP_METHOD_TYPE m_type; ///< EapHost method type
DWORD m_properties; ///< Method properties
eap::sanitizing_blob m_cfg_blob; ///< Method configuration BLOB
};
///
/// Inner EAP method config panel
///
class wxEapHostMethodConfigPanel : public wxEapHostMethodConfigPanelBase
{
public:
///
/// Constructs an inner EAP method config panel
///
/// \param[in ] prov Provider configuration data
/// \param[inout] cfg Method configuration data
/// \param[in ] parent Parent window
///
wxEapHostMethodConfigPanel(const eap::config_provider &prov, eap::config_method_eaphost &cfg, wxWindow *parent);
protected:
/// \cond internal
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
virtual void OnUpdateUI(wxUpdateUIEvent& event);
virtual void OnSettings(wxCommandEvent& event);
/// \endcond
protected:
eap::config_method_eaphost &m_cfg; ///< Method configuration
};
///
/// EapHost peer method configuration panel
///
class wxEapHostConfigPanel : public wxPanel
{
public:
///
/// Constructs a configuration panel
///
/// \param[in ] prov Provider configuration data
/// \param[inout] cfg Method configuration data
/// \param[in ] parent Parent window
///
wxEapHostConfigPanel(const eap::config_provider &prov, eap::config_method_eaphost &cfg, wxWindow* parent);
///
/// Destructs the configuration panel
///
virtual ~wxEapHostConfigPanel();
protected:
/// \cond internal
virtual void OnInitDialog(wxInitDialogEvent& event);
/// \endcond
protected:
wxEapHostMethodConfigPanel *m_method; ///< Method configuration panel
};
/// @}

View File

@@ -1,67 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include <StdAfx.h>
#include "wxEapHost_UI.h"
///////////////////////////////////////////////////////////////////////////
wxEapHostMethodConfigPanelBase::wxEapHostMethodConfigPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxStaticBoxSizer* sb_method;
sb_method = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Inner EAP Method") ), wxVERTICAL );
wxBoxSizer* sb_method_horiz;
sb_method_horiz = new wxBoxSizer( wxHORIZONTAL );
m_method_icon = new wxStaticBitmap( sb_method->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
sb_method_horiz->Add( m_method_icon, 0, wxALL, 5 );
wxBoxSizer* sb_method_vert;
sb_method_vert = new wxBoxSizer( wxVERTICAL );
m_method_label = new wxStaticText( sb_method->GetStaticBox(), wxID_ANY, _("Select and configure inner EAP method"), wxDefaultPosition, wxDefaultSize, 0 );
m_method_label->Wrap( 440 );
sb_method_vert->Add( m_method_label, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* sb_method_inner;
sb_method_inner = new wxBoxSizer( wxHORIZONTAL );
wxArrayString m_methodChoices;
m_method = new wxChoice( sb_method->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_methodChoices, 0 );
m_method->SetSelection( 0 );
sb_method_inner->Add( m_method, 1, wxRIGHT|wxEXPAND, 5 );
m_settings = new wxButton( sb_method->GetStaticBox(), wxID_ANY, _("&Settings"), wxDefaultPosition, wxDefaultSize, 0 );
sb_method_inner->Add( m_settings, 0, 0, 5 );
sb_method_vert->Add( sb_method_inner, 0, wxEXPAND|wxALL, 5 );
sb_method_horiz->Add( sb_method_vert, 1, wxEXPAND, 5 );
sb_method->Add( sb_method_horiz, 1, wxEXPAND, 5 );
this->SetSizer( sb_method );
this->Layout();
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEapHostMethodConfigPanelBase::OnUpdateUI ) );
m_settings->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEapHostMethodConfigPanelBase::OnSettings ), NULL, this );
}
wxEapHostMethodConfigPanelBase::~wxEapHostMethodConfigPanelBase()
{
// Disconnect Events
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEapHostMethodConfigPanelBase::OnUpdateUI ) );
m_settings->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEapHostMethodConfigPanelBase::OnSettings ), NULL, this );
}

View File

@@ -1,465 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">.</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">wxEapHost_UI</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">wxEapHost_UI</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header">#include &lt;StdAfx.h&gt;</property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">1</property>
<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">wxEapHostMethodConfigPanelBase</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="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Inner EAP Method</property>
<property name="minimum_size"></property>
<property name="name">sb_method</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_method_horiz</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" 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="bitmap">Load From Icon Resource; ; [32; 32]</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_method_icon</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="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>
<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="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_method_vert</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</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">Select and configure inner EAP method</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_method_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">440</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|wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_method_inner</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxChoice" 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="choices"></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_method</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="selection">0</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="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnChoice"></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"></property>
<property name="proportion">0</property>
<object class="wxButton" 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">0</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">&amp;Settings</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_settings</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="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSettings</event>
<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>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@@ -1,57 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __WXEAPHOST_UI_H__
#define __WXEAPHOST_UI_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class wxEapHostMethodConfigPanelBase
///////////////////////////////////////////////////////////////////////////////
class wxEapHostMethodConfigPanelBase : public wxPanel
{
private:
protected:
wxStaticBitmap* m_method_icon;
wxStaticText* m_method_label;
wxChoice* m_method;
wxButton* m_settings;
// Virtual event handlers, overide them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnSettings( wxCommandEvent& event ) { event.Skip(); }
public:
wxEapHostMethodConfigPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
~wxEapHostMethodConfigPanelBase();
};
#endif //__WXEAPHOST_UI_H__

View File

@@ -1,179 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"
#pragma comment(lib, "Eappcfg.lib")
//////////////////////////////////////////////////////////////////////
// wxEAPMethodTypeClientData
//////////////////////////////////////////////////////////////////////
wxEAPMethodTypeClientData::wxEAPMethodTypeClientData(const EAP_METHOD_TYPE &type, DWORD properties) :
m_type(type),
m_properties(properties)
{
}
//////////////////////////////////////////////////////////////////////
// wxEapHostMethodConfigPanel
//////////////////////////////////////////////////////////////////////
wxEapHostMethodConfigPanel::wxEapHostMethodConfigPanel(const eap::config_provider &prov, eap::config_method_eaphost &cfg, wxWindow *parent) :
m_cfg(cfg),
wxEapHostMethodConfigPanelBase(parent)
{
UNREFERENCED_PARAMETER(prov);
// Load and set icon.
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_method_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(175)));
winstd::eap_method_info_array methods;
winstd::eap_error error;
DWORD dwResult = EapHostPeerGetMethods(&methods, &error._Myptr);
if (dwResult == ERROR_SUCCESS) {
for (DWORD i = 0; i < methods.dwNumberOfMethods; i++)
m_method->Append(methods.pEapMethods[i].pwszFriendlyName, new wxEAPMethodTypeClientData(methods.pEapMethods[i].eaptype, methods.pEapMethods[i].eapProperties));
} else if (error)
wxLogError(_("Enumerating EAP methods failed (error %u, %s, %s)."), error->dwWinError, error->pRootCauseString, error->pRepairString);
else
wxLogError(_("Enumerating EAP methods failed (error %u)."), dwResult);
}
/// \cond internal
bool wxEapHostMethodConfigPanel::TransferDataToWindow()
{
if (m_method->HasClientObjectData()) {
// Find configured method and set its selection and configuration BLOB.
for (unsigned int i = 0, n = m_method->GetCount(); i < n; i++) {
wxEAPMethodTypeClientData *data = dynamic_cast<wxEAPMethodTypeClientData*>(m_method->GetClientObject(i));
if (data->m_type == m_cfg.get_type()) {
m_method->SetSelection(i);
data->m_cfg_blob = m_cfg.m_cfg_blob;
}
}
}
return wxEapHostMethodConfigPanelBase::TransferDataToWindow();
}
bool wxEapHostMethodConfigPanel::TransferDataFromWindow()
{
wxCHECK(wxEapHostMethodConfigPanelBase::TransferDataFromWindow(), false);
int sel = m_method->GetSelection();
const wxEAPMethodTypeClientData *data =
sel != wxNOT_FOUND && m_method->HasClientObjectData() ?
dynamic_cast<const wxEAPMethodTypeClientData*>(m_method->GetClientObject(sel)) :
NULL;
if (data) {
// Save method selection and configuration.
m_cfg.set_type(data->m_type);
m_cfg.m_cfg_blob = data->m_cfg_blob;
}
return true;
}
void wxEapHostMethodConfigPanel::OnUpdateUI(wxUpdateUIEvent& event)
{
wxEapHostMethodConfigPanelBase::OnUpdateUI(event);
int sel = m_method->GetSelection();
const wxEAPMethodTypeClientData *data =
sel != wxNOT_FOUND && m_method->HasClientObjectData() ?
dynamic_cast<const wxEAPMethodTypeClientData*>(m_method->GetClientObject(sel)) :
NULL;
m_settings->Enable(data && (data->m_properties & eapPropSupportsConfig));
}
void wxEapHostMethodConfigPanel::OnSettings(wxCommandEvent& event)
{
wxEapHostMethodConfigPanelBase::OnSettings(event);
int sel = m_method->GetSelection();
wxEAPMethodTypeClientData *data =
sel != wxNOT_FOUND && m_method->HasClientObjectData() ?
dynamic_cast<wxEAPMethodTypeClientData*>(m_method->GetClientObject(sel)) :
NULL;
if (data && (data->m_properties & eapPropSupportsConfig)) {
DWORD cfg_data_size = 0;
winstd::eap_blob cfg_data;
winstd::eap_error error;
DWORD dwResult = EapHostPeerInvokeConfigUI(GetHWND(), 0, data->m_type, (DWORD)data->m_cfg_blob.size(), data->m_cfg_blob.data(), &cfg_data_size, &cfg_data._Myptr, &error._Myptr);
if (dwResult == ERROR_SUCCESS) {
const BYTE *_cfg_data = cfg_data.get();
data->m_cfg_blob.assign(_cfg_data, _cfg_data + cfg_data_size);
} else if (dwResult == ERROR_CANCELLED) {
// Not really an error.
} else if (error)
wxLogError(_("Configuring EAP method failed (error %u, %s, %s)."), error->dwWinError, error->pRootCauseString, error->pRepairString);
else
wxLogError(_("Configuring EAP method failed (error %u)."), dwResult);
}
}
/// \endcond
//////////////////////////////////////////////////////////////////////
// wxEapHostConfigPanel
//////////////////////////////////////////////////////////////////////
wxEapHostConfigPanel::wxEapHostConfigPanel(const eap::config_provider &prov, eap::config_method_eaphost &cfg, wxWindow* parent) : wxPanel(parent)
{
wxBoxSizer* sb_content;
sb_content = new wxBoxSizer( wxVERTICAL );
m_method = new wxEapHostMethodConfigPanel(prov, cfg, this);
sb_content->Add(m_method, 0, wxEXPAND, 5);
this->SetSizer(sb_content);
this->Layout();
// Connect Events
this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEapHostConfigPanel::OnInitDialog));
}
wxEapHostConfigPanel::~wxEapHostConfigPanel()
{
// Disconnect Events
this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEapHostConfigPanel::OnInitDialog));
}
/// \cond internal
void wxEapHostConfigPanel::OnInitDialog(wxInitDialogEvent& event)
{
// Forward the event to child panels.
if (m_method)
m_method->GetEventHandler()->ProcessEvent(event);
}
/// \endcond

View File

@@ -1,21 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"

View File

@@ -1,29 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#pragma once
#define _CRT_SECURE_NO_WARNINGS // Prevent warnings from wxWidgets headers
#include "../include/EapHost_UI.h"
#include <WinStd/EAP.h>
#include <eaphostpeerconfigapis.h>

Binary file not shown.

Binary file not shown.

View File

@@ -1,2 +0,0 @@
/temp
/*.user

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\..\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\..\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

View File

@@ -1,104 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{114A70BB-8698-4A0C-8C90-58F22EDD8129}</ProjectGuid>
<RootNamespace>GTC</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\Win32.props" />
<Import Project="..\..\..\include\Debug.props" />
<Import Project="GTC.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\x64.props" />
<Import Project="..\..\..\include\Debug.props" />
<Import Project="GTC.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\Win32.props" />
<Import Project="..\..\..\include\Release.props" />
<Import Project="GTC.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\x64.props" />
<Import Project="..\..\..\include\Release.props" />
<Import Project="GTC.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<ItemGroup>
<ClInclude Include="..\include\Config.h" />
<ClInclude Include="..\include\Method.h" />
<ClInclude Include="..\src\StdAfx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\Config.cpp" />
<ClCompile Include="..\src\Method.cpp" />
<ClCompile Include="..\src\StdAfx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Events\build\Events.vcxproj">
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\StdAfx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\Config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\Method.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\StdAfx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\Config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\Method.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -1,175 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include <sal.h>
namespace eap
{
class config_method_eapgtc;
}
#pragma once
#include "../../EAPBase/include/Config.h"
#include <Windows.h>
#include <sal.h>
#include <tchar.h>
namespace eap
{
/// \addtogroup EAPBaseConfig
/// @{
///
/// EAP-GTC configuration
///
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
///
/// \param[in] mod EAP module to use for global services
/// \param[in] level Config level (0=outer, 1=inner, 2=inner-inner...)
///
config_method_eapgtc(_In_ module &mod, _In_ unsigned int level);
///
/// Copies configuration
///
/// \param[in] other Configuration to copy from
///
config_method_eapgtc(_In_ const config_method_eapgtc &other);
///
/// Moves configuration
///
/// \param[in] other Configuration to move from
///
config_method_eapgtc(_Inout_ config_method_eapgtc &&other);
///
/// Copies configuration
///
/// \param[in] other Configuration to copy from
///
/// \returns Reference to this object
///
config_method_eapgtc& operator=(_In_ const config_method_eapgtc &other);
///
/// Moves configuration
///
/// \param[in] other Configuration to move from
///
/// \returns Reference to this object
///
config_method_eapgtc& operator=(_Inout_ config_method_eapgtc &&other);
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`
///
virtual winstd::eap_type_t get_method_id() const;
///
/// @copydoc eap::config_method::get_method_str()
/// \returns This implementation always returns `L"EAP-GTC"`
///
virtual const wchar_t* get_method_str() const;
///
/// @copydoc eap::config_method::make_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

@@ -1,118 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
namespace eap
{
class method_gtc;
}
#pragma once
#include "Config.h"
#include "../../EAPBase/include/Method.h"
namespace eap
{
/// \addtogroup EAPBaseMethod
/// @{
///
/// GTC method
///
class method_gtc : public method
{
WINSTD_NONCOPYABLE(method_gtc)
public:
///
/// Constructs a GTC method
///
/// \param[in] mod GTC module to use for global services
/// \param[in] cfg Method configuration
/// \param[in] cred User credentials
///
method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _In_ credentials &cred);
///
/// Moves a GTC method
///
/// \param[in] other GTC method to move from
///
method_gtc(_Inout_ method_gtc &&other);
///
/// Moves a GTC method
///
/// \param[in] other GTC method to move from
///
/// \returns Reference to this object
///
method_gtc& operator=(_Inout_ method_gtc &&other);
/// \name Session management
/// @{
virtual void begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize = MAXDWORD);
/// @}
/// \name Packet processing
/// @{
virtual EapPeerMethodResponseAction process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize);
virtual void get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max = MAXDWORD);
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{
virtual void get_ui_context(_Out_ sanitizing_blob &context_data);
virtual EapPeerMethodResponseAction set_ui_context(
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ DWORD dwUIContextDataSize);
/// @}
protected:
config_method_eapgtc &m_cfg; ///< Method configuration
credentials &m_cred; ///< Method user credentials
winstd::sanitizing_wstring m_challenge; ///< GTC challenge
winstd::sanitizing_wstring m_response; ///< GTC response
};
/// @}
}

View File

@@ -1,183 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"
using namespace std;
using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::config_method_eapgtc
//////////////////////////////////////////////////////////////////////
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));
}
eap::config_method_eapgtc::config_method_eapgtc(_In_ const config_method_eapgtc &other) :
config_method_with_cred(other)
{
}
eap::config_method_eapgtc::config_method_eapgtc(_Inout_ config_method_eapgtc &&other) :
config_method_with_cred(std::move(other))
{
}
eap::config_method_eapgtc& eap::config_method_eapgtc::operator=(_In_ const config_method_eapgtc &other)
{
if (this != &other)
(config_method_with_cred&)*this = other;
return *this;
}
eap::config_method_eapgtc& eap::config_method_eapgtc::operator=(_Inout_ config_method_eapgtc &&other)
{
if (this != &other)
(config_method_with_cred&&)*this = std::move(other);
return *this;
}
eap::config* eap::config_method_eapgtc::clone() const
{
return new config_method_eapgtc(*this);
}
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;
}
const wchar_t* eap::config_method_eapgtc::get_method_str() const
{
return L"EAP-GTC";
}
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

@@ -1,163 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"
using namespace std;
using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::method_gtc
//////////////////////////////////////////////////////////////////////
eap::method_gtc::method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _In_ credentials &cred) :
m_cfg(cfg),
m_cred(cred),
method(mod)
{
}
eap::method_gtc::method_gtc(_Inout_ method_gtc &&other) :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_challenge(std::move(other.m_challenge)),
m_response (std::move(other.m_response )),
method (std::move(other ))
{
}
eap::method_gtc& eap::method_gtc::operator=(_Inout_ method_gtc &&other)
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move method within same credentials only!
(method&)*this = std::move(other );
m_challenge = std::move(other.m_challenge);
m_response = std::move(other.m_response );
}
return *this;
}
void eap::method_gtc::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize)
{
method::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
// Presume authentication will fail with generic protocol failure. (Pesimist!!!)
// We will reset once we get get_result(Success) call.
m_cfg.m_last_status = config_method::status_auth_failed;
m_cfg.m_last_msg.clear();
}
EapPeerMethodResponseAction eap::method_gtc::process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize)
{
assert(pReceivedPacket || dwReceivedPacketSize == 0);
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);
m_module.log_event(&EAPMETHOD_GTC_RESPONSE_REQ, event_data((unsigned int)eap_type_gtc), event_data::blank);
// 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.");
}
void eap::method_gtc::get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max)
{
// Encode GTC response as UTF-8.
sanitizing_string response_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_response, response_utf8, NULL, NULL);
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(response_utf8.begin(), response_utf8.end());
}
void eap::method_gtc::get_result(
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult)
{
assert(pResult);
method::get_result(reason, pResult);
if (reason == EapPeerMethodResultSuccess)
m_cfg.m_last_status = config_method::status_success;
// Always ask EAP host to save the connection data. And it will save it *only* when we report "success".
// Don't worry. EapHost is well aware of failed authentication condition.
pResult->fSaveConnectionData = TRUE;
pResult->fIsSuccess = TRUE;
}
void eap::method_gtc::get_ui_context(_Out_ sanitizing_blob &context_data)
{
// Return authenticator string.
context_data.assign(
reinterpret_cast<sanitizing_blob::const_pointer>(m_challenge.data() ),
reinterpret_cast<sanitizing_blob::const_pointer>(m_challenge.data() + m_challenge.length()));
}
EapPeerMethodResponseAction eap::method_gtc::set_ui_context(
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ DWORD dwUIContextDataSize)
{
m_module.log_event(&EAPMETHOD_GTC_RESPONSE, event_data((unsigned int)eap_type_gtc), event_data::blank);
// Save GTC response.
m_response.assign(
reinterpret_cast<sanitizing_wstring::const_pointer>(pUIContextData ),
reinterpret_cast<sanitizing_wstring::const_pointer>(pUIContextData + dwUIContextDataSize));
// Send the response.
m_cfg.m_last_status = config_method::status_cred_invalid; // Blame "credentials" if we fail beyond this point.
return EapPeerMethodResponseActionSend;
}

View File

@@ -1,21 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"

View File

@@ -1,30 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#pragma once
#include "../include/Config.h"
#include "../include/Method.h"
#include <WinStd/Hex.h>
#include <Windows.h>
#include <EapHostError.h> // include after Windows.h
#include <RasError.h>

View File

@@ -1,2 +0,0 @@
/temp
/*.user

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\..\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\..\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{34680813-3A52-46FB-B5A8-1E4BBF770855}</ProjectGuid>
<RootNamespace>GTC_UI</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\Win32.props" />
<Import Project="..\..\..\include\Debug.props" />
<Import Project="GTC_UI.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\x64.props" />
<Import Project="..\..\..\include\Debug.props" />
<Import Project="GTC_UI.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\Win32.props" />
<Import Project="..\..\..\include\Release.props" />
<Import Project="GTC_UI.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\include\x64.props" />
<Import Project="..\..\..\include\Release.props" />
<Import Project="GTC_UI.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<ItemGroup>
<ClInclude Include="..\include\GTC_UI.h" />
<ClInclude Include="..\res\wxGTC_UI.h" />
<ClInclude Include="..\src\StdAfx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\res\wxGTC_UI.cpp" />
<ClCompile Include="..\src\GTC_UI.cpp" />
<ClCompile Include="..\src\StdAfx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Events\build\Events.vcxproj">
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\res\wxGTC_UI.fbp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\StdAfx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\GTC_UI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\res\wxGTC_UI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\StdAfx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GTC_UI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\res\wxGTC_UI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\res\wxGTC_UI.fbp">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@@ -1,140 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "../../EAPBase_UI/include/EAP_UI.h"
#include "../../GTC/include/Config.h"
class wxGTCConfigPanel;
class wxGTCResponseDialog;
class wxGTCResponsePanel;
/// \addtogroup EAPBaseGUI
/// @{
///
/// GTC challenge/response credential entry panel
///
typedef wxIdentityCredentialsPanel<eap::credentials_identity, wxIdentityCredentialsPanelBase> wxGTCResponseCredentialsPanel;
///
/// GTC challenge/response credential configuration panel
///
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;
/// @}
#pragma once
#include "../res/wxGTC_UI.h"
#include <Windows.h>
/// \addtogroup EAPBaseGUI
/// @{
///
/// GTC configuration panel
///
class wxGTCConfigPanel : public wxGTCConfigPanelBase
{
public:
///
/// Constructs a configuration panel
///
wxGTCConfigPanel(const eap::config_provider &prov, eap::config_method_eapgtc &cfg, wxWindow* parent);
protected:
/// \cond internal
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
virtual void OnUpdateUI(wxUpdateUIEvent& event);
/// \endcond
protected:
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
};
///
/// GTC challenge/response dialog
///
class wxGTCResponseDialog : public wxEAPGeneralDialog
{
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);
};
///
/// GTC challenge/response panel
///
class wxGTCResponsePanel : public wxGTCResponsePanelBase
{
public:
///
/// Constructs a panel
///
/// \param[inout] response GTC response
/// \param[in ] challenge GTC challenge
/// \param[in ] parent Parent window
///
wxGTCResponsePanel(winstd::sanitizing_wstring &response, const wchar_t *challenge, wxWindow* parent);
protected:
/// \cond internal
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
/// \endcond
protected:
winstd::sanitizing_wstring &m_response_value; ///< GTC response
};
/// @}

View File

@@ -1,92 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include <StdAfx.h>
#include "wxGTC_UI.h"
///////////////////////////////////////////////////////////////////////////
wxGTCResponsePanelBase::wxGTCResponsePanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
m_sb_response = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("GTC Challenge") ), wxVERTICAL );
wxBoxSizer* sb_response_horiz;
sb_response_horiz = new wxBoxSizer( wxHORIZONTAL );
m_response_icon = new wxStaticBitmap( m_sb_response->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
sb_response_horiz->Add( m_response_icon, 0, wxALL, 5 );
m_sb_response_vert = new wxBoxSizer( wxVERTICAL );
m_response_label = new wxStaticText( m_sb_response->GetStaticBox(), wxID_ANY, _("Please provide your response."), wxDefaultPosition, wxDefaultSize, 0 );
m_response_label->Wrap( 440 );
m_sb_response_vert->Add( m_response_label, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* sb_response_tbl;
sb_response_tbl = new wxFlexGridSizer( 0, 2, 5, 5 );
sb_response_tbl->AddGrowableCol( 1 );
sb_response_tbl->SetFlexibleDirection( wxBOTH );
sb_response_tbl->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_challenge = new wxStaticText( m_sb_response->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_challenge->Wrap( -1 );
m_challenge->SetToolTip( _("Server challenge") );
sb_response_tbl->Add( m_challenge, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_response = new wxTextCtrl( m_sb_response->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_response->SetToolTip( _("Enter your response here") );
sb_response_tbl->Add( m_response, 2, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_sb_response_vert->Add( sb_response_tbl, 0, wxEXPAND|wxALL, 5 );
sb_response_horiz->Add( m_sb_response_vert, 1, wxEXPAND, 5 );
m_sb_response->Add( sb_response_horiz, 0, wxEXPAND, 5 );
this->SetSizer( m_sb_response );
this->Layout();
}
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

@@ -1,695 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">.</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">wxGTC_UI</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">wxGTC_UI</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header">#include &lt;StdAfx.h&gt;</property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">1</property>
<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">wxGTCResponsePanelBase</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"></event>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">GTC Challenge</property>
<property name="minimum_size"></property>
<property name="name">m_sb_response</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_response_horiz</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" 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="bitmap">Load From Icon Resource; ; [32; 32]</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_response_icon</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="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>
<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="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_sb_response_vert</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</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">Please provide your response.</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_response_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">440</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|wxALL</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">5</property>
<property name="minimum_size"></property>
<property name="name">sb_response_tbl</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">5</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</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"></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_challenge</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">Server challenge</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|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">2</property>
<object class="wxTextCtrl" 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="maxlength"></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_response</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">Enter your response here</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></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="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</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

@@ -1,76 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __WXGTC_UI_H__
#define __WXGTC_UI_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/panel.h>
#include <wx/choicebk.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class wxGTCResponsePanelBase
///////////////////////////////////////////////////////////////////////////////
class wxGTCResponsePanelBase : public wxPanel
{
private:
protected:
wxStaticBoxSizer* m_sb_response;
wxStaticBitmap* m_response_icon;
wxBoxSizer* m_sb_response_vert;
wxStaticText* m_response_label;
wxStaticText* m_challenge;
wxTextCtrl* m_response;
public:
wxGTCResponsePanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
~wxGTCResponsePanelBase();
};
///////////////////////////////////////////////////////////////////////////////
/// 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

@@ -1,163 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"
//////////////////////////////////////////////////////////////////////
// wxGTCConfigPanel
//////////////////////////////////////////////////////////////////////
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)
{
// 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_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
bool wxGTCConfigPanel::TransferDataToWindow()
{
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
//////////////////////////////////////////////////////////////////////
// wxGTCResponseDialog
//////////////////////////////////////////////////////////////////////
wxGTCResponseDialog::wxGTCResponseDialog(const eap::config_provider &prov, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) :
wxEAPGeneralDialog(parent, id, title, pos, size, style)
{
// Set banner title.
m_banner->m_title->SetLabel(wxString::Format(_("%s Challenge"), wxEAPGetProviderName(prov.m_name)));
}
//////////////////////////////////////////////////////////////////////
// wxGTCResponsePanel
//////////////////////////////////////////////////////////////////////
wxGTCResponsePanel::wxGTCResponsePanel(winstd::sanitizing_wstring &response, const wchar_t *challenge, wxWindow* parent) :
wxGTCResponsePanelBase(parent),
m_response_value(response)
{
// Load and set icon.
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_response_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(24)));
// Set challenge label.
m_challenge->SetLabelText(challenge);
m_challenge->Wrap(200);
this->Layout();
}
/// \cond internal
bool wxGTCResponsePanel::TransferDataToWindow()
{
m_response->SetValue(m_response_value.c_str());
return wxGTCResponsePanelBase::TransferDataToWindow();
}
bool wxGTCResponsePanel::TransferDataFromWindow()
{
wxCHECK(wxGTCResponsePanelBase::TransferDataFromWindow(), false);
m_response_value = m_response->GetValue();
return true;
}
/// \endcond

View File

@@ -1,21 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#include "StdAfx.h"

View File

@@ -1,25 +0,0 @@
/*
Copyright 2015-2016 Amebis
Copyright 2016 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/>.
*/
#pragma once
#define _CRT_SECURE_NO_WARNINGS // Prevent warnings from wxWidgets headers
#include "../include/GTC_UI.h"

View File

@@ -22,8 +22,10 @@
namespace eap
{
///
/// MSCHAPv2 configuration
///
class config_method_mschapv2;
class config_method_eapmschapv2;
}
#pragma once
@@ -37,12 +39,6 @@ namespace eap
namespace eap
{
/// \addtogroup EAPBaseConfig
/// @{
///
/// MSCHAPv2 configuration
///
class config_method_mschapv2 : public config_method_with_cred
{
public:
@@ -86,88 +82,28 @@ namespace eap
///
config_method_mschapv2& operator=(_Inout_ config_method_mschapv2 &&other);
///
/// Clones configuration
///
/// \returns Pointer to cloned configuration
///
virtual config* clone() const;
///
/// @copydoc eap::config_method::get_method_id()
/// \returns This implementation always returns `winstd::eap_type_legacy_mschapv2`
/// Returns EAP method type of this configuration
///
/// \returns `eap::type_mschapv2`
///
virtual winstd::eap_type_t get_method_id() const;
///
/// @copydoc eap::config_method::get_method_str()
/// \returns This implementation always returns `L"MSCHAPv2"`
/// Returns a string \c L"MSCHAPv2"
///
virtual const wchar_t* get_method_str() const;
///
/// @copydoc eap::config_method::make_credentials()
/// \returns This implementation always returns `eap::credentials_pass` type of credentials
/// Creates a blank set of credentials suitable for this method
///
virtual credentials* make_credentials() const;
};
///
/// EAP-MSCHAPv2 configuration
///
class config_method_eapmschapv2 : public config_method_mschapv2
{
public:
///
/// Constructs configuration
///
/// \param[in] mod EAP module to use for global services
/// \param[in] level Config level (0=outer, 1=inner, 2=inner-inner...)
///
config_method_eapmschapv2(_In_ module &mod, _In_ unsigned int level);
///
/// Copies configuration
///
/// \param[in] other Configuration to copy from
///
config_method_eapmschapv2(_In_ const config_method_eapmschapv2 &other);
///
/// Moves configuration
///
/// \param[in] other Configuration to move from
///
config_method_eapmschapv2(_Inout_ config_method_eapmschapv2 &&other);
///
/// Copies configuration
///
/// \param[in] other Configuration to copy from
///
/// \returns Reference to this object
///
config_method_eapmschapv2& operator=(_In_ const config_method_eapmschapv2 &other);
///
/// Moves configuration
///
/// \param[in] other Configuration to move from
///
/// \returns Reference to this object
///
config_method_eapmschapv2& operator=(_Inout_ config_method_eapmschapv2 &&other);
virtual config* clone() const;
///
/// @copydoc eap::config_method::get_method_id()
/// \returns This implementation always returns `winstd::eap_type_mschapv2`
///
virtual winstd::eap_type_t get_method_id() const;
///
/// @copydoc eap::config_method::get_method_str()
/// \returns This implementation always returns `L"EAP-MSCHAPv2"`
///
virtual const wchar_t* get_method_str() const;
};
/// @}
}

View File

@@ -23,19 +23,30 @@
namespace eap
{
enum chap_packet_code_t;
struct WINSTD_NOVTABLE chap_header;
struct WINSTD_NOVTABLE challenge_mschapv2;
struct WINSTD_NOVTABLE challenge_hash;
struct WINSTD_NOVTABLE nt_password_hash;
struct WINSTD_NOVTABLE nt_response;
struct WINSTD_NOVTABLE authenticator_response;
///
/// MSCHAPv2 Challenge
///
struct challenge_mschapv2;
///
/// \defgroup MSCHAPv2 MSCHAPv2
/// Microsoft Challenge-Handshake Authentication Protocol (version 2)
/// MSCHAPv2 Challenge Hash
///
/// @{
struct challenge_hash;
///
/// NT-Password Hash
///
struct nt_password_hash;
///
/// NT-Response
///
struct nt_response;
///
/// Authenticator Response
///
struct authenticator_response;
///
/// Creates DES encryption key with given plaintext key
@@ -44,11 +55,7 @@ namespace eap
/// \param[in] key The key (without parity bits)
/// \param[in] size Size of \p key (maximum 7B)
///
/// \returns DES encryption key
///
winstd::crypt_key create_des_key(_In_ HCRYPTPROV cp, _In_count_(size) const unsigned char *key, _In_ size_t size);
/// @}
}
#pragma once
@@ -58,41 +65,10 @@ namespace eap
namespace eap
{
/// \addtogroup MSCHAPv2
/// @{
///
/// CHAP packet codes
///
#pragma warning(suppress: 4480)
enum chap_packet_code_t : unsigned char {
chap_packet_code_challenge = 1, ///< Challenge
chap_packet_code_response = 2, ///< Response
chap_packet_code_success = 3, ///< Success
chap_packet_code_failure = 4, ///< Failure
mschapv2_packet_code_change_password = 7, ///< Change password
};
#pragma pack(push)
#pragma pack(1)
///
/// CHAP packet header base class
///
struct WINSTD_NOVTABLE chap_header
{
chap_packet_code_t code; ///< CHAP packet code
unsigned char ident; ///< CHAP identifier
unsigned char length[2]; ///< CHAP packet length
};
///
/// MSCHAPv2 Challenge
///
struct WINSTD_NOVTABLE challenge_mschapv2 : public sanitizing_blob_xf<16>
struct __declspec(novtable) challenge_mschapv2 : public sanitizing_blob_xf<16>
{
///
/// Generates random challenge
@@ -103,10 +79,7 @@ namespace eap
};
///
/// MSCHAPv2 Challenge Hash
///
struct WINSTD_NOVTABLE challenge_hash : public sanitizing_blob_xf<8>
struct __declspec(novtable) challenge_hash : public sanitizing_blob_xf<8>
{
///
/// Constructor
@@ -125,7 +98,7 @@ namespace eap
///
challenge_hash(
_In_ HCRYPTPROV cp,
_In_ const sanitizing_blob &challenge_server,
_In_ const challenge_mschapv2 &challenge_server,
_In_ const challenge_mschapv2 &challenge_client,
_In_z_ const char *username);
@@ -147,10 +120,7 @@ namespace eap
};
///
/// NT-Password Hash
///
struct WINSTD_NOVTABLE nt_password_hash : public sanitizing_blob_xf<16>
struct __declspec(novtable) nt_password_hash : public sanitizing_blob_xf<16>
{
///
/// Constructor
@@ -199,10 +169,7 @@ namespace eap
};
///
/// NT-Response
///
struct WINSTD_NOVTABLE nt_response : public sanitizing_blob_xf<24>
struct __declspec(novtable) nt_response : public sanitizing_blob_xf<24>
{
///
/// Constructor
@@ -222,7 +189,7 @@ namespace eap
///
nt_response(
_In_ HCRYPTPROV cp,
_In_ const sanitizing_blob &challenge_server,
_In_ const challenge_mschapv2 &challenge_server,
_In_ const challenge_mschapv2 &challenge_client,
_In_z_ const char *username,
_In_z_ const wchar_t *password);
@@ -245,10 +212,7 @@ namespace eap
};
///
/// Authenticator Response
///
struct WINSTD_NOVTABLE authenticator_response : public sanitizing_blob_xf<20>
struct __declspec(novtable) authenticator_response : public sanitizing_blob_xf<20>
{
///
/// Constructor
@@ -269,7 +233,7 @@ namespace eap
///
authenticator_response(
_In_ HCRYPTPROV cp,
_In_ const sanitizing_blob &challenge_server,
_In_ const challenge_mschapv2 &challenge_server,
_In_ const challenge_mschapv2 &challenge_client,
_In_z_ const char *username,
_In_z_ const wchar_t *password,
@@ -293,6 +257,4 @@ namespace eap
};
#pragma pack(pop)
/// @}
}

View File

@@ -20,9 +20,10 @@
namespace eap
{
class method_mschapv2_base;
///
/// MSCHAPv2 method
///
class method_mschapv2;
class method_mschapv2_diameter;
}
#pragma once
@@ -37,137 +38,31 @@ namespace eap
namespace eap
{
/// \addtogroup EAPBaseMethod
/// @{
///
/// MSCHAPv2 method base class
///
class method_mschapv2_base : public method
{
WINSTD_NONCOPYABLE(method_mschapv2_base)
public:
///
/// Constructs a MSCHAPv2 method
///
/// \param[in] mod MSCHAPv2 module to use for global services
/// \param[in] cfg Method configuration
/// \param[in] cred User credentials
///
method_mschapv2_base(_In_ module &mod, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred);
///
/// Moves a MSCHAPv2 method
///
/// \param[in] other MSCHAPv2 method to move from
///
method_mschapv2_base(_Inout_ method_mschapv2_base &&other);
///
/// Moves a MSCHAPv2 method
///
/// \param[in] other MSCHAPv2 method to move from
///
/// \returns Reference to this object
///
method_mschapv2_base& operator=(_Inout_ method_mschapv2_base &&other);
/// \name Session management
/// @{
virtual void begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize = MAXDWORD);
/// @}
/// \name Packet processing
/// @{
virtual void get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max = MAXDWORD);
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
protected:
///
/// Processes MSCHAPv2 success message
///
/// \sa [Microsoft PPP CHAP Extensions, Version 2 (Chapter 5. Success Packet)](https://tools.ietf.org/html/rfc2759#section-5)
///
/// \param[in] argv List of message values
///
void process_success(_In_ const std::list<std::string> &argv);
///
/// Processes MSCHAPv2 error message
///
/// \sa [Microsoft PPP CHAP Extensions, Version 2 (Chapter 6. Failure Packet)](https://tools.ietf.org/html/rfc2759#section-6)
///
/// \param[in] argv List of message values
///
void process_error(_In_ const std::list<std::string> &argv);
///
/// Splits MSCHAPv2 success or error messages
///
/// \param[in] resp MSCHAPv2 success or error message (i.e. "E=648 R=1 C=d86e0aa6cb5539e5fb31dd5dc5f6898c V=3 M=Password Expired")
/// \param[in] count Number of characters in \p resp
///
/// \returns A list of individual parts of \p resp message (i.e. ("E=648", "R=1", "C=d86e0aa6cb5539e5fb31dd5dc5f6898c", "V=3", "M=Password Expired"))
///
static std::list<std::string> parse_response(_In_count_(count) const char *resp, _In_ size_t count);
protected:
config_method_mschapv2 &m_cfg; ///< Method configuration
credentials_pass &m_cred; ///< Method user credentials
winstd::crypt_prov m_cp; ///< Cryptography provider for general services
sanitizing_blob m_challenge_server; ///< MSCHAP server challenge
challenge_mschapv2 m_challenge_client; ///< MSCHAP client challenge
unsigned char m_ident; ///< Ident
nt_response m_nt_resp; ///< NT-Response
sanitizing_blob m_packet_res; ///< Response packet
};
///
/// MSCHAPv2 method
///
class method_mschapv2 : public method_mschapv2_base
class method_mschapv2 : public method_noneap
{
WINSTD_NONCOPYABLE(method_mschapv2)
public:
///
/// Constructs a MSCHAPv2 method
/// Constructs an EAP method
///
/// \param[in] mod MSCHAPv2 module to use for global services
/// \param[in] mod EAP module to use for global services
/// \param[in] cfg Method configuration
/// \param[in] cred User credentials
///
method_mschapv2(_In_ module &mod, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred);
method_mschapv2(_In_ module &module, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred);
///
/// Moves a MSCHAPv2 method
/// Moves an EAP method
///
/// \param[in] other MSCHAPv2 method to move from
/// \param[in] other EAP method to move from
///
method_mschapv2(_Inout_ method_mschapv2 &&other);
///
/// Moves a MSCHAPv2 method
/// Moves an EAP method
///
/// \param[in] other MSCHAPv2 method to move from
/// \param[in] other EAP method to move from
///
/// \returns Reference to this object
///
@@ -176,66 +71,26 @@ namespace eap
/// \name Packet processing
/// @{
virtual EapPeerMethodResponseAction process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize);
/// @}
};
/// @}
///
/// MSCHAPv2 method over Diameter AVP (for use as inner EAP-TTLS)
/// Starts an EAP authentication session on the peer EapHost using the EAP method.
///
class method_mschapv2_diameter : public method_mschapv2_base
{
WINSTD_NONCOPYABLE(method_mschapv2_diameter)
public:
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
///
/// Constructs a MSCHAPv2 method
///
/// \param[in] mod MSCHAPv2 module to use for global services
/// \param[in] cfg Method configuration
/// \param[in] cred User credentials
///
method_mschapv2_diameter(_In_ module &mod, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred);
///
/// Moves a MSCHAPv2 method
///
/// \param[in] other MSCHAPv2 method to move from
///
method_mschapv2_diameter(_Inout_ method_mschapv2_diameter &&other);
///
/// Moves a MSCHAPv2 method
///
/// \param[in] other MSCHAPv2 method to move from
///
/// \returns Reference to this object
///
method_mschapv2_diameter& operator=(_Inout_ method_mschapv2_diameter &&other);
/// \name Session management
/// @{
virtual void begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize = MAXDWORD);
/// @}
/// \name Packet processing
/// @{
virtual EapPeerMethodResponseAction process_request_packet(
///
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///
virtual void process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize);
_In_ DWORD dwReceivedPacketSize,
_Out_ EapPeerMethodOutput *pEapOutput);
/// @}
@@ -250,10 +105,44 @@ namespace eap
///
void process_packet(_In_bytecount_(size_pck) const void *pck, _In_ size_t size_pck);
///
/// Processes MS-CHAP2-Success AVP
///
/// \sa [Microsoft PPP CHAP Extensions, Version 2 (Chapter 5. Success Packet)](https://tools.ietf.org/html/rfc2759#section-5)
///
/// \param[in] argv List of message values
///
void process_success(_In_ const std::list<std::string> &argv);
///
/// Processes MS-CHAP-Error AVP
///
/// \sa [Microsoft PPP CHAP Extensions, Version 2 (Chapter 6. Failure Packet)](https://tools.ietf.org/html/rfc2759#section-6)
///
/// \param[in] argv List of message values
///
void process_error(_In_ const std::list<std::string> &argv);
///
/// Splits MS-CHAP2-Success or MS-CHAP-Error messages
///
/// \param[in] resp MS-CHAP2-Success or MS-CHAP-Error message (i.e. "E=648 R=1 C=d86e0aa6cb5539e5fb31dd5dc5f6898c V=3 M=Password Expired")
/// \param[in] count Number of characters in \p resp
///
/// \returns A list of individual parts of \p resp message (i.e. ("E=648", "R=1", "C=d86e0aa6cb5539e5fb31dd5dc5f6898c", "V=3", "M=Password Expired"))
///
static std::list<std::string> parse_response(_In_count_(count) const char *resp, _In_ size_t count);
protected:
///
/// Communication phase
///
credentials_pass &m_cred; ///< Method user credentials
winstd::crypt_prov m_cp; ///< Cryptography provider for general services
challenge_mschapv2 m_challenge_server; ///< MSCHAP server challenge
challenge_mschapv2 m_challenge_client; ///< MSCHAP client challenge
unsigned char m_ident; ///< Ident
nt_response m_nt_resp; ///< NT-Response
bool m_success; ///< Did we receive MS-CHAP2-Success?
enum {
phase_unknown = -1, ///< Unknown phase
phase_init = 0, ///< Send client challenge
@@ -261,6 +150,4 @@ namespace eap
phase_finished, ///< Connection shut down
} m_phase; ///< What phase is our communication at?
};
/// @}
}

View File

@@ -86,60 +86,3 @@ eap::credentials* eap::config_method_mschapv2::make_credentials() const
{
return new credentials_pass(m_module);
}
//////////////////////////////////////////////////////////////////////
// eap::config_method_eapmschapv2
//////////////////////////////////////////////////////////////////////
eap::config_method_eapmschapv2::config_method_eapmschapv2(_In_ module &mod, _In_ unsigned int level) : config_method_mschapv2(mod, level)
{
}
eap::config_method_eapmschapv2::config_method_eapmschapv2(_In_ const config_method_eapmschapv2 &other) :
config_method_mschapv2(other)
{
}
eap::config_method_eapmschapv2::config_method_eapmschapv2(_Inout_ config_method_eapmschapv2 &&other) :
config_method_mschapv2(std::move(other))
{
}
eap::config_method_eapmschapv2& eap::config_method_eapmschapv2::operator=(_In_ const config_method_eapmschapv2 &other)
{
if (this != &other)
(config_method_mschapv2&)*this = other;
return *this;
}
eap::config_method_eapmschapv2& eap::config_method_eapmschapv2::operator=(_Inout_ config_method_eapmschapv2 &&other)
{
if (this != &other)
(config_method_mschapv2&&)*this = std::move(other);
return *this;
}
eap::config* eap::config_method_eapmschapv2::clone() const
{
return new config_method_eapmschapv2(*this);
}
eap_type_t eap::config_method_eapmschapv2::get_method_id() const
{
return eap_type_mschapv2;
}
const wchar_t* eap::config_method_eapmschapv2::get_method_str() const
{
return L"EAP-MSCHAPv2";
}

View File

@@ -99,15 +99,15 @@ eap::challenge_hash::challenge_hash()
eap::challenge_hash::challenge_hash(
_In_ HCRYPTPROV cp,
_In_ const sanitizing_blob &challenge_server,
_In_ const challenge_mschapv2 &challenge_server,
_In_ const challenge_mschapv2 &challenge_client,
_In_z_ const char *username)
{
crypt_hash hash;
if (!hash.create(cp, CALG_SHA))
throw win_runtime_error(__FUNCTION__ " Creating SHA hash failed.");
if (!CryptHashData(hash, (const BYTE*)&challenge_client , (DWORD)sizeof(challenge_client), 0) ||
!CryptHashData(hash, challenge_server.data(), (DWORD)challenge_server.size() , 0) ||
if (!CryptHashData(hash, (const BYTE*)&challenge_client, (DWORD)sizeof(challenge_client), 0) ||
!CryptHashData(hash, (const BYTE*)&challenge_server, (DWORD)sizeof(challenge_server), 0) ||
!CryptHashData(hash, (const BYTE*)username , (DWORD)strlen(username) , 0))
throw win_runtime_error(__FUNCTION__ " Error hashing data.");
unsigned char hash_val[20];
@@ -201,7 +201,7 @@ eap::nt_response::nt_response()
eap::nt_response::nt_response(
_In_ HCRYPTPROV cp,
_In_ const sanitizing_blob &challenge_server,
_In_ const challenge_mschapv2 &challenge_server,
_In_ const challenge_mschapv2 &challenge_client,
_In_z_ const char *username,
_In_z_ const wchar_t *password)
@@ -270,7 +270,7 @@ eap::authenticator_response::authenticator_response()
eap::authenticator_response::authenticator_response(
_In_ HCRYPTPROV cp,
_In_ const sanitizing_blob &challenge_server,
_In_ const challenge_mschapv2 &challenge_server,
_In_ const challenge_mschapv2 &challenge_client,
_In_z_ const char *username,
_In_z_ const wchar_t *password,

View File

@@ -25,365 +25,98 @@ using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::method_mschapv2_base
// eap::method_mschapv2
//////////////////////////////////////////////////////////////////////
eap::method_mschapv2_base::method_mschapv2_base(_In_ module &mod, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred) :
m_cfg(cfg),
eap::method_mschapv2::method_mschapv2(_In_ module &module, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred) :
m_cred(cred),
m_ident(0),
method(mod)
m_success(false),
m_phase(phase_unknown),
method_noneap(module, cfg, cred)
{
}
eap::method_mschapv2_base::method_mschapv2_base(_Inout_ method_mschapv2_base &&other) :
m_cfg ( other.m_cfg ),
eap::method_mschapv2::method_mschapv2(_Inout_ method_mschapv2 &&other) :
m_cred ( other.m_cred ),
m_cp (std::move(other.m_cp )),
m_challenge_server(std::move(other.m_challenge_server)),
m_challenge_client(std::move(other.m_challenge_client)),
m_ident (std::move(other.m_ident )),
m_nt_resp (std::move(other.m_nt_resp )),
m_packet_res (std::move(other.m_packet_res )),
method (std::move(other ))
{
}
eap::method_mschapv2_base& eap::method_mschapv2_base::operator=(_Inout_ method_mschapv2_base &&other)
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move method within same credentials only!
(method&)*this = std::move(other );
m_cp = std::move(other.m_cp );
m_challenge_server = std::move(other.m_challenge_server);
m_challenge_client = std::move(other.m_challenge_client);
m_ident = std::move(other.m_ident );
m_nt_resp = std::move(other.m_nt_resp );
m_packet_res = std::move(other.m_packet_res );
}
return *this;
}
void eap::method_mschapv2_base::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize)
{
method::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
// Presume authentication will fail with generic protocol failure. (Pesimist!!!)
// We will reset once we get get_result(Success) call.
m_cfg.m_last_status = config_method::status_auth_failed;
m_cfg.m_last_msg.clear();
// Create cryptographics provider for support needs (client challenge ...).
if (!m_cp.create(NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
throw win_runtime_error(__FUNCTION__ " Error creating cryptographics provider.");
}
void eap::method_mschapv2_base::get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max)
{
if (m_packet_res.size() > 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).", m_packet_res.size(), size_max));
packet.assign(m_packet_res.begin(), m_packet_res.end());
}
void eap::method_mschapv2_base::get_result(
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult)
{
assert(pResult);
method::get_result(reason, pResult);
if (reason == EapPeerMethodResultSuccess)
m_cfg.m_last_status = config_method::status_success;
// Always ask EAP host to save the connection data. And it will save it *only* when we report "success".
// Don't worry. EapHost is well aware of failed authentication condition.
pResult->fSaveConnectionData = TRUE;
pResult->fIsSuccess = TRUE;
}
void eap::method_mschapv2_base::process_success(_In_ const list<string> &argv)
{
assert(m_cfg.m_last_status != config_method::status_success);
for (auto arg = argv.cbegin(), arg_end = argv.cend(); arg != arg_end; ++arg) {
const string &val = *arg;
if ((val[0] == 'S' || val[0] == 's') && val[1] == '=') {
// "S="
hex_dec dec;
sanitizing_blob resp;
bool is_last;
dec.decode(resp, is_last, val.data() + 2, (size_t)-1);
// Calculate expected authenticator response.
sanitizing_string identity_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity, identity_utf8, NULL, NULL);
authenticator_response resp_exp(m_cp, m_challenge_server, m_challenge_client, identity_utf8.c_str(), m_cred.m_password.c_str(), m_nt_resp);
// Compare against provided authemticator response.
if (resp.size() != sizeof(resp_exp) || memcmp(resp.data(), &resp_exp, sizeof(resp_exp)) != 0)
throw invalid_argument(__FUNCTION__ " MS-CHAP2-Success authentication response string failed.");
m_module.log_event(&EAPMETHOD_METHOD_SUCCESS, event_data((unsigned int)m_cfg.get_method_id()), event_data::blank);
m_cfg.m_last_status = config_method::status_success;
}
}
if (m_cfg.m_last_status != config_method::status_success)
throw invalid_argument(__FUNCTION__ " MS-CHAP2-Success authentication response string not found.");
}
void eap::method_mschapv2_base::process_error(_In_ const list<string> &argv)
{
for (auto arg = argv.cbegin(), arg_end = argv.cend(); arg != arg_end; ++arg) {
const string &val = *arg;
if ((val[0] == 'E' || val[0] == 'e') && val[1] == '=') {
DWORD dwResult = strtoul(val.data() + 2, NULL, 10);
m_module.log_event(&EAPMETHOD_METHOD_FAILURE_ERROR, event_data((unsigned int)m_cfg.get_method_id()), event_data(dwResult), event_data::blank);
switch (dwResult) {
case ERROR_ACCT_DISABLED : m_cfg.m_last_status = config_method::status_account_disabled ; break;
case ERROR_RESTRICTED_LOGON_HOURS: m_cfg.m_last_status = config_method::status_account_logon_hours; break;
case ERROR_NO_DIALIN_PERMISSION : m_cfg.m_last_status = config_method::status_account_denied ; break;
case ERROR_PASSWD_EXPIRED : m_cfg.m_last_status = config_method::status_cred_expired ; break;
case ERROR_CHANGING_PASSWORD : m_cfg.m_last_status = config_method::status_cred_changing ; break;
default : m_cfg.m_last_status = config_method::status_cred_invalid ;
}
} else if ((val[0] == 'C' || val[0] == 'c') && val[1] == '=') {
hex_dec dec;
bool is_last;
dec.decode(m_challenge_server, is_last, val.data() + 2, (size_t)-1);
} else if ((val[0] == 'M' || val[0] == 'm') && val[1] == '=') {
MultiByteToWideChar(CP_UTF8, 0, val.data() + 2, (int)val.length() - 2, m_cfg.m_last_msg);
m_module.log_event(&EAPMETHOD_METHOD_FAILURE_ERROR1, event_data((unsigned int)m_cfg.get_method_id()), event_data(m_cfg.m_last_msg), event_data::blank);
}
}
}
list<string> eap::method_mschapv2_base::parse_response(_In_count_(count) const char *resp, _In_ size_t count)
{
list<string> argv;
for (size_t i = 0; i < count && resp[i]; ) {
if (i + 1 < count && (resp[i] == 'M' || resp[i] == 'm') && resp[i + 1] == '=') {
// The message is always the last value. It may contain spaces and it spans to the end.
argv.push_back(string(resp + i, strnlen(resp + i, count - i)));
break;
} else if (!isspace(resp[i])) {
// Search for the next space and add value up to it.
size_t j;
for (j = i + 1; j < count && resp[j] && !isspace(resp[j]); j++);
argv.push_back(string(resp + i, j - i));
i = j + 1;
} else {
// Skip (multiple) spaces.
i++;
}
}
return argv;
}
//////////////////////////////////////////////////////////////////////
// eap::method_mschapv2
//////////////////////////////////////////////////////////////////////
eap::method_mschapv2::method_mschapv2(_In_ module &mod, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred) :
method_mschapv2_base(mod, cfg, cred)
{
}
eap::method_mschapv2::method_mschapv2(_Inout_ method_mschapv2 &&other) :
method_mschapv2_base(std::move(other ))
m_success (std::move(other.m_success )),
m_phase (std::move(other.m_phase )),
method_noneap (std::move(other ))
{
}
eap::method_mschapv2& eap::method_mschapv2::operator=(_Inout_ method_mschapv2 &&other)
{
if (this != std::addressof(other))
(method_mschapv2_base&)*this = std::move(other);
return *this;
}
EapPeerMethodResponseAction eap::method_mschapv2::process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize)
{
assert(pReceivedPacket || dwReceivedPacketSize == 0);
for (const unsigned char *pck = reinterpret_cast<const unsigned char*>(pReceivedPacket), *pck_end = pck + dwReceivedPacketSize; pck < pck_end; ) {
if (pck + sizeof(chap_header) > pck_end)
throw win_runtime_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, __FUNCTION__ " Incomplete CHAP header.");
auto hdr = reinterpret_cast<const chap_header*>(pck);
unsigned short length = ntohs(*reinterpret_cast<const unsigned short*>(hdr->length));
const unsigned char
*msg = reinterpret_cast<const unsigned char*>(hdr + 1),
*msg_end = pck + length;
if (msg_end > pck_end)
throw win_runtime_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, __FUNCTION__ " Incomplete CHAP data.");
// Save packet ident.
m_ident = hdr->ident;
switch (hdr->code) {
case chap_packet_code_challenge: {
m_module.log_event(&EAPMETHOD_METHOD_HANDSHAKE_START2, event_data((unsigned int)eap_type_mschapv2), event_data::blank);
if (msg + 1 > msg_end)
throw win_runtime_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, __FUNCTION__ " Incomplete CHAP challenge packet.");
// Read server challenge.
if (msg + 1 + msg[0] > msg_end)
throw win_runtime_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, __FUNCTION__ " Incomplete CHAP server challenge.");
m_challenge_server.assign(msg + 1, msg + 1 + msg[0]);
// Randomize Peer-Challenge.
m_challenge_client.randomize(m_cp);
// Calculate NT-Response.
sanitizing_string identity_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity, identity_utf8, NULL, NULL);
m_nt_resp = nt_response(m_cp, m_challenge_server, m_challenge_client, identity_utf8.c_str(), m_cred.m_password.c_str());
// Prepare CHAP response value.
sanitizing_blob value;
value.reserve(
sizeof(m_challenge_client) + // Peer-Challenge
8 + // Reserved
sizeof(m_nt_resp) + // NT-Response
1); // Flags
value.insert(value.end(), reinterpret_cast<const unsigned char*>(&m_challenge_client), reinterpret_cast<const unsigned char*>(&m_challenge_client + 1)); // Peer-Challenge
value.insert(value.end(), 8, 0); // Reserved (must be zero)
value.insert(value.end(), reinterpret_cast<const unsigned char*>(&m_nt_resp), reinterpret_cast<const unsigned char*>(&m_nt_resp + 1)); // NT-Response
value.push_back(0); // Flags
chap_header hdr_resp;
hdr_resp.code = chap_packet_code_response;
hdr_resp.ident = m_ident;
size_t size_value = value.size();
*reinterpret_cast<unsigned short*>(hdr_resp.length) = htons((unsigned short)(sizeof(chap_header) + 1 + size_value + identity_utf8.length()));
assert(size_value <= 0xff); // CHAP value can be 255B max
// Append response.
m_packet_res.assign(reinterpret_cast<const unsigned char*>(&hdr_resp), reinterpret_cast<const unsigned char*>(&hdr_resp + 1));
m_packet_res.insert(m_packet_res.end(), 1, (unsigned char)size_value);
m_packet_res.insert(m_packet_res.end(), value.begin(), value.end());
m_packet_res.insert(m_packet_res.end(), identity_utf8.begin(), identity_utf8.end());
m_cfg.m_last_status = config_method::status_cred_invalid; // Blame credentials if we fail beyond this point.
return EapPeerMethodResponseActionSend;
}
case chap_packet_code_success:
process_success(parse_response(reinterpret_cast<const char*>(msg), reinterpret_cast<const char*>(msg_end) - reinterpret_cast<const char*>(msg)));
if (m_cfg.m_last_status == config_method::status_success) {
// Acknowledge the authentication by sending a "3" (chap_packet_code_success).
m_packet_res.assign(1, chap_packet_code_success);
m_cfg.m_last_status = config_method::status_auth_failed; // Blame protocol if we fail beyond this point.
return EapPeerMethodResponseActionSend;
} else
return EapPeerMethodResponseActionDiscard;
case chap_packet_code_failure:
process_error(parse_response(reinterpret_cast<const char*>(msg), reinterpret_cast<const char*>(msg_end) - reinterpret_cast<const char*>(msg)));
return EapPeerMethodResponseActionDiscard;
}
pck = msg_end;
}
return EapPeerMethodResponseActionNone;
}
//////////////////////////////////////////////////////////////////////
// eap::method_mschapv2_diameter
//////////////////////////////////////////////////////////////////////
eap::method_mschapv2_diameter::method_mschapv2_diameter(_In_ module &mod, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred) :
m_phase(phase_unknown),
method_mschapv2_base(mod, cfg, cred)
{
}
eap::method_mschapv2_diameter::method_mschapv2_diameter(_Inout_ method_mschapv2_diameter &&other) :
m_phase (std::move(other.m_phase)),
method_mschapv2_base(std::move(other ))
{
}
eap::method_mschapv2_diameter& eap::method_mschapv2_diameter::operator=(_Inout_ method_mschapv2_diameter &&other)
{
if (this != std::addressof(other)) {
(method_mschapv2_base&)*this = std::move(other );
m_phase = std::move(other.m_phase);
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move method with same credentials only!
(method_noneap&)*this = std::move(other );
m_cp = std::move(other.m_cp );
m_challenge_server = std::move(other.m_challenge_server);
m_challenge_client = std::move(other.m_challenge_client);
m_ident = std::move(other.m_ident );
m_nt_resp = std::move(other.m_nt_resp );
m_success = std::move(other.m_success );
m_phase = std::move(other.m_phase );
}
return *this;
}
void eap::method_mschapv2_diameter::begin_session(
void eap::method_mschapv2::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize)
{
method_mschapv2_base::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
method_noneap::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
// Create cryptographics provider for support needs (client challenge ...).
if (!m_cp.create(NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
throw win_runtime_error(__FUNCTION__ " Error creating cryptographics provider.");
m_module.log_event(&EAPMETHOD_METHOD_HANDSHAKE_START2, event_data((unsigned int)eap_type_legacy_mschapv2), event_data::blank);
m_phase = phase_init;
}
EapPeerMethodResponseAction eap::method_mschapv2_diameter::process_request_packet(
void eap::method_mschapv2::process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize)
_In_ DWORD dwReceivedPacketSize,
_Out_ EapPeerMethodOutput *pEapOutput)
{
assert(pReceivedPacket || dwReceivedPacketSize == 0);
assert(pEapOutput);
m_module.log_event(&EAPMETHOD_PACKET_RECV, event_data((unsigned int)eap_type_legacy_mschapv2), event_data((unsigned int)dwReceivedPacketSize), event_data::blank);
switch (m_phase) {
case phase_init: {
m_module.log_event(&EAPMETHOD_METHOD_HANDSHAKE_START2, event_data((unsigned int)eap_type_legacy_mschapv2), event_data::blank);
// Randomize Peer-Challenge.
m_challenge_client.randomize(m_cp);
// Calculate NT-Response.
// Convert username to UTF-8.
sanitizing_string identity_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity, identity_utf8, NULL, NULL);
// Randomize Peer-Challenge
m_challenge_client.randomize(m_cp);
// Calculate NT-Response
m_nt_resp = nt_response(m_cp, m_challenge_server, m_challenge_client, identity_utf8.c_str(), m_cred.m_password.c_str());
// Prepare MS-CHAP2-Response.
// Prepare MS-CHAP2-Response
sanitizing_blob response;
response.reserve(
1 + // Ident
1 + // Flags
sizeof(m_challenge_client) + // Peer-Challenge
sizeof(challenge_mschapv2) + // Peer-Challenge
8 + // Reserved
sizeof(m_nt_resp)); // NT-Response
sizeof(nt_response)); // Response
response.push_back(m_ident);
response.push_back(0); // Flags
response.insert(response.end(), reinterpret_cast<const unsigned char*>(&m_challenge_client), reinterpret_cast<const unsigned char*>(&m_challenge_client + 1)); // Peer-Challenge
@@ -391,39 +124,32 @@ EapPeerMethodResponseAction eap::method_mschapv2_diameter::process_request_packe
response.insert(response.end(), reinterpret_cast<const unsigned char*>(&m_nt_resp), reinterpret_cast<const unsigned char*>(&m_nt_resp + 1)); // NT-Response
// Diameter AVP (User-Name=1, MS-CHAP-Challenge=11/311, MS-CHAP2-Response=25/311)
m_packet_res.clear();
diameter_avp_append( 1, diameter_avp_flag_mandatory, identity_utf8 .data(), (unsigned int)identity_utf8 .size(), m_packet_res);
diameter_avp_append(11, 311, diameter_avp_flag_mandatory, m_challenge_server.data(), (unsigned int)m_challenge_server.size(), m_packet_res);
diameter_avp_append(25, 311, diameter_avp_flag_mandatory, response .data(), (unsigned int)response .size(), m_packet_res);
append_avp( 1, diameter_avp_flag_mandatory, identity_utf8.data(), (unsigned int)identity_utf8.size() );
append_avp(11, 311, diameter_avp_flag_mandatory, reinterpret_cast<const unsigned char*>(&m_challenge_server) , (unsigned int)sizeof(m_challenge_server));
append_avp(25, 311, diameter_avp_flag_mandatory, response.data() , (unsigned int)response.size() );
m_phase = phase_challenge_server;
m_cfg.m_last_status = config_method::status_cred_invalid; // Blame credentials if we fail beyond this point.
return EapPeerMethodResponseActionSend;
break;
}
case phase_challenge_server: {
process_packet(pReceivedPacket, dwReceivedPacketSize);
if (m_cfg.m_last_status == config_method::status_success) {
if (m_success)
m_phase = phase_finished;
// Acknowledge the authentication by sending an empty response packet.
m_packet_res.clear();
m_cfg.m_last_status = config_method::status_auth_failed; // Blame protocol if we fail beyond this point.
return EapPeerMethodResponseActionSend;
} else
return EapPeerMethodResponseActionDiscard;
break;
}
case phase_finished:
return EapPeerMethodResponseActionNone;
default:
throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase));
break;
}
pEapOutput->fAllowNotifications = TRUE;
pEapOutput->action = EapPeerMethodResponseActionSend;
}
void eap::method_mschapv2_diameter::process_packet(_In_bytecount_(size_pck) const void *_pck, _In_ size_t size_pck)
void eap::method_mschapv2::process_packet(_In_bytecount_(size_pck) const void *_pck, _In_ size_t size_pck)
{
for (const unsigned char *pck = reinterpret_cast<const unsigned char*>(_pck), *pck_end = pck + size_pck; pck < pck_end; ) {
if (pck + sizeof(diameter_avp_header) > pck_end)
@@ -466,3 +192,90 @@ void eap::method_mschapv2_diameter::process_packet(_In_bytecount_(size_pck) cons
pck = msg_next;
}
}
void eap::method_mschapv2::process_success(_In_ const list<string> &argv)
{
m_success = false;
for (auto arg = argv.cbegin(), arg_end = argv.cend(); arg != arg_end; ++arg) {
const string &val = *arg;
if ((val[0] == 'S' || val[0] == 's') && val[1] == '=') {
// "S="
hex_dec dec;
sanitizing_blob resp;
bool is_last;
dec.decode(resp, is_last, val.data() + 2, (size_t)-1);
// Calculate expected authenticator response.
sanitizing_string identity_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity, identity_utf8, NULL, NULL);
authenticator_response resp_exp(m_cp, m_challenge_server, m_challenge_client, identity_utf8.c_str(), m_cred.m_password.c_str(), m_nt_resp);
// Compare against provided authemticator response.
if (resp.size() != sizeof(resp_exp) || memcmp(resp.data(), &resp_exp, sizeof(resp_exp)) != 0)
throw invalid_argument(__FUNCTION__ " MS-CHAP2-Success authentication response string failed.");
m_success = true;
}
}
if (!m_success)
throw invalid_argument(__FUNCTION__ " MS-CHAP2-Success authentication response string not found.");
}
void eap::method_mschapv2::process_error(_In_ const list<string> &argv)
{
for (auto arg = argv.cbegin(), arg_end = argv.cend(); arg != arg_end; ++arg) {
const string &val = *arg;
if ((val[0] == 'E' || val[0] == 'e') && val[1] == '=') {
DWORD dwResult = strtoul(val.data() + 2, NULL, 10);
m_module.log_event(&EAPMETHOD_METHOD_FAILURE_ERROR, event_data((unsigned int)eap_type_legacy_mschapv2), event_data(dwResult), event_data::blank);
switch (dwResult) {
case ERROR_ACCT_DISABLED : m_cfg.m_last_status = config_method::status_account_disabled ; break;
case ERROR_RESTRICTED_LOGON_HOURS: m_cfg.m_last_status = config_method::status_account_logon_hours; break;
case ERROR_NO_DIALIN_PERMISSION : m_cfg.m_last_status = config_method::status_account_denied ; break;
case ERROR_PASSWD_EXPIRED : m_cfg.m_last_status = config_method::status_cred_expired ; break;
case ERROR_CHANGING_PASSWORD : m_cfg.m_last_status = config_method::status_cred_changing ; break;
default : m_cfg.m_last_status = config_method::status_cred_invalid ;
}
} else if ((val[0] == 'C' || val[0] == 'c') && val[1] == '=') {
hex_dec dec;
sanitizing_blob resp;
bool is_last;
dec.decode(resp, is_last, val.data() + 2, (size_t)-1);
if (resp.size() != sizeof(m_challenge_server))
throw invalid_argument(string_printf(__FUNCTION__ " Incorrect MSCHAPv2 challenge length (expected: %uB, received: %uB).", sizeof(m_challenge_server), resp.size()));
memcpy(&m_challenge_server, resp.data(), sizeof(m_challenge_server));
} else if ((val[0] == 'M' || val[0] == 'm') && val[1] == '=') {
MultiByteToWideChar(CP_UTF8, 0, val.data() + 2, (int)val.length() - 2, m_cfg.m_last_msg);
m_module.log_event(&EAPMETHOD_METHOD_FAILURE_ERROR1, event_data((unsigned int)eap_type_legacy_mschapv2), event_data(m_cfg.m_last_msg), event_data::blank);
}
}
}
list<string> eap::method_mschapv2::parse_response(_In_count_(count) const char *resp, _In_ size_t count)
{
list<string> argv;
for (size_t i = 0; i < count && resp[i]; ) {
if (i + 1 < count && (resp[i] == 'M' || resp[i] == 'm') && resp[i + 1] == '=') {
// The message is always the last value. It may contain spaces and it spans to the end.
argv.push_back(string(resp + i, strnlen(resp + i, count - i)));
break;
} else if (!isspace(resp[i])) {
// Search for the next space and add value up to it.
size_t j;
for (j = i + 1; j < count && resp[j] && !isspace(resp[j]); j++);
argv.push_back(string(resp + i, j - i));
i = j + 1;
} else {
// Skip (multiple) spaces.
i++;
}
}
return argv;
}

View File

@@ -21,11 +21,6 @@
#include "../../EAPBase_UI/include/EAP_UI.h"
#include "../../MSCHAPv2/include/Config.h"
class wxMSCHAPv2ConfigPanel;
/// \addtogroup EAPBaseGUI
/// @{
///
/// MSCHAPv2 credential entry panel
///
@@ -36,7 +31,10 @@ typedef wxPasswordCredentialsPanel<eap::credentials_pass, wxPasswordCredentialsP
///
typedef wxEAPCredentialsConfigPanel<eap::credentials_pass, wxMSCHAPv2CredentialsPanel> wxMSCHAPv2CredentialsConfigPanel;
/// @}
///
/// MSCHAPv2 configuration panel
///
class wxMSCHAPv2ConfigPanel;
#pragma once
@@ -46,12 +44,6 @@ typedef wxEAPCredentialsConfigPanel<eap::credentials_pass, wxMSCHAPv2Credentials
#include <Windows.h>
/// \addtogroup EAPBaseGUI
/// @{
///
/// MSCHAPv2 configuration panel
///
class wxMSCHAPv2ConfigPanel : public wxPanel
{
public:
@@ -73,5 +65,3 @@ protected:
protected:
wxMSCHAPv2CredentialsConfigPanel *m_credentials; ///< Credentials configuration panel
};
/// @}

View File

@@ -48,11 +48,9 @@ wxMSCHAPv2ConfigPanel::~wxMSCHAPv2ConfigPanel()
}
/// \cond internal
void wxMSCHAPv2ConfigPanel::OnInitDialog(wxInitDialogEvent& event)
{
// Forward the event to child panels.
if (m_credentials)
m_credentials->GetEventHandler()->ProcessEvent(event);
}
/// \endcond

View File

@@ -22,6 +22,9 @@
namespace eap
{
///
/// PAP configuration
///
class config_method_pap;
}
@@ -85,26 +88,28 @@ namespace eap
///
config_method_pap& operator=(_Inout_ config_method_pap &&other);
///
/// Clones configuration
///
/// \returns Pointer to cloned configuration
///
virtual config* clone() const;
///
/// @copydoc eap::config_method::get_method_id()
/// \returns This implementation always returns `winstd::eap_type_legacy_pap`
/// Returns EAP method type of this configuration
///
/// \returns `eap::type_pap`
///
virtual winstd::eap_type_t get_method_id() const;
///
/// @copydoc eap::config_method::get_method_str()
/// \returns This implementation always returns `L"PAP"`
/// Returns a string \c L"PAP"
///
virtual const wchar_t* get_method_str() const;
///
/// @copydoc eap::config_method::make_credentials()
/// \returns This implementation always returns `eap::credentials_pass` type of credentials
/// Creates a blank set of credentials suitable for this method
///
virtual credentials* make_credentials() const;
};
/// @}
}

View File

@@ -20,7 +20,10 @@
namespace eap
{
class method_pap_diameter;
///
/// PAP method
///
class method_pap;
}
@@ -33,85 +36,69 @@ namespace eap
namespace eap
{
/// \addtogroup EAPBaseMethod
/// @{
///
/// PAP method over Diameter AVP (for use as inner EAP-TTLS)
///
class method_pap_diameter : public method
class method_pap : public method_noneap
{
WINSTD_NONCOPYABLE(method_pap_diameter)
WINSTD_NONCOPYABLE(method_pap)
public:
///
/// Constructs a PAP method
/// Constructs an EAP method
///
/// \param[in] mod PAP module to use for global services
/// \param[in] mod EAP module to use for global services
/// \param[in] cfg Method configuration
/// \param[in] cred User credentials
///
method_pap_diameter(_In_ module &mod, _In_ config_method_pap &cfg, _In_ credentials_pass &cred);
method_pap(_In_ module &module, _In_ config_method_pap &cfg, _In_ credentials_pass &cred);
///
/// Moves a PAP method
/// Moves an EAP method
///
/// \param[in] other PAP method to move from
/// \param[in] other EAP method to move from
///
method_pap_diameter(_Inout_ method_pap_diameter &&other);
method_pap(_Inout_ method_pap &&other);
///
/// Moves a PAP method
/// Moves an EAP method
///
/// \param[in] other PAP method to move from
/// \param[in] other EAP method to move from
///
/// \returns Reference to this object
///
method_pap_diameter& operator=(_Inout_ method_pap_diameter &&other);
method_pap& operator=(_Inout_ method_pap &&other);
/// \name Session management
/// \name Packet processing
/// @{
///
/// Starts an EAP authentication session on the peer EapHost using the EAP method.
///
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
///
virtual void begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize = MAXDWORD);
/// @}
/// \name Packet processing
/// @{
virtual EapPeerMethodResponseAction process_request_packet(
///
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///
virtual void process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize);
virtual void get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max = MAXDWORD);
_In_ DWORD dwReceivedPacketSize,
_Out_ EapPeerMethodOutput *pEapOutput);
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
protected:
config_method_pap &m_cfg; ///< Method configuration
credentials_pass &m_cred; ///< Method user credentials
///
/// Communication phase
///
enum {
phase_unknown = -1, ///< Unknown phase
phase_init = 0, ///< Handshake initialize
phase_finished, ///< Connection shut down
} m_phase; ///< What phase is our communication at?
sanitizing_blob m_packet_res; ///< Response packet
};
/// @}
}

View File

@@ -25,70 +25,63 @@ using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::method_pap_diameter
// eap::method_pap
//////////////////////////////////////////////////////////////////////
eap::method_pap_diameter::method_pap_diameter(_In_ module &mod, _In_ config_method_pap &cfg, _In_ credentials_pass &cred) :
m_cfg(cfg),
eap::method_pap::method_pap(_In_ module &module, _In_ config_method_pap &cfg, _In_ credentials_pass &cred) :
m_cred(cred),
m_phase(phase_unknown),
method(mod)
method_noneap(module, cfg, cred)
{
}
eap::method_pap_diameter::method_pap_diameter(_Inout_ method_pap_diameter &&other) :
m_cfg ( other.m_cfg ),
eap::method_pap::method_pap(_Inout_ method_pap &&other) :
m_cred ( other.m_cred ),
m_phase (std::move(other.m_phase )),
m_packet_res(std::move(other.m_packet_res)),
method (std::move(other ))
method_noneap(std::move(other ))
{
}
eap::method_pap_diameter& eap::method_pap_diameter::operator=(_Inout_ method_pap_diameter &&other)
eap::method_pap& eap::method_pap::operator=(_Inout_ method_pap &&other)
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move method within same credentials only!
(method&)*this = std::move(other );
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move method with same credentials only!
(method_noneap&)*this = std::move(other );
m_phase = std::move(other.m_phase );
m_packet_res = std::move(other.m_packet_res);
}
return *this;
}
void eap::method_pap_diameter::begin_session(
void eap::method_pap::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ DWORD dwMaxSendPacketSize)
{
method::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
// Presume authentication will fail with generic protocol failure. (Pesimist!!!)
// We will reset once we get get_result(Success) call.
m_cfg.m_last_status = config_method::status_auth_failed;
m_cfg.m_last_msg.clear();
method_noneap::begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize);
m_module.log_event(&EAPMETHOD_METHOD_HANDSHAKE_START2, event_data((unsigned int)eap_type_legacy_pap), event_data::blank);
m_phase = phase_init;
}
EapPeerMethodResponseAction eap::method_pap_diameter::process_request_packet(
void eap::method_pap::process_request_packet(
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
_In_ DWORD dwReceivedPacketSize)
_In_ DWORD dwReceivedPacketSize,
_Out_ EapPeerMethodOutput *pEapOutput)
{
UNREFERENCED_PARAMETER(pReceivedPacket);
UNREFERENCED_PARAMETER(dwReceivedPacketSize);
assert(pReceivedPacket || dwReceivedPacketSize == 0);
assert(pEapOutput);
m_module.log_event(&EAPMETHOD_PACKET_RECV, event_data((unsigned int)eap_type_legacy_pap), event_data((unsigned int)dwReceivedPacketSize), event_data::blank);
switch (m_phase) {
case phase_init: {
m_module.log_event(&EAPMETHOD_METHOD_HANDSHAKE_START2, event_data((unsigned int)eap_type_legacy_pap), event_data::blank);
// Convert username and password to UTF-8.
sanitizing_string identity_utf8, password_utf8;
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity, identity_utf8, NULL, NULL);
@@ -98,49 +91,21 @@ EapPeerMethodResponseAction eap::method_pap_diameter::process_request_packet(
size_t padding_password_ex = (16 - password_utf8.length()) % 16;
password_utf8.append(padding_password_ex, 0);
// Diameter AVP (User-Name=1, User-Password=2)
m_packet_res.clear();
diameter_avp_append(1, diameter_avp_flag_mandatory, identity_utf8.data(), (unsigned int)identity_utf8.size(), m_packet_res);
diameter_avp_append(2, diameter_avp_flag_mandatory, password_utf8.data(), (unsigned int)password_utf8.size(), m_packet_res);
// Diameter AVP (User-Name=1, User-Password=2)
append_avp(1, diameter_avp_flag_mandatory, identity_utf8.data(), (unsigned int)identity_utf8.size());
append_avp(2, diameter_avp_flag_mandatory, password_utf8.data(), (unsigned int)password_utf8.size());
m_phase = phase_finished;
m_cfg.m_last_status = config_method::status_cred_invalid; // Blame credentials if we fail beyond this point.
return EapPeerMethodResponseActionSend;
break;
}
case phase_finished:
return EapPeerMethodResponseActionNone;
default:
throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase));
break;
}
}
void eap::method_pap_diameter::get_response_packet(
_Out_ sanitizing_blob &packet,
_In_opt_ DWORD size_max)
{
if (m_packet_res.size() > 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).", m_packet_res.size(), size_max));
packet.assign(m_packet_res.begin(), m_packet_res.end());
}
void eap::method_pap_diameter::get_result(
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult)
{
assert(pResult);
method::get_result(reason, pResult);
if (reason == EapPeerMethodResultSuccess)
m_cfg.m_last_status = config_method::status_success;
// Always ask EAP host to save the connection data. And it will save it *only* when we report "success".
// Don't worry. EapHost is well aware of failed authentication condition.
pResult->fSaveConnectionData = TRUE;
pResult->fIsSuccess = TRUE;
pEapOutput->fAllowNotifications = TRUE;
pEapOutput->action = EapPeerMethodResponseActionSend;
}

View File

@@ -21,11 +21,6 @@
#include "../../EAPBase_UI/include/EAP_UI.h"
#include "../../PAP/include/Config.h"
class wxPAPConfigPanel;
/// \addtogroup EAPBaseGUI
/// @{
///
/// PAP credential entry panel
///
@@ -36,7 +31,10 @@ typedef wxPasswordCredentialsPanel<eap::credentials_pass, wxPasswordCredentialsP
///
typedef wxEAPCredentialsConfigPanel<eap::credentials_pass, wxPAPCredentialsPanel> wxPAPCredentialsConfigPanel;
/// @}
///
/// PAP configuration panel
///
class wxPAPConfigPanel;
#pragma once
@@ -46,12 +44,6 @@ typedef wxEAPCredentialsConfigPanel<eap::credentials_pass, wxPAPCredentialsPanel
#include <Windows.h>
/// \addtogroup EAPBaseGUI
/// @{
///
/// PAP configuration panel
///
class wxPAPConfigPanel : public wxPanel
{
public:
@@ -73,5 +65,3 @@ protected:
protected:
wxPAPCredentialsConfigPanel *m_credentials; ///< Credentials configuration panel
};
/// @}

Some files were not shown because too many files have changed in this diff Show More