From 2c4a25a0f2b28ba278a46c1755637374f90e9b35 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Wed, 4 Jan 2023 00:36:51 +0000 Subject: generally cleanup authentication code and fix client state issues with rejection from local server (#360) * generally cleanup authentication code and fix client state issues with rejection from local server * fix formatting * fix formatting * use client-provided uid for logging disconnect failure as it won't be copied to player if authentication fails * support loading savegame and use more reliable method for fixing client rejection issues * oops forgot to add rejectconnectionfixes.cpp * fixup formatting --- NorthstarDLL/server/auth/serverauthentication.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'NorthstarDLL/server/auth/serverauthentication.h') diff --git a/NorthstarDLL/server/auth/serverauthentication.h b/NorthstarDLL/server/auth/serverauthentication.h index 4ffbbfd6..2ca07a8a 100644 --- a/NorthstarDLL/server/auth/serverauthentication.h +++ b/NorthstarDLL/server/auth/serverauthentication.h @@ -33,27 +33,33 @@ class ServerAuthenticationManager public: ConVar* Cvar_ns_player_auth_port; ConVar* Cvar_ns_erase_auth_info; - ConVar* CVar_ns_auth_allow_insecure; - ConVar* CVar_ns_auth_allow_insecure_write; + ConVar* Cvar_ns_auth_allow_insecure; + ConVar* Cvar_ns_auth_allow_insecure_write; std::mutex m_AuthDataMutex; std::unordered_map m_RemoteAuthenticationData; std::unordered_map m_PlayerAuthenticationData; + bool m_bAllowDuplicateAccounts = false; bool m_bRunningPlayerAuthThread = false; bool m_bNeedLocalAuthForNewgame = false; bool m_bForceResetLocalPlayerPersistence = false; + bool m_bStartingLocalSPGame = false; public: void StartPlayerAuthServer(); void StopPlayerAuthServer(); - void AddPlayer(R2::CBaseClient* player, const char* pToken); - void RemovePlayer(R2::CBaseClient* player); - bool CheckDuplicateAccounts(R2::CBaseClient* player); - bool AuthenticatePlayer(R2::CBaseClient* player, uint64_t uid, char* authToken); - bool VerifyPlayerName(const char* authToken, const char* name); - bool RemovePlayerAuthData(R2::CBaseClient* player); - void WritePersistentData(R2::CBaseClient* player); + + void AddPlayer(R2::CBaseClient* pPlayer, const char* pAuthToken); + void RemovePlayer(R2::CBaseClient* pPlayer); + + bool VerifyPlayerName(const char* pAuthToken, const char* pName, char pOutVerifiedName[64]); + bool IsDuplicateAccount(R2::CBaseClient* pPlayer, const char* pUid); + bool CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); + + void AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); + bool RemovePlayerAuthData(R2::CBaseClient* pPlayer); + void WritePersistentData(R2::CBaseClient* pPlayer); }; extern ServerAuthenticationManager* g_pServerAuthentication; -- cgit v1.2.3