mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-29 23:15:56 -04:00
Revert "remove station related session code"
This reverts commit 0e22ecd027.
This commit is contained in:
@@ -86,6 +86,8 @@ void ConfigLoginServer::install(void)
|
||||
KEY_INT (maxCharactersPerCluster, 10000);
|
||||
KEY_INT (maxCharactersPerAccount, 20);
|
||||
KEY_BOOL (validateClientVersion, true);
|
||||
KEY_BOOL (validateStationKey, false);
|
||||
KEY_BOOL (doSessionLogin, false);
|
||||
KEY_BOOL (doConsumption, false);
|
||||
KEY_STRING (sessionServers, "localhost:3004");
|
||||
KEY_INT (sessionType, SESSION_TYPE_STARWARS);
|
||||
|
||||
@@ -19,6 +19,8 @@ class ConfigLoginServer
|
||||
int pingServicePort;
|
||||
int httpServicePort;
|
||||
bool validateClientVersion;
|
||||
bool validateStationKey;
|
||||
bool doSessionLogin;
|
||||
bool doConsumption;
|
||||
const char * sessionServers;
|
||||
int sessionType;
|
||||
@@ -75,6 +77,8 @@ class ConfigLoginServer
|
||||
static const uint16 getPingServicePort();
|
||||
static const uint16 getHttpServicePort();
|
||||
static const bool getValidateClientVersion();
|
||||
static const bool getValidateStationKey();
|
||||
static const bool getDoSessionLogin();
|
||||
static const bool getDoConsumption();
|
||||
static const char * getSessionServers();
|
||||
static const int getSessionType();
|
||||
@@ -203,6 +207,20 @@ inline const bool ConfigLoginServer::getValidateClientVersion()
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigLoginServer::getValidateStationKey()
|
||||
{
|
||||
return (data->validateStationKey);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigLoginServer::getDoSessionLogin()
|
||||
{
|
||||
return (data->doSessionLogin);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigLoginServer::getDoConsumption()
|
||||
{
|
||||
return (data->doConsumption);
|
||||
|
||||
@@ -193,6 +193,11 @@ m_soeMonitor(0)
|
||||
connectToMessage("FeatureIdTransactionRequest");
|
||||
connectToMessage("FeatureIdTransactionSyncUpdate");
|
||||
keyServer = new KeyServer;
|
||||
|
||||
if (ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin())
|
||||
{
|
||||
installSessionValidation();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -254,6 +259,30 @@ void LoginServer::removeClient (int clientId)
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
void LoginServer::installSessionValidation()
|
||||
{
|
||||
int i = 0;
|
||||
std::vector<const char* > sessionServers;
|
||||
|
||||
int numberOfSessionServers = ConfigLoginServer::getNumberOfSessionServers();
|
||||
for (i = 0; i < numberOfSessionServers; ++i)
|
||||
{
|
||||
char const * const p = ConfigLoginServer::getSessionServer(i);
|
||||
if(p)
|
||||
{
|
||||
REPORT_LOG(true, ("Using session server %s\n", p));
|
||||
sessionServers.push_back(p);
|
||||
}
|
||||
}
|
||||
|
||||
// if there were none specified, use defaults
|
||||
FATAL(i == 0, ("No session servers specified for session API"));
|
||||
|
||||
m_sessionApiClient = new SessionApiClient(&sessionServers[0], i);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
bool LoginServer::deleteCharacter(uint32 clusterId, NetworkId const & characterId, StationId suid)
|
||||
{
|
||||
const ClusterListEntry *cle = findClusterById(clusterId);
|
||||
@@ -1345,12 +1374,33 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username,
|
||||
|
||||
IGNORE_RETURN(memset(keyBuffer, 0, len));
|
||||
|
||||
// If we aren't validating sessions, pack username, security status, and username to connectionserver
|
||||
memcpy(keyBufferPointer, &suid, sizeof(uint32)); //lint !e64 !e119 !e534 (lint isn't resolving memcpy properly)
|
||||
keyBufferPointer += sizeof(uint32);
|
||||
memcpy(keyBufferPointer, &isSecure, sizeof(bool)); //lint !e64 !e119 !e534
|
||||
keyBufferPointer += sizeof(bool);
|
||||
memcpy(keyBufferPointer, username.c_str(), MAX_ACCOUNT_NAME_LENGTH); //lint !e64 !e119 !e534
|
||||
if (ConfigLoginServer::getDoConsumption() || ConfigLoginServer::getDoSessionLogin())
|
||||
{
|
||||
// pass the sessionkey
|
||||
len = apiSessionIdWidth + sizeof(StationId);
|
||||
memcpy(keyBufferPointer, sessionKey, apiSessionIdWidth);
|
||||
keyBufferPointer += apiSessionIdWidth;
|
||||
memcpy(keyBufferPointer, &suid, sizeof(StationId));
|
||||
|
||||
// if LoginServer did session login, send the session key back to the client;
|
||||
// the client normally gets the session key from the LaunchPad, but in this mode
|
||||
// where the LoginServer does the session login, it will get it from the LoginServer
|
||||
if (ConfigLoginServer::getDoSessionLogin())
|
||||
{
|
||||
std::string const strSessionKey(sessionKey, apiSessionIdWidth);
|
||||
GenericValueTypeMessage<std::string> const msg("SetSessionKey", strSessionKey);
|
||||
conn->send(msg, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we aren't validating sessions, pack username, security status, and username to connectionserver
|
||||
memcpy(keyBufferPointer, &suid, sizeof(uint32)); //lint !e64 !e119 !e534 (lint isn't resolving memcpy properly)
|
||||
keyBufferPointer += sizeof(uint32);
|
||||
memcpy(keyBufferPointer, &isSecure, sizeof(bool)); //lint !e64 !e119 !e534
|
||||
keyBufferPointer += sizeof(bool);
|
||||
memcpy(keyBufferPointer, username.c_str(), MAX_ACCOUNT_NAME_LENGTH); //lint !e64 !e119 !e534
|
||||
}
|
||||
|
||||
KeyShare::Token token = LoginServer::getInstance().makeToken(keyBuffer, len);
|
||||
Archive::ByteStream a;
|
||||
|
||||
@@ -139,6 +139,7 @@ private:
|
||||
typedef std::map<int, ClientConnection *> ActiveClientsType;
|
||||
|
||||
private:
|
||||
void installSessionValidation();
|
||||
ClusterListEntry * findClusterById (uint32 clusterId);
|
||||
ClusterListEntry * findClusterByName (const std::string & clusterName);
|
||||
ClusterListEntry * findClusterByConnection (const CentralServerConnection *connection);
|
||||
|
||||
@@ -120,7 +120,10 @@ void PurgeManager::onGetAccountForPurge(StationId account, int purgePhase)
|
||||
PurgeRecord record(account, static_cast<PurgePhase>(purgePhase));
|
||||
m_purgeRecords.insert(std::make_pair(account,record));
|
||||
|
||||
onCheckStatusForPurge(account, false);
|
||||
if (ConfigLoginServer::getValidateStationKey())
|
||||
NON_NULL(LoginServer::getInstance().getSessionApiClient())->checkStatusForPurge(account);
|
||||
else
|
||||
onCheckStatusForPurge(account, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user