Sessions are actually methods now
This commit is contained in:
parent
97d0f75f8d
commit
faadb712fc
@ -24,11 +24,6 @@ namespace eap
|
||||
/// EAP method base class
|
||||
///
|
||||
class method;
|
||||
|
||||
///
|
||||
/// EAP session
|
||||
///
|
||||
template <class _Tcred, class _Tint, class _Tintres> class session;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
@ -131,311 +126,4 @@ namespace eap
|
||||
config_method &m_cfg; ///< Method configuration
|
||||
credentials &m_cred; ///< User credentials
|
||||
};
|
||||
|
||||
|
||||
template <class _Tcred, class _Tint, class _Tintres>
|
||||
class session
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Credentials data type
|
||||
///
|
||||
typedef _Tcred credentials_type;
|
||||
|
||||
///
|
||||
/// Interactive request data type
|
||||
///
|
||||
typedef _Tint interactive_request_type;
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a session
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
session(_In_ module &mod) :
|
||||
m_module(mod),
|
||||
m_cfg(mod),
|
||||
m_cred(mod),
|
||||
m_eap_flags(0),
|
||||
m_token(NULL),
|
||||
m_send_packet_size_max((DWORD)-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Copies session
|
||||
///
|
||||
/// \param[in] other Session to copy from
|
||||
///
|
||||
session(_In_ const session &other) :
|
||||
m_module(other.m_module),
|
||||
m_cfg(other.m_cfg),
|
||||
m_cred(other.m_cred),
|
||||
m_eap_flags(other.m_eap_flags),
|
||||
m_token(other.m_token),
|
||||
m_send_packet_size_max(other.m_send_packet_size_max)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Moves session
|
||||
///
|
||||
/// \param[in] other Session to move from
|
||||
///
|
||||
session(_Inout_ session &&other) :
|
||||
m_module(other.m_module),
|
||||
m_cfg(std::move(other.m_cfg)),
|
||||
m_cred(std::move(other.m_cred)),
|
||||
m_eap_flags(std::move(other.m_eap_flags)),
|
||||
m_token(std::move(other.m_token)),
|
||||
m_send_packet_size_max(std::move(other.m_send_packet_size_max))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Copies session
|
||||
///
|
||||
/// \param[in] other Session to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
session& operator=(_In_ const session &other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(std::addressof(m_module) ==std::addressof(other.m_module)); // Copy session within same module only!
|
||||
m_cfg = other.m_cfg;
|
||||
m_cred = other.m_cred;
|
||||
m_eap_flags = other.m_eap_flags;
|
||||
m_token = other.m_token;
|
||||
m_send_packet_size_max = other.m_send_packet_size_max;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Moves session
|
||||
///
|
||||
/// \param[in] other Session to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
session& operator=(_Inout_ session &&other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(std::addressof(m_module) ==std::addressof(other.m_module)); // Move session within same module only!
|
||||
m_cfg = std::move(other.m_cfg);
|
||||
m_cred = std::move(other.m_cred);
|
||||
m_eap_flags = std::move(other.m_eap_flags);
|
||||
m_token = std::move(other.m_token);
|
||||
m_send_packet_size_max = std::move(other.m_send_packet_size_max);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/// \name Session start/end
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool begin(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
_In_ HANDLE hTokenImpersonateUser,
|
||||
_In_ DWORD dwMaxSendPacketSize,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pAttributeArray);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
// Save session parameters.
|
||||
m_eap_flags = dwFlags;
|
||||
m_token = hTokenImpersonateUser;
|
||||
m_send_packet_size_max = dwMaxSendPacketSize;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Ends an EAP authentication session for the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerEndSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363604.aspx)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool end(_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
/// \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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool process_request_packet(
|
||||
_In_ DWORD dwReceivedPacketSize,
|
||||
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
|
||||
_Out_ EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
|
||||
///
|
||||
/// 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) = 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_result(
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Out_ EapPeerMethodResult *ppResult,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name UI 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_ui_context(
|
||||
_Out_ BYTE **ppUIContextData,
|
||||
_Out_ DWORD *pdwUIContextDataSize,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
return m_module.pack(m_intreq, ppUIContextData, pdwUIContextDataSize, ppEapError);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool set_ui_context(
|
||||
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||
_In_ DWORD dwUIContextDataSize,
|
||||
_In_ const EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pUIContextData);
|
||||
UNREFERENCED_PARAMETER(dwUIContextDataSize);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_response_attributes(_Out_ EapAttributes *pAttribs, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pAttribs);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool set_response_attributes(const _In_ EapAttributes *pAttribs, _Out_ EapPeerMethodOutput *pEapOutput, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pAttribs);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
public:
|
||||
module &m_module; ///< EAP module
|
||||
config_provider_list m_cfg; ///< Providers configuration
|
||||
credentials_type m_cred; ///< User credentials
|
||||
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
|
||||
HANDLE m_token; ///< Specifies a handle to the user impersonation token to use in this session
|
||||
DWORD m_send_packet_size_max; ///< 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.
|
||||
};
|
||||
}
|
||||
|
@ -33,14 +33,9 @@ namespace eap
|
||||
enum tls_flags_t;
|
||||
|
||||
///
|
||||
/// TLS method
|
||||
/// EAP-TLS method
|
||||
///
|
||||
class method_tls;
|
||||
|
||||
///
|
||||
/// TLS session
|
||||
///
|
||||
class session_tls;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
@ -74,7 +69,7 @@ namespace eap
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
/// \param[in] cfg Method configuration
|
||||
///
|
||||
method_tls(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred);
|
||||
method_tls(_In_ module &module, _In_ config_method_tls &cfg, _In_ credentials_tls &cred);
|
||||
|
||||
///
|
||||
/// Copies an EAP method
|
||||
|
@ -28,7 +28,7 @@ using namespace winstd;
|
||||
// eap::method_tls
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::method_tls::method_tls(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred) :
|
||||
eap::method_tls::method_tls(_In_ module &module, _In_ config_method_tls &cfg, _In_ credentials_tls &cred) :
|
||||
m_phase(phase_handshake_start),
|
||||
method(module, cfg, cred)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace eap
|
||||
|
||||
#include "Config.h"
|
||||
#include "Credentials.h"
|
||||
#include "../../EAPBase/include/Module.h"
|
||||
#include "Session.h"
|
||||
|
||||
|
||||
namespace eap
|
||||
@ -278,5 +278,20 @@ namespace eap
|
||||
_Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
/// @}
|
||||
|
||||
protected:
|
||||
class session {
|
||||
public:
|
||||
inline session(_In_ module &mod) :
|
||||
m_cfg(mod),
|
||||
m_cred(mod),
|
||||
m_method(mod, m_cfg, m_cred)
|
||||
{}
|
||||
|
||||
public:
|
||||
config_method_ttls m_cfg; ///< Method configuration
|
||||
credentials_ttls m_cred; ///< User credentials
|
||||
method_ttls m_method; ///< EAP-TTLS method
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ namespace eap
|
||||
enum ttls_flags_t;
|
||||
|
||||
///
|
||||
/// TTLS session
|
||||
/// EAP-TTLS method
|
||||
///
|
||||
class session_ttls;
|
||||
class method_ttls;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
@ -49,47 +49,48 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
class session_ttls : public session<credentials_ttls, bool, bool>
|
||||
class method_ttls : public method
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructor
|
||||
/// Constructs an EAP method
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
/// \param[in] cfg Method configuration
|
||||
///
|
||||
session_ttls(_In_ module &mod);
|
||||
method_ttls(_In_ module &module, _In_ config_method_ttls &cfg, _In_ credentials_ttls &cred);
|
||||
|
||||
///
|
||||
/// Copies TTLS session
|
||||
/// Copies an EAP method
|
||||
///
|
||||
/// \param[in] other Session to copy from
|
||||
/// \param[in] other EAP method to copy from
|
||||
///
|
||||
session_ttls(_In_ const session_ttls &other);
|
||||
method_ttls(_In_ const method_ttls &other);
|
||||
|
||||
///
|
||||
/// Moves TTLS session
|
||||
/// Moves an EAP method
|
||||
///
|
||||
/// \param[in] other Session to move from
|
||||
/// \param[in] other EAP method to move from
|
||||
///
|
||||
session_ttls(_Inout_ session_ttls &&other);
|
||||
method_ttls(_Inout_ method_ttls &&other);
|
||||
|
||||
///
|
||||
/// Copies TTLS session
|
||||
/// Copies an EAP method
|
||||
///
|
||||
/// \param[in] other Session to copy from
|
||||
/// \param[in] other EAP method to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
session_ttls& operator=(_In_ const session_ttls &other);
|
||||
method_ttls& operator=(_In_ const method_ttls &other);
|
||||
|
||||
///
|
||||
/// Moves TTLS session
|
||||
/// Moves an EAP method
|
||||
///
|
||||
/// \param[in] other Session to move from
|
||||
/// \param[in] other EAP method to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
session_ttls& operator=(_Inout_ session_ttls &&other);
|
||||
method_ttls& operator=(_Inout_ method_ttls &&other);
|
||||
|
||||
/// \name Packet processing
|
||||
/// @{
|
||||
@ -97,15 +98,15 @@ namespace eap
|
||||
///
|
||||
/// Processes a packet received by EAPHost from a supplicant.
|
||||
///
|
||||
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||
///
|
||||
virtual bool process_request_packet(
|
||||
_In_ DWORD dwReceivedPacketSize,
|
||||
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
|
||||
_In_ DWORD dwReceivedPacketSize,
|
||||
_Out_ EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
@ -119,29 +120,16 @@ namespace eap
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_response_packet(
|
||||
_Inout_ DWORD *pdwSendPacketSize,
|
||||
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
|
||||
_Inout_ DWORD *pdwSendPacketSize,
|
||||
_Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_result(
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Out_ EapPeerMethodResult *ppResult,
|
||||
_Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
/// @}
|
||||
|
||||
public:
|
||||
method_tls m_outer; ///< EAP-TLS method
|
||||
enum version_t {
|
||||
version_0 = 0, ///< EAP-TTLS v0
|
||||
} m_version; ///< EAP-TTLS version
|
||||
version_0 = 0, ///< EAP-TTLS v0
|
||||
} m_version; ///< EAP-TTLS version
|
||||
};
|
||||
}
|
||||
|
@ -323,22 +323,27 @@ bool eap::peer_ttls::begin_session(
|
||||
_Out_ EAP_SESSION_HANDLE *phSession,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
UNREFERENCED_PARAMETER(pAttributeArray);
|
||||
UNREFERENCED_PARAMETER(hTokenImpersonateUser);
|
||||
UNREFERENCED_PARAMETER(dwMaxSendPacketSize);
|
||||
|
||||
*phSession = NULL;
|
||||
|
||||
// Allocate new session.
|
||||
unique_ptr<session_ttls> session(new session_ttls(*this));
|
||||
if (!session) {
|
||||
unique_ptr<session> s(new session(*this));
|
||||
if (!s) {
|
||||
*ppEapError = make_error(ERROR_OUTOFMEMORY, _T(__FUNCTION__) _T(" Error allocating memory for EAP-TTLS session."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Begin the session.
|
||||
if (!unpack(session->m_cfg, pConnectionData, dwConnectionDataSize, ppEapError) ||
|
||||
!unpack(session->m_cred, pUserData, dwUserDataSize, ppEapError) ||
|
||||
!session->begin(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize, ppEapError))
|
||||
if (!unpack(s->m_cfg, pConnectionData, dwConnectionDataSize, ppEapError) ||
|
||||
!unpack(s->m_cred, pUserData, dwUserDataSize, ppEapError)/* ||
|
||||
!s->begin(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize, ppEapError)*/)
|
||||
return false;
|
||||
|
||||
*phSession = session.release();
|
||||
*phSession = s.release();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -346,11 +351,12 @@ bool eap::peer_ttls::begin_session(
|
||||
bool eap::peer_ttls::end_session(_In_ EAP_SESSION_HANDLE hSession, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
assert(hSession);
|
||||
UNREFERENCED_PARAMETER(ppEapError); // What could possibly go wrong when destroying!? ;)
|
||||
|
||||
// End the session.
|
||||
session_ttls *session = static_cast<session_ttls*>(hSession);
|
||||
session->end(ppEapError);
|
||||
delete session;
|
||||
session *s = static_cast<session*>(hSession);
|
||||
//s->end(ppEapError);
|
||||
delete s;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -364,7 +370,7 @@ bool eap::peer_ttls::process_request_packet(
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
assert(dwReceivedPacketSize == ntohs(*(WORD*)pReceivedPacket->Length));
|
||||
return static_cast<session_ttls*>(hSession)->process_request_packet(dwReceivedPacketSize, pReceivedPacket, pEapOutput, ppEapError);
|
||||
return static_cast<session*>(hSession)->m_method.process_request_packet(pReceivedPacket, dwReceivedPacketSize, pEapOutput, ppEapError);
|
||||
}
|
||||
|
||||
|
||||
@ -374,7 +380,7 @@ bool eap::peer_ttls::get_response_packet(
|
||||
_Inout_ DWORD *pdwSendPacketSize,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
return static_cast<session_ttls*>(hSession)->get_response_packet(pdwSendPacketSize, pSendPacket, ppEapError);
|
||||
return static_cast<session*>(hSession)->m_method.get_response_packet(pSendPacket, pdwSendPacketSize, ppEapError);
|
||||
}
|
||||
|
||||
|
||||
@ -384,7 +390,13 @@ bool eap::peer_ttls::get_result(
|
||||
_Out_ EapPeerMethodResult *ppResult,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
return static_cast<session_ttls*>(hSession)->get_result(reason, ppResult, ppEapError);
|
||||
UNREFERENCED_PARAMETER(hSession);
|
||||
UNREFERENCED_PARAMETER(reason);
|
||||
UNREFERENCED_PARAMETER(ppResult);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -394,7 +406,13 @@ bool eap::peer_ttls::get_ui_context(
|
||||
_Out_ DWORD *pdwUIContextDataSize,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
return static_cast<session_ttls*>(hSession)->get_ui_context(ppUIContextData, pdwUIContextDataSize, ppEapError);
|
||||
UNREFERENCED_PARAMETER(hSession);
|
||||
UNREFERENCED_PARAMETER(ppUIContextData);
|
||||
UNREFERENCED_PARAMETER(pdwUIContextDataSize);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -405,7 +423,14 @@ bool eap::peer_ttls::set_ui_context(
|
||||
_In_ const EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
return static_cast<session_ttls*>(hSession)->set_ui_context(pUIContextData, dwUIContextDataSize, pEapOutput, ppEapError);
|
||||
UNREFERENCED_PARAMETER(hSession);
|
||||
UNREFERENCED_PARAMETER(pUIContextData);
|
||||
UNREFERENCED_PARAMETER(dwUIContextDataSize);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -414,7 +439,13 @@ bool eap::peer_ttls::get_response_attributes(
|
||||
_Out_ EapAttributes *pAttribs,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
return static_cast<session_ttls*>(hSession)->get_response_attributes(pAttribs, ppEapError);
|
||||
UNREFERENCED_PARAMETER(hSession);
|
||||
UNREFERENCED_PARAMETER(pAttribs);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -424,5 +455,12 @@ bool eap::peer_ttls::set_response_attributes(
|
||||
_Out_ EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
return static_cast<session_ttls*>(hSession)->set_response_attributes(pAttribs, pEapOutput, ppEapError);
|
||||
UNREFERENCED_PARAMETER(hSession);
|
||||
UNREFERENCED_PARAMETER(pAttribs);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
@ -25,91 +25,79 @@ using namespace winstd;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::session_ttls
|
||||
// eap::method_ttls
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::session_ttls::session_ttls(_In_ module &mod) :
|
||||
m_version(version_0),
|
||||
session<credentials_ttls, bool, bool>(mod)
|
||||
eap::method_ttls::method_ttls(_In_ module &module, _In_ config_method_ttls &cfg, _In_ credentials_ttls &cred) :
|
||||
m_outer(module, cfg.m_outer, cred.m_outer),
|
||||
method(module, cfg, cred)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::session_ttls::session_ttls(_In_ const session_ttls &other) :
|
||||
m_version(other.m_version),
|
||||
session<credentials_ttls, bool, bool>(other)
|
||||
eap::method_ttls::method_ttls(_In_ const method_ttls &other) :
|
||||
m_outer(other.m_outer),
|
||||
method(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::session_ttls::session_ttls(_Inout_ session_ttls &&other) :
|
||||
m_version(std::move(other.m_version)),
|
||||
session<credentials_ttls, bool, bool>(std::move(other))
|
||||
eap::method_ttls::method_ttls(_Inout_ method_ttls &&other) :
|
||||
m_outer(std::move(other.m_outer)),
|
||||
method(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::session_ttls& eap::session_ttls::operator=(_In_ const session_ttls &other)
|
||||
eap::method_ttls& eap::method_ttls::operator=(_In_ const method_ttls &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(session<credentials_ttls, bool, bool>&)*this = other;
|
||||
m_version = other.m_version;
|
||||
if (this != std::addressof(other)) {
|
||||
(method&)*this = other;
|
||||
m_outer = other.m_outer;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::session_ttls& eap::session_ttls::operator=(_Inout_ session_ttls &&other)
|
||||
eap::method_ttls& eap::method_ttls::operator=(_Inout_ method_ttls &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(session<credentials_ttls, bool, bool>&)*this = std::move(other);
|
||||
m_version = std::move(other.m_version);
|
||||
if (this != std::addressof(other)) {
|
||||
(method&)*this = std::move(other);
|
||||
m_outer = std::move(other.m_outer);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool eap::session_ttls::process_request_packet(
|
||||
_In_ DWORD dwReceivedPacketSize,
|
||||
bool eap::method_ttls::process_request_packet(
|
||||
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
|
||||
_In_ DWORD dwReceivedPacketSize,
|
||||
_Out_ EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwReceivedPacketSize);
|
||||
UNREFERENCED_PARAMETER(pReceivedPacket);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
assert(ppEapError);
|
||||
// Initialize output.
|
||||
pEapOutput->fAllowNotifications = TRUE;
|
||||
pEapOutput->action = EapPeerMethodResponseActionDiscard;
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
// Is this a valid EAP-TTLS packet?
|
||||
if (dwReceivedPacketSize < 6) {
|
||||
*ppEapError = m_module.make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, _T(__FUNCTION__) _T(" Packet is too small. EAP-%s packets should be at least 6B."));
|
||||
return false;
|
||||
} else if (pReceivedPacket->Data[0] != eap_type_ttls) {
|
||||
*ppEapError = m_module.make_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, wstring_printf(_T(__FUNCTION__) _T(" Packet is not EAP-TTLS (expected: %u, received: %u)."), eap_type_ttls, pReceivedPacket->Data[0]).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_outer.process_request_packet(pReceivedPacket, dwReceivedPacketSize, pEapOutput, ppEapError);
|
||||
}
|
||||
|
||||
|
||||
bool eap::session_ttls::get_response_packet(
|
||||
_Inout_ DWORD *pdwSendPacketSize,
|
||||
bool eap::method_ttls::get_response_packet(
|
||||
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
|
||||
_Inout_ DWORD *pdwSendPacketSize,
|
||||
_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(
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Out_ EapPeerMethodResult *ppResult,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(reason);
|
||||
UNREFERENCED_PARAMETER(ppResult);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
return m_outer.get_response_packet(pSendPacket, pdwSendPacketSize, ppEapError);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user