eap::session::get_response_packet() implemented

This commit is contained in:
Simon Rozman 2016-08-04 10:07:03 +02:00
parent caf0352833
commit 22a87bf90d
5 changed files with 21 additions and 30 deletions

View File

@ -23,6 +23,7 @@
using namespace std; using namespace std;
using namespace winstd; using namespace winstd;
#pragma comment(lib, "Ws2_32.lib")
#if EAPMETHOD_TYPE==21 #if EAPMETHOD_TYPE==21
#define _EAPMETHOD_PEER eap::peer_ttls #define _EAPMETHOD_PEER eap::peer_ttls

View File

@ -30,6 +30,8 @@ namespace eap
#include "Module.h" #include "Module.h"
#include <WinStd/EAP.h>
#include <Windows.h> #include <Windows.h>
#include <eaptypes.h> // Must include after <Windows.h> #include <eaptypes.h> // Must include after <Windows.h>
extern "C" { extern "C" {
@ -235,7 +237,22 @@ namespace eap
virtual bool get_response_packet( virtual bool get_response_packet(
_Inout_ DWORD *pdwSendPacketSize, _Inout_ DWORD *pdwSendPacketSize,
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket, _Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
_Out_ EAP_ERROR **ppEapError) = 0; _Out_ EAP_ERROR **ppEapError)
{
assert(pdwSendPacketSize);
assert(pSendPacket);
assert(ppEapError);
WORD size = m_packet.size();
if (size > *pdwSendPacketSize) {
*ppEapError = m_module.make_error(ERROR_INSUFFICIENT_BUFFER, winstd::string_printf(_T(__FUNCTION__) _T(" Packet buffer is too small (%uB required, %uB provided)."), m_packet.size(), *pdwSendPacketSize).c_str());
return false;
}
memcpy(pSendPacket, (const EapPacket*)m_packet, size);
*pdwSendPacketSize = size;
return true;
}
/// ///
@ -352,6 +369,7 @@ namespace eap
module &m_module; ///< Reference of the EAP module module &m_module; ///< Reference of the EAP module
config_providers m_cfg; ///< Session configuration config_providers m_cfg; ///< Session configuration
credentials_type m_cred; ///< User credentials credentials_type m_cred; ///< User credentials
winstd::eap_packet m_packet; ///< Response packet
interactive_request_type m_intreq; ///< Interactive UI request data interactive_request_type m_intreq; ///< Interactive UI request data
DWORD m_eap_flags; ///< A combination of EAP flags that describe the new EAP authentication session behavior DWORD m_eap_flags; ///< A combination of EAP flags that describe the new EAP authentication session behavior
HANDLE m_token; ///< Specifies a handle to the user impersonation token to use in this session HANDLE m_token; ///< Specifies a handle to the user impersonation token to use in this session

View File

@ -93,20 +93,6 @@ namespace eap
_Out_ EapPeerMethodOutput *pEapOutput, _Out_ EapPeerMethodOutput *pEapOutput,
_Out_ EAP_ERROR **ppEapError); _Out_ EAP_ERROR **ppEapError);
///
/// Obtains a response packet from the EAP method.
///
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
///
/// \returns
/// - \c true if succeeded
/// - \c false otherwise. See \p ppEapError for details.
///
virtual bool get_response_packet(
_Inout_ DWORD *pdwSendPacketSize,
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
_Out_ EAP_ERROR **ppEapError);
/// ///
/// Obtains the result of an authentication session from the EAP method. /// Obtains the result of an authentication session from the EAP method.
/// ///

View File

@ -79,20 +79,6 @@ bool eap::session_ttls::process_request_packet(
} }
bool eap::session_ttls::get_response_packet(
_Inout_ DWORD *pdwSendPacketSize,
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
_Out_ EAP_ERROR **ppEapError)
{
UNREFERENCED_PARAMETER(pdwSendPacketSize);
UNREFERENCED_PARAMETER(pSendPacket);
assert(ppEapError);
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
return false;
}
bool eap::session_ttls::get_result( bool eap::session_ttls::get_result(
_In_ EapPeerMethodResultReason reason, _In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *ppResult, _Out_ EapPeerMethodResult *ppResult,

@ -1 +1 @@
Subproject commit b1f5846d8c364eb6982b119786ee2c1f3a0c8740 Subproject commit 431c7d99603d0457d586d7d722e3cad27ff42dd4