EapHost support in invoke_interactive_ui() added

This commit is contained in:
Simon Rozman 2017-02-02 11:36:12 +01:00
parent 260b78025c
commit 6284b6c29e

View File

@ -413,6 +413,11 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", cred.get_id().c_str()));
}
#ifdef EAP_INNER_EAPHOST
auto cfg_inner_eaphost = dynamic_cast<config_method_eaphost*>(cfg_method->m_inner.get());
if (!cfg_inner_eaphost)
#endif
{
int result;
{
// Initialize application.
@ -456,6 +461,35 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
if (result != wxID_OK)
throw win_runtime_error(ERROR_CANCELLED, __FUNCTION__ " Cancelled.");
}
#ifdef EAP_INNER_EAPHOST
else {
// EapHost inner method
DWORD dwSizeofDataFromInteractiveUI;
BYTE *pDataFromInteractiveUI;
winstd::eap_error error;
DWORD dwResult = EapHostPeerInvokeInteractiveUI(
hwndParent,
(DWORD)ctx.m_data.size(),
ctx.m_data.data(),
&dwSizeofDataFromInteractiveUI,
&pDataFromInteractiveUI,
&error._Myptr);
if (dwResult == ERROR_SUCCESS) {
// Inner EAP method provided response.
ctx.m_data.assign(pDataFromInteractiveUI, pDataFromInteractiveUI + dwSizeofDataFromInteractiveUI);
} else if (dwResult == ERROR_CANCELLED) {
// Not really an error.
throw win_runtime_error(ERROR_CANCELLED, __FUNCTION__ " Cancelled.");
} else if (error) {
wxLogError(_("Invoking EAP interactive UI failed (error %u, %s, %s)."), error->dwWinError, error->pRootCauseString, error->pRepairString);
throw eap_runtime_error(*error , __FUNCTION__ " EapHostPeerInvokeInteractiveUI failed.");
} else {
wxLogError(_("Invoking EAP interactive UI failed (error %u)."), dwResult);
throw win_runtime_error(dwResult, __FUNCTION__ " EapHostPeerInvokeInteractiveUI failed.");
}
}
#endif
// Pack output data.
pack(ctx.m_data, ppDataFromInteractiveUI, pdwDataFromInteractiveUISize);