diff options
author | p0358 <p0358@users.noreply.github.com> | 2021-12-31 22:53:33 +0100 |
---|---|---|
committer | p0358 <p0358@users.noreply.github.com> | 2021-12-31 22:53:33 +0100 |
commit | 89699322407bd31e1440d27c26c8ee352f824d93 (patch) | |
tree | 07696a529d77b3ef412a838a82a9c13352dd78bd /NorthstarDedicatedTest/serverauthentication.cpp | |
parent | 9b13df7bc6f4c09c3fdab27cd51fe76d30b756b8 (diff) | |
parent | f341986b591cee533994597de418df1752ad5e97 (diff) | |
download | NorthstarLauncher-89699322407bd31e1440d27c26c8ee352f824d93.tar.gz NorthstarLauncher-89699322407bd31e1440d27c26c8ee352f824d93.zip |
Merge branch 'main' of https://github.com/R2Northstar/NorthstarLauncher
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 9a80382b..98290b34 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; |