EAP-GTC implementation continues...

This commit is contained in:
2017-01-31 10:40:11 +01:00
parent f6522b8fa7
commit e8d231d360
12 changed files with 43 additions and 461 deletions

View File

@@ -42,7 +42,7 @@ namespace eap
///
/// EAP-GTC configuration
///
class config_method_eapgtc : public config_method
class config_method_eapgtc : public config_method_with_cred
{
public:
///
@@ -101,7 +101,7 @@ namespace eap
///
/// @copydoc eap::config_method::make_credentials()
/// \returns This implementation always returns `NULL`
/// \returns This implementation always returns `eap::credentials` type of credentials
///
virtual credentials* make_credentials() const;
};

View File

@@ -29,8 +29,6 @@ namespace eap
#include "../../EAPBase/include/Method.h"
#include <list>
namespace eap
{
@@ -50,8 +48,9 @@ namespace eap
///
/// \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);
method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _In_ credentials &cred);
///
/// Moves a GTC method
@@ -93,6 +92,10 @@ namespace eap
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{
@@ -106,12 +109,9 @@ namespace eap
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
protected:
config_method_eapgtc &m_cfg; ///< Method configuration
credentials &m_cred; ///< Method user credentials
winstd::sanitizing_wstring m_message; ///< Authenticator message
winstd::sanitizing_wstring m_reply; ///< GTC reply
};

View File

@@ -28,19 +28,20 @@ using namespace winstd;
// eap::config_method_eapgtc
//////////////////////////////////////////////////////////////////////
eap::config_method_eapgtc::config_method_eapgtc(_In_ module &mod, _In_ unsigned int level) : config_method(mod, level)
eap::config_method_eapgtc::config_method_eapgtc(_In_ module &mod, _In_ unsigned int level) : config_method_with_cred(mod, level)
{
m_cred.reset(new credentials(mod));
}
eap::config_method_eapgtc::config_method_eapgtc(_In_ const config_method_eapgtc &other) :
config_method(other)
config_method_with_cred(other)
{
}
eap::config_method_eapgtc::config_method_eapgtc(_Inout_ config_method_eapgtc &&other) :
config_method(std::move(other))
config_method_with_cred(std::move(other))
{
}
@@ -48,7 +49,7 @@ eap::config_method_eapgtc::config_method_eapgtc(_Inout_ config_method_eapgtc &&o
eap::config_method_eapgtc& eap::config_method_eapgtc::operator=(_In_ const config_method_eapgtc &other)
{
if (this != &other)
(config_method&)*this = other;
(config_method_with_cred&)*this = other;
return *this;
}
@@ -57,7 +58,7 @@ eap::config_method_eapgtc& eap::config_method_eapgtc::operator=(_In_ const confi
eap::config_method_eapgtc& eap::config_method_eapgtc::operator=(_Inout_ config_method_eapgtc &&other)
{
if (this != &other)
(config_method&&)*this = std::move(other);
(config_method_with_cred&&)*this = std::move(other);
return *this;
}
@@ -83,5 +84,5 @@ const wchar_t* eap::config_method_eapgtc::get_method_str() const
eap::credentials* eap::config_method_eapgtc::make_credentials() const
{
return NULL;
return new eap::credentials(m_module);
}

View File

@@ -28,15 +28,17 @@ using namespace winstd;
// eap::method_gtc
//////////////////////////////////////////////////////////////////////
eap::method_gtc::method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg) :
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_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_message(std::move(other.m_message)),
m_reply (std::move(other.m_reply )),
method (std::move(other ))
@@ -47,7 +49,8 @@ eap::method_gtc::method_gtc(_Inout_ method_gtc &&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_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_message = std::move(other.m_message);
m_reply = std::move(other.m_reply );