ui_context: Merge with ui_context_tls_tunnel

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2020-02-04 11:18:06 +01:00
parent bef455e5a6
commit c40f71462f
10 changed files with 13 additions and 201 deletions

View File

@ -96,6 +96,7 @@ namespace eap
public: public:
config_connection &m_cfg; ///< Connection configuration config_connection &m_cfg; ///< Connection configuration
credentials_connection &m_cred; ///< Connection credentials credentials_connection &m_cred; ///< Connection credentials
sanitizing_blob m_data; ///< Context data
}; };
/// @} /// @}

View File

@ -38,6 +38,7 @@ eap::ui_context::ui_context(_In_ config_connection &cfg, _In_ credentials_connec
eap::ui_context::ui_context(_In_ const ui_context &other) : eap::ui_context::ui_context(_In_ const ui_context &other) :
m_cfg (other.m_cfg ), m_cfg (other.m_cfg ),
m_cred (other.m_cred), m_cred (other.m_cred),
m_data (other.m_data),
packable(other ) packable(other )
{ {
} }
@ -46,6 +47,7 @@ eap::ui_context::ui_context(_In_ const ui_context &other) :
eap::ui_context::ui_context(_Inout_ ui_context &&other) noexcept : eap::ui_context::ui_context(_Inout_ ui_context &&other) noexcept :
m_cfg ( other.m_cfg ), m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ), m_cred ( other.m_cred ),
m_data (std::move(other.m_data)),
packable(std::move(other )) packable(std::move(other ))
{ {
} }
@ -57,6 +59,7 @@ eap::ui_context& eap::ui_context::operator=(_In_ const ui_context &other)
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Copy context within same configuration only! assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Copy context within same configuration only!
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Copy context within same credentials only! assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Copy context within same credentials only!
(packable&)*this = other; (packable&)*this = other;
m_data = other.m_data;
} }
return *this; return *this;
@ -69,6 +72,7 @@ eap::ui_context& eap::ui_context::operator=(_Inout_ ui_context &&other) noexcept
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move context within same configuration only! assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move context within same configuration only!
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move context within same credentials only! assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move context within same credentials only!
(packable&)*this = std::move(other); (packable&)*this = std::move(other);
m_data = std::move(other.m_data);
} }
return *this; return *this;
@ -80,6 +84,7 @@ void eap::ui_context::operator<<(_Inout_ cursor_out &cursor) const
packable::operator<<(cursor); packable::operator<<(cursor);
cursor << m_cfg ; cursor << m_cfg ;
cursor << m_cred; cursor << m_cred;
cursor << m_data;
} }
@ -88,7 +93,8 @@ size_t eap::ui_context::get_pk_size() const
return return
packable::get_pk_size() + packable::get_pk_size() +
pksizeof(m_cfg ) + pksizeof(m_cfg ) +
pksizeof(m_cred); pksizeof(m_cred) +
pksizeof(m_data);
} }
@ -97,4 +103,5 @@ void eap::ui_context::operator>>(_Inout_ cursor_in &cursor)
packable::operator>>(cursor); packable::operator>>(cursor);
cursor >> m_cfg ; cursor >> m_cfg ;
cursor >> m_cred; cursor >> m_cred;
cursor >> m_data;
} }

View File

@ -106,7 +106,6 @@
<ClInclude Include="..\include\Method.h" /> <ClInclude Include="..\include\Method.h" />
<ClInclude Include="..\include\Module.h" /> <ClInclude Include="..\include\Module.h" />
<ClInclude Include="..\include\TTLS.h" /> <ClInclude Include="..\include\TTLS.h" />
<ClInclude Include="..\include\UIContext.h" />
<ClInclude Include="..\src\StdAfx.h" /> <ClInclude Include="..\src\StdAfx.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -117,7 +116,6 @@
<ClCompile Include="..\src\StdAfx.cpp"> <ClCompile Include="..\src\StdAfx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader> <PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\UIContext.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Events\build\Events.vcxproj"> <ProjectReference Include="..\..\Events\build\Events.vcxproj">

View File

@ -26,9 +26,6 @@
<ClInclude Include="..\include\Module.h"> <ClInclude Include="..\include\Module.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\include\UIContext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\TTLS.h"> <ClInclude Include="..\include\TTLS.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -49,8 +46,5 @@
<ClCompile Include="..\src\Module.cpp"> <ClCompile Include="..\src\Module.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\UIContext.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,96 +0,0 @@
/*
Copyright 2015-2020 Amebis
Copyright 2016-2017 GÉANT
This file is part of GÉANTLink.
GÉANTLink is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GÉANTLink is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
namespace eap
{
class ui_context_tls_tunnel;
}
#pragma once
#include "TTLS.h"
#include "../../EAPBase/include/UIContext.h"
namespace eap
{
/// \addtogroup EAPBaseUICtx
/// @{
///
/// TLS tunnel UI context
///
class ui_context_tls_tunnel : public ui_context
{
public:
///
/// Constructs context
///
/// \param[in] cfg Connection configuration
/// \param[in] cred Connection credentials
///
ui_context_tls_tunnel(_In_ config_connection &cfg, _In_ credentials_connection &cred);
///
/// Copies context
///
/// \param[in] other Credentials to copy from
///
ui_context_tls_tunnel(_In_ const ui_context_tls_tunnel &other);
///
/// Moves context
///
/// \param[in] other Credentials to move from
///
ui_context_tls_tunnel(_Inout_ ui_context_tls_tunnel &&other) noexcept;
///
/// Copies context
///
/// \param[in] other Credentials to copy from
///
/// \returns Reference to this object
///
ui_context_tls_tunnel& operator=(_In_ const ui_context_tls_tunnel &other);
///
/// Moves context
///
/// \param[in] other Configuration to move from
///
/// \returns Reference to this object
///
ui_context_tls_tunnel& operator=(_Inout_ ui_context_tls_tunnel &&other) noexcept;
/// \name BLOB management
/// @{
virtual void operator<<(_Inout_ cursor_out &cursor) const;
virtual size_t get_pk_size() const;
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
public:
sanitizing_blob m_data; ///< Context data
};
/// @}
}

View File

@ -334,7 +334,7 @@ void eap::peer_tls_tunnel::get_ui_context(
auto s = static_cast<session*>(hSession); auto s = static_cast<session*>(hSession);
// Get context data from method. // Get context data from method.
ui_context_tls_tunnel ctx(s->m_cfg, s->m_cred); ui_context ctx(s->m_cfg, s->m_cred);
s->m_method->get_ui_context(ctx.m_data); s->m_method->get_ui_context(ctx.m_data);
// Pack context data. // Pack context data.

View File

@ -26,7 +26,6 @@
#include "../include/Credentials.h" #include "../include/Credentials.h"
#include "../include/Method.h" #include "../include/Method.h"
#include "../include/Module.h" #include "../include/Module.h"
#include "../include/UIContext.h"
#include "../../PAP/include/Config.h" #include "../../PAP/include/Config.h"
#include "../../PAP/include/Method.h" #include "../../PAP/include/Method.h"
@ -42,6 +41,7 @@
#include "../../EapHost/include/Method.h" #include "../../EapHost/include/Method.h"
#include "../../EAPBase/include/EAPXML.h" #include "../../EAPBase/include/EAPXML.h"
#include "../../EAPBase/include/UIContext.h"
#include <WinStd/EAP.h> #include <WinStd/EAP.h>

View File

@ -1,92 +0,0 @@
/*
Copyright 2015-2020 Amebis
Copyright 2016 GÉANT
This file is part of GÉANTLink.
GÉANTLink is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GÉANTLink is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
#include "StdAfx.h"
using namespace std;
using namespace winstd;
//////////////////////////////////////////////////////////////////////
// eap::ui_context_tls_tunnel
//////////////////////////////////////////////////////////////////////
eap::ui_context_tls_tunnel::ui_context_tls_tunnel(_In_ config_connection &cfg, _In_ credentials_connection &cred) :
ui_context(cfg, cred)
{
}
eap::ui_context_tls_tunnel::ui_context_tls_tunnel(_In_ const ui_context_tls_tunnel &other) :
m_data (other.m_data),
ui_context(other )
{
}
eap::ui_context_tls_tunnel::ui_context_tls_tunnel(_Inout_ ui_context_tls_tunnel &&other) noexcept :
m_data (std::move(other.m_data)),
ui_context(std::move(other ))
{
}
eap::ui_context_tls_tunnel& eap::ui_context_tls_tunnel::operator=(_In_ const ui_context_tls_tunnel &other)
{
if (this != &other) {
(ui_context&)*this = other;
m_data = other.m_data;
}
return *this;
}
eap::ui_context_tls_tunnel& eap::ui_context_tls_tunnel::operator=(_Inout_ ui_context_tls_tunnel &&other) noexcept
{
if (this != &other) {
(ui_context&)*this = std::move(other );
m_data = std::move(other.m_data);
}
return *this;
}
void eap::ui_context_tls_tunnel::operator<<(_Inout_ cursor_out &cursor) const
{
ui_context::operator<<(cursor);
cursor << m_data;
}
size_t eap::ui_context_tls_tunnel::get_pk_size() const
{
return
ui_context::get_pk_size() +
pksizeof(m_data);
}
void eap::ui_context_tls_tunnel::operator>>(_Inout_ cursor_in &cursor)
{
ui_context::operator>>(cursor);
cursor >> m_data;
}

View File

@ -352,7 +352,7 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
// Unpack context data. // Unpack context data.
config_connection cfg(*this); config_connection cfg(*this);
credentials_connection cred(*this, cfg); credentials_connection cred(*this, cfg);
ui_context_tls_tunnel ctx(cfg, cred); ui_context ctx(cfg, cred);
unpack(ctx, pUIContextData, dwUIContextDataSize); unpack(ctx, pUIContextData, dwUIContextDataSize);
// Look-up the provider. // Look-up the provider.

View File

@ -32,6 +32,6 @@
#include "../../GTC_UI/include/GTC_UI.h" #include "../../GTC_UI/include/GTC_UI.h"
#include "../../EapHost/include/Credentials.h" #include "../../EapHost/include/Credentials.h"
#include "../../TTLS/include/UIContext.h" #include "../../EapBase/include/UIContext.h"
#include <wx/choicdlg.h> #include <wx/choicdlg.h>