aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/masterserver.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-30 18:09:36 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-30 18:09:36 +0000
commite123245200cb6619467b8859c488b39f9cb2f38f (patch)
treed07ed5b649cdc890d62823e68dc0d805d2c36e76 /NorthstarDedicatedTest/masterserver.cpp
parent2770beb6af1a3bcf4d303f9a10ebaaefd15f01ce (diff)
downloadNorthstarLauncher-e123245200cb6619467b8859c488b39f9cb2f38f.tar.gz
NorthstarLauncher-e123245200cb6619467b8859c488b39f9cb2f38f.zip
move to server auth token system for verifying gameserver auth messages, rather than ip
Diffstat (limited to 'NorthstarDedicatedTest/masterserver.cpp')
-rw-r--r--NorthstarDedicatedTest/masterserver.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp
index c4f576e3..e8ed3327 100644
--- a/NorthstarDedicatedTest/masterserver.cpp
+++ b/NorthstarDedicatedTest/masterserver.cpp
@@ -637,6 +637,7 @@ void MasterServerManager::AddSelfToServerList(int port, int authPort, char* name
std::thread requestThread([this, port, authPort, strName, strDescription, strMap, strPlaylist, maxPlayers, strPassword]
{
m_ownServerId[0] = 0;
+ m_ownServerAuthToken[0] = 0;
// build modinfo obj
rapidjson::Document modinfoDoc;
@@ -733,7 +734,7 @@ void MasterServerManager::AddSelfToServerList(int port, int authPort, char* name
goto REQUEST_END_CLEANUP;
}
- if (!serverAddedJson.HasMember("id") || !serverAddedJson["id"].IsString())
+ if (!serverAddedJson.HasMember("id") || !serverAddedJson["id"].IsString() || !serverAddedJson.HasMember("serverAuthToken") || !serverAddedJson["serverAuthToken"].IsString())
{
spdlog::error("Failed reading masterserver response: malformed json object");
goto REQUEST_END_CLEANUP;
@@ -742,6 +743,8 @@ void MasterServerManager::AddSelfToServerList(int port, int authPort, char* name
strncpy(m_ownServerId, serverAddedJson["id"].GetString(), sizeof(m_ownServerId));
m_ownServerId[sizeof(m_ownServerId) - 1] = 0;
+ strncpy(m_ownServerAuthToken, serverAddedJson["serverAuthToken"].GetString(), sizeof(m_ownServerAuthToken));
+ m_ownServerAuthToken[sizeof(m_ownServerAuthToken) - 1] = 0;
// heartbeat thread
// ideally this should actually be done in main thread, rather than on it's own thread, so it'd stop if server freezes