diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-02 03:52:39 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-02 03:52:39 +0000 |
commit | ed0f27914710b75a246645380e167dad071adaa7 (patch) | |
tree | 5e5d14ece2ba07f5fe480cfae222a74a8a1a1746 /NorthstarDedicatedTest/serverauthentication.cpp | |
parent | 89d16c9a8a65e3b4872947c58df1ffd97fc63a4b (diff) | |
download | NorthstarLauncher-ed0f27914710b75a246645380e167dad071adaa7.tar.gz NorthstarLauncher-ed0f27914710b75a246645380e167dad071adaa7.zip |
add disconnects to ban system
Diffstat (limited to 'NorthstarDedicatedTest/serverauthentication.cpp')
-rw-r--r-- | NorthstarDedicatedTest/serverauthentication.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp index 0fdb8664..e0ac5d57 100644 --- a/NorthstarDedicatedTest/serverauthentication.cpp +++ b/NorthstarDedicatedTest/serverauthentication.cpp @@ -23,7 +23,6 @@ CBaseClient__ConnectType CBaseClient__Connect; typedef void(*CBaseClient__ActivatePlayerType)(void* self); CBaseClient__ActivatePlayerType CBaseClient__ActivatePlayer; -typedef void(*CBaseClient__DisconnectType)(void* self, uint32_t unknownButAlways1, const char* reason, ...); CBaseClient__DisconnectType CBaseClient__Disconnect; typedef char(*CGameClient__ExecuteStringCommandType)(void* self, uint32_t unknown, const char* pCommandString); @@ -117,9 +116,6 @@ void ServerAuthenticationManager::StopPlayerAuthServer() bool ServerAuthenticationManager::AuthenticatePlayer(void* player, int64_t uid, char* authToken) { - if (!g_ServerBanSystem->IsUIDAllowed(uid)) - return false; - std::string strUid = std::to_string(uid); std::lock_guard<std::mutex> guard(m_authDataMutex); @@ -240,6 +236,13 @@ char CBaseClient__ConnectHook(void* self, char* name, __int64 netchan_ptr_arg, c // try to auth player, dc if it fails // we connect irregardless of auth, because returning bad from this function can fuck client state p bad char ret = CBaseClient__Connect(self, name, netchan_ptr_arg, b_fake_player_arg, a5, Buffer, a7); + + if (!g_ServerBanSystem->IsUIDAllowed(nextPlayerUid)) + { + CBaseClient__Disconnect(self, 1, "Banned from server"); + return ret; + } + if (strlen(name) >= 64) // fix for name overflow bug CBaseClient__Disconnect(self, 1, "Invalid name"); else if (!g_ServerAuthenticationManager->AuthenticatePlayer(self, nextPlayerUid, nextPlayerToken) && g_MasterServerManager->m_bRequireClientAuth) |