diff options
author | Barnaby <22575741+barnabwhy@users.noreply.github.com> | 2022-05-13 00:49:43 +0100 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-05-13 02:05:43 +0200 |
commit | 1fb68a876354835e2db5c005b96f639c0bf518bf (patch) | |
tree | da08a895456f9678bf3bb5c5c8d46ec704581792 /NorthstarDedicatedTest/serverauthentication.cpp | |
parent | 04ac23d2040c807a4e90038ca3a30d461006bf99 (diff) | |
download | NorthstarLauncher-1fb68a876354835e2db5c005b96f639c0bf518bf.tar.gz NorthstarLauncher-1fb68a876354835e2db5c005b96f639c0bf518bf.zip |
Compare uid from connect on activate (#175)
* Compare UID from connect on activate
* only set uid on first time
i think
Diffstat (limited to 'NorthstarDedicatedTest/serverauthentication.cpp')
-rw-r--r-- | NorthstarDedicatedTest/serverauthentication.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp index e89c4e92..e50b9357 100644 --- a/NorthstarDedicatedTest/serverauthentication.cpp +++ b/NorthstarDedicatedTest/serverauthentication.cpp @@ -356,6 +356,8 @@ bool CBaseClient__ConnectHook(void* self, char* name, __int64 netchan_ptr_arg, c additionalData.usingLocalPdata = *((char*)self + 0x4a0) == (char)0x3; g_ServerAuthenticationManager->m_additionalPlayerData.insert(std::make_pair(self, additionalData)); + + g_ServerAuthenticationManager->m_additionalPlayerData[self].uid = nextPlayerUid; } return ret; @@ -363,6 +365,21 @@ bool CBaseClient__ConnectHook(void* self, char* name, __int64 netchan_ptr_arg, c void CBaseClient__ActivatePlayerHook(void* self) { + bool uidMatches = false; + if (g_ServerAuthenticationManager->m_additionalPlayerData.count(self)) + { + std::string strUid = std::to_string(g_ServerAuthenticationManager->m_additionalPlayerData[self].uid); + if (!strcmp(strUid.c_str(), (char*)self + 0xF500)) // connecting client's uid is the same as auth's uid + { + uidMatches = true; + } + } + if (!uidMatches) + { + CBaseClient__Disconnect(self, 1, "Authentication Failed"); + return; + } + // if we're authed, write our persistent data // RemovePlayerAuthData returns true if it removed successfully, i.e. on first call only, and we only want to write on >= second call // (since this func is called on map loads) |