From 4a6d1e71b366886f082dbcfc036ba9be5bf5a50a Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Fri, 13 May 2022 01:50:20 +0200 Subject: Log UID in a variety of places during auth process (#174) * Log UID in a variety of places during auth process * Log UID in CBaseClient__ActivatePlayerHook --- NorthstarDedicatedTest/serverauthentication.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'NorthstarDedicatedTest') diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp index e50b9357..ee70900f 100644 --- a/NorthstarDedicatedTest/serverauthentication.cpp +++ b/NorthstarDedicatedTest/serverauthentication.cpp @@ -113,6 +113,12 @@ void ServerAuthenticationManager::StartPlayerAuthServer() return; } + // Log playername and UID from request + spdlog::info( + "Player \"{}\" with UID \"{}\" requested to join", + request.get_param_value("username").c_str(), + request.get_param_value("id").c_str()); + AuthData newAuthData {}; strncpy(newAuthData.uid, request.get_param_value("id").c_str(), sizeof(newAuthData.uid)); newAuthData.uid[sizeof(newAuthData.uid) - 1] = 0; @@ -180,6 +186,9 @@ bool ServerAuthenticationManager::AuthenticatePlayer(void* player, int64_t uid, // use stored auth data AuthData authData = m_authData[authToken]; + // Log playnername and UID from request + spdlog::info("Comparing connecting UID \"{}\" against stored UID from ms auth reguest \"{}\"", strUid.c_str(), authData.uid); + if (!strcmp(strUid.c_str(), authData.uid)) // connecting client's uid is the same as auth's uid { authFail = false; @@ -264,6 +273,8 @@ bool ServerAuthenticationManager::RemovePlayerAuthData(void* player) { if (!strcmp((char*)player + 0xF500, auth.second.uid)) { + // Log UID + spdlog::info("Erasing auth data from UID \"{}\"", auth.second.uid); // pretty sure this is fine, since we don't iterate after the erase // i think if we iterated after it'd be undefined behaviour tho std::lock_guard guard(m_authDataMutex); @@ -321,6 +332,9 @@ void* CBaseServer__ConnectClientHook( nextPlayerToken = serverFilter; nextPlayerUid = uid; + // Random UID log + spdlog::info("CBaseServer__ConnectClientHook says UID \"{}\"", uid); + return CBaseServer__ConnectClient(server, a2, a3, a4, a5, a6, a7, a8, serverFilter, a10, a11, a12, a13, a14, uid, a16, a17); } @@ -333,6 +347,9 @@ bool CBaseClient__ConnectHook(void* self, char* name, __int64 netchan_ptr_arg, c // we connect irregardless of auth, because returning bad from this function can fuck client state p bad bool ret = CBaseClient__Connect(self, name, netchan_ptr_arg, b_fake_player_arg, a5, Buffer, a7); + // Another UID log + spdlog::info("CBaseClient__ConnectHook says UID \"{}\"", nextPlayerUid); + if (!ret) return ret; @@ -389,6 +406,8 @@ void CBaseClient__ActivatePlayerHook(void* self) g_ServerAuthenticationManager->WritePersistentData(self); g_MasterServerManager->UpdateServerPlayerCount(g_ServerAuthenticationManager->m_additionalPlayerData.size()); } + // Log UID + spdlog::info("In CBaseClient__ActivatePlayerHook, activating UID \"{}\"", (char*)self + 0xF500); CBaseClient__ActivatePlayer(self); } -- cgit v1.2.3