Revert "remove more dead code"

This reverts commit 7d03daec7d.
This commit is contained in:
DarthArgus
2016-04-18 03:57:01 +00:00
parent 9aeea8732e
commit cb1035d40e
3 changed files with 47 additions and 6 deletions
@@ -330,7 +330,15 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg)
Archive::ReadIterator ri(t);
KeyShare::Token token(ri);
result = ConnectionServer::decryptToken(token, sessionId, m_requestedSuid);
if (!ConfigConnectionServer::getValidateStationKey())
{
// get SUID from token
result = ConnectionServer::decryptToken(token, m_suid, m_isSecure, m_accountName);
}
else
{
result = ConnectionServer::decryptToken(token, sessionId, m_requestedSuid);
}
static const std::string loginTrace("TRACE_LOGIN");
LOG(loginTrace, ("ClientConnection SUID = %d", m_suid));
@@ -370,13 +378,30 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg)
return;
}
m_suid = atoi(m_accountName.c_str());
if (m_suid == 0)
if (ConfigConnectionServer::getValidateStationKey())
{
std::hash<std::string> h;
m_suid = h(m_accountName.c_str());
SessionApiClient * session = ConnectionServer::getSessionApiClient();
NOT_NULL(session);
if(session)
{
session->validateClient(this, sessionId);
}
else
{
ConnectionServer::dropClient(this, "SessionApiClient is not available!");
disconnect();
}
}
else
{
m_suid = atoi(m_accountName.c_str());
if (m_suid == 0)
{
std::hash<std::string> h;
m_suid = h(m_accountName.c_str());
}
onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints());
}
onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints());
}
else
{
@@ -104,6 +104,7 @@ public:
static const int getClientHashTableSize ();
static const int getLagReportThreshold ();
static bool getValidateStationKey();
static const char * getSessionServers();
static const int getSessionType();
static bool getDisableSessionLogout();
@@ -348,6 +349,15 @@ inline const int ConfigConnectionServer::getLagReportThreshold()
// ----------------------------------------------------------------------
//------------------------------------------------------------------------------------------
inline bool ConfigConnectionServer::getValidateStationKey()
{
return data->validateStationKey;
}
//------------------------------------------------------------------------------------------
inline const char * ConfigConnectionServer::getSessionServers()
{
return data->sessionServers;
@@ -119,6 +119,12 @@ m_recoveringClientList()
Address a("", ConfigConnectionServer::getPingPort());
IGNORE_RETURN(pingSocket->bind (a));
if (ConfigConnectionServer::getValidateStationKey())
{
installSessionValidation();
}
}
//-----------------------------------------------------------------------