diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-30 18:09:36 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-30 18:09:36 +0000 |
commit | e123245200cb6619467b8859c488b39f9cb2f38f (patch) | |
tree | d07ed5b649cdc890d62823e68dc0d805d2c36e76 /NorthstarDedicatedTest/serverauthentication.cpp | |
parent | 2770beb6af1a3bcf4d303f9a10ebaaefd15f01ce (diff) | |
download | NorthstarLauncher-e123245200cb6619467b8859c488b39f9cb2f38f.tar.gz NorthstarLauncher-e123245200cb6619467b8859c488b39f9cb2f38f.zip |
move to server auth token system for verifying gameserver auth messages, rather than ip
Diffstat (limited to 'NorthstarDedicatedTest/serverauthentication.cpp')
-rw-r--r-- | NorthstarDedicatedTest/serverauthentication.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp index 5351dfdc..32eb67fc 100644 --- a/NorthstarDedicatedTest/serverauthentication.cpp +++ b/NorthstarDedicatedTest/serverauthentication.cpp @@ -68,15 +68,15 @@ void ServerAuthenticationManager::StartPlayerAuthServer() m_playerAuthServer.Post("/authenticate_incoming_player", [this](const httplib::Request& request, httplib::Response& response) { // can't just do request.remote_addr == Cvar_ns_masterserver_hostname->m_pszString because the cvar can be a url, gotta resolve an ip from it for comparisons - unsigned long remoteAddr = inet_addr(request.remote_addr.c_str()); - - char* addrPtr = Cvar_ns_masterserver_hostname->m_pszString; - char* typeStart = strstr(addrPtr, "://"); - if (typeStart) - addrPtr = typeStart + 3; - hostent* resolvedRemoteAddr = gethostbyname((const char*)addrPtr); - - if (!request.has_param("id") || !request.has_param("authToken") || request.body.size() >= 65335 || !resolvedRemoteAddr || ((in_addr**)resolvedRemoteAddr->h_addr_list)[0]->S_un.S_addr != remoteAddr) + //unsigned long remoteAddr = inet_addr(request.remote_addr.c_str()); + // + //char* addrPtr = Cvar_ns_masterserver_hostname->m_pszString; + //char* typeStart = strstr(addrPtr, "://"); + //if (typeStart) + // addrPtr = typeStart + 3; + //hostent* resolvedRemoteAddr = gethostbyname((const char*)addrPtr); + + if (!request.has_param("id") || !request.has_param("authToken") || request.body.size() >= 65335 || !request.has_param("serverAuthToken") || strcmp(g_MasterServerManager->m_ownServerAuthToken, request.get_param_value("serverAuthToken").c_str()))// || !resolvedRemoteAddr || ((in_addr**)resolvedRemoteAddr->h_addr_list)[0]->S_un.S_addr != remoteAddr) { response.set_content("{\"success\":false}", "application/json"); return; |