Code clean-up
This commit is contained in:
parent
654c965851
commit
55f160bce3
@ -189,7 +189,7 @@ namespace eap
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
/// Constructs an EAP method
|
/// Constructs a non-EAP method
|
||||||
///
|
///
|
||||||
/// \param[in] mod EAP module to use for global services
|
/// \param[in] mod EAP module to use for global services
|
||||||
/// \param[in] cfg Method configuration
|
/// \param[in] cfg Method configuration
|
||||||
@ -198,14 +198,14 @@ namespace eap
|
|||||||
method_noneap(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred);
|
method_noneap(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Moves an EAP method
|
/// Moves a non-EAP method
|
||||||
///
|
///
|
||||||
/// \param[in] other EAP method to move from
|
/// \param[in] other EAP method to move from
|
||||||
///
|
///
|
||||||
method_noneap(_Inout_ method_noneap &&other);
|
method_noneap(_Inout_ method_noneap &&other);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Moves an EAP method
|
/// Moves a non-EAP method
|
||||||
///
|
///
|
||||||
/// \param[in] other EAP method to move from
|
/// \param[in] other EAP method to move from
|
||||||
///
|
///
|
||||||
@ -217,7 +217,7 @@ namespace eap
|
|||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Obtains a response packet from the EAP method.
|
/// Obtains a response packet from the non-EAP method.
|
||||||
///
|
///
|
||||||
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
||||||
///
|
///
|
||||||
@ -236,7 +236,11 @@ namespace eap
|
|||||||
/// \param[in] data AVP data (<16777212B)
|
/// \param[in] data AVP data (<16777212B)
|
||||||
/// \param[in] size Size of \p data in bytes
|
/// \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);
|
void append_avp(
|
||||||
|
_In_ unsigned int code,
|
||||||
|
_In_ unsigned char flags,
|
||||||
|
_In_bytecount_(size) const void *data,
|
||||||
|
_In_ unsigned int size);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Appends Diameter AVP to response packet
|
/// Appends Diameter AVP to response packet
|
||||||
@ -247,7 +251,12 @@ namespace eap
|
|||||||
/// \param[in] data AVP data (<16777212B)
|
/// \param[in] data AVP data (<16777212B)
|
||||||
/// \param[in] size Size of \p data in bytes
|
/// \param[in] size Size of \p data in bytes
|
||||||
///
|
///
|
||||||
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);
|
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:
|
protected:
|
||||||
sanitizing_blob m_packet_res; ///< Response packet
|
sanitizing_blob m_packet_res; ///< Response packet
|
||||||
|
@ -198,7 +198,11 @@ void eap::method_noneap::get_response_packet(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void eap::method_noneap::append_avp(_In_ unsigned int code, _In_ unsigned char flags, _In_bytecount_(size) const void *data, _In_ unsigned int size)
|
void eap::method_noneap::append_avp(
|
||||||
|
_In_ unsigned int code,
|
||||||
|
_In_ unsigned char flags,
|
||||||
|
_In_bytecount_(size) const void *data,
|
||||||
|
_In_ unsigned int size)
|
||||||
{
|
{
|
||||||
unsigned int
|
unsigned int
|
||||||
padding = (unsigned int)((4 - size) % 4),
|
padding = (unsigned int)((4 - size) % 4),
|
||||||
@ -224,7 +228,12 @@ void eap::method_noneap::append_avp(_In_ unsigned int code, _In_ unsigned char f
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
unsigned int
|
unsigned int
|
||||||
padding = (unsigned int)((4 - size) % 4),
|
padding = (unsigned int)((4 - size) % 4),
|
||||||
|
@ -101,13 +101,13 @@ EapPeerMethodResponseAction eap::method_mschapv2::process_request_packet(
|
|||||||
sanitizing_string identity_utf8;
|
sanitizing_string identity_utf8;
|
||||||
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity.c_str(), (int)m_cred.m_identity.length(), identity_utf8, NULL, NULL);
|
WideCharToMultiByte(CP_UTF8, 0, m_cred.m_identity.c_str(), (int)m_cred.m_identity.length(), identity_utf8, NULL, NULL);
|
||||||
|
|
||||||
// Randomize Peer-Challenge
|
// Randomize Peer-Challenge.
|
||||||
m_challenge_client.randomize(m_cp);
|
m_challenge_client.randomize(m_cp);
|
||||||
|
|
||||||
// Calculate NT-Response
|
// 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());
|
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;
|
sanitizing_blob response;
|
||||||
response.reserve(
|
response.reserve(
|
||||||
1 + // Ident
|
1 + // Ident
|
||||||
|
@ -89,8 +89,6 @@ EapPeerMethodResponseAction eap::method_pap::process_request_packet(
|
|||||||
size_t padding_password_ex = (16 - password_utf8.length()) % 16;
|
size_t padding_password_ex = (16 - password_utf8.length()) % 16;
|
||||||
password_utf8.append(padding_password_ex, 0);
|
password_utf8.append(padding_password_ex, 0);
|
||||||
|
|
||||||
m_packet_res.clear();
|
|
||||||
|
|
||||||
// Diameter AVP (User-Name=1, User-Password=2)
|
// 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(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());
|
append_avp(2, diameter_avp_flag_mandatory, password_utf8.data(), (unsigned int)password_utf8.size());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user