diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2023-03-05 18:43:07 -0500 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2023-04-17 14:50:10 -0400 |
commit | 35e91aa12002f089f8624b63421f370f17e3f4c7 (patch) | |
tree | aedafb2d63ddd22d96c3f1d864aa5a1127ed32d0 /NorthstarDLL/masterserver | |
parent | 29c6aeca11a52339025b46ce7854e6f81e119fd4 (diff) | |
download | NorthstarLauncher-35e91aa12002f089f8624b63421f370f17e3f4c7.tar.gz NorthstarLauncher-35e91aa12002f089f8624b63421f370f17e3f4c7.zip |
Implement Atlas sigreq1 connectionless packet
Consists of a JSON object including a type key and a HMAC-SHA256
signature using the gameserver-specific token from the masterserver
as the key.
Diffstat (limited to 'NorthstarDLL/masterserver')
-rw-r--r-- | NorthstarDLL/masterserver/masterserver.cpp | 25 | ||||
-rw-r--r-- | NorthstarDLL/masterserver/masterserver.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/NorthstarDLL/masterserver/masterserver.cpp b/NorthstarDLL/masterserver/masterserver.cpp index 8087237c..9b439027 100644 --- a/NorthstarDLL/masterserver/masterserver.cpp +++ b/NorthstarDLL/masterserver/masterserver.cpp @@ -763,6 +763,31 @@ void MasterServerManager::WritePlayerPersistentData(const char* playerId, const requestThread.detach(); } +void MasterServerManager::ProcessConnectionlessPacketSigreq1(std::string data) +{ + rapidjson_document obj; + obj.Parse(data); + + if (obj.HasParseError()) + { + // note: it's okay to print the data as-is since we've already checked that it actually came from Atlas + spdlog::error("invalid Atlas connectionless packet request ({}): {}", data, GetParseError_En(obj.GetParseError())); + return; + } + + if (!obj.HasMember("type") || !obj["type"].IsString()) + { + spdlog::error("invalid Atlas connectionless packet request ({}): missing type", data); + return; + } + + std::string type = obj["type"].GetString(); + + // TODO + + spdlog::error("invalid Atlas connectionless packet request: unknown type {}", type); +} + void ConCommand_ns_fetchservers(const CCommand& args) { g_pMasterServerManager->RequestServerList(); diff --git a/NorthstarDLL/masterserver/masterserver.h b/NorthstarDLL/masterserver/masterserver.h index 21082e2f..5cd6a695 100644 --- a/NorthstarDLL/masterserver/masterserver.h +++ b/NorthstarDLL/masterserver/masterserver.h @@ -126,6 +126,7 @@ class MasterServerManager void AuthenticateWithOwnServer(const char* uid, const char* playerToken); void AuthenticateWithServer(const char* uid, const char* playerToken, RemoteServerInfo server, const char* password); void WritePlayerPersistentData(const char* playerId, const char* pdata, size_t pdataSize); + void ProcessConnectionlessPacketSigreq1(std::string req); }; extern MasterServerManager* g_pMasterServerManager; |