diff options
author | Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> | 2022-06-27 15:06:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 15:06:24 +0200 |
commit | be37827d471f2f7c6f1ea88edcf97eda539fd72f (patch) | |
tree | d15ccf95a74ed42ba12639368dc090fefd1f7db7 /NorthstarDedicatedTest/serverauthentication.cpp | |
parent | 50bb5f3cdd9141dfb48c0d3cb46db185c9c0f708 (diff) | |
parent | 5311105b5ca02ba769d9e01e9ff9d6cc85b82d4a (diff) | |
download | NorthstarLauncher-be37827d471f2f7c6f1ea88edcf97eda539fd72f.tar.gz NorthstarLauncher-be37827d471f2f7c6f1ea88edcf97eda539fd72f.zip |
Merge branch 'main' into NetCon
Diffstat (limited to 'NorthstarDedicatedTest/serverauthentication.cpp')
-rw-r--r-- | NorthstarDedicatedTest/serverauthentication.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp index 8d7c063b..0672f3c6 100644 --- a/NorthstarDedicatedTest/serverauthentication.cpp +++ b/NorthstarDedicatedTest/serverauthentication.cpp @@ -16,6 +16,9 @@ const char* AUTHSERVER_VERIFY_STRING = "I am a northstar server!"; +// This convar defines whether to log all client commands +ConVar* Cvar_ns_should_log_all_clientcommands; + // hook types typedef void* (*CBaseServer__ConnectClientType)( @@ -243,7 +246,8 @@ bool ServerAuthenticationManager::AuthenticatePlayer(void* player, int64_t uid, // set persistent data as ready, we use 0x3 internally to mark the client as using local persistence *((char*)player + 0x4a0) = (char)0x3; - if (!CVar_ns_auth_allow_insecure->GetBool()) // no auth data and insecure connections aren't allowed, so dc the client + // no auth data and insecure connections aren't allowed, so dc the client + if (!CVar_ns_auth_allow_insecure->GetBool() && strncmp(GetCurrentPlaylistName(), "solo", 5) != 0) return false; // insecure connections are allowed, try reading from disk @@ -477,6 +481,12 @@ CCommand__TokenizeType CCommand__Tokenize; char CGameClient__ExecuteStringCommandHook(void* self, uint32_t unknown, const char* pCommandString) { + // Only log clientcommands if the convar `ns_should_log_all_clientcommands` equals 1 + if (Cvar_ns_should_log_all_clientcommands->GetBool()) + { + spdlog::info("{} (UID: {}) executed command: \"{}\"", (char*)self + 0x16, (char*)self + 0xF500, pCommandString); + } + if (CVar_sv_quota_stringcmdspersecond->GetInt() != -1) { // note: this isn't super perfect, legit clients can trigger it in lobby, mostly good enough tho imo @@ -669,6 +679,8 @@ void InitialiseServerAuthentication(HMODULE baseAddress) "100", FCVAR_GAMEDLL, "Netchannel processing is limited to so many milliseconds, abort connection if exceeding budget"); + Cvar_ns_should_log_all_clientcommands = + new ConVar("ns_should_log_all_clientcommands", "0", FCVAR_NONE, "Whether to log all clientcommands"); Cvar_ns_player_auth_port = new ConVar("ns_player_auth_port", "8081", FCVAR_GAMEDLL, ""); Cvar_sv_querylimit_per_sec = new ConVar("sv_querylimit_per_sec", "15", FCVAR_GAMEDLL, ""); Cvar_sv_max_chat_messages_per_sec = new ConVar("sv_max_chat_messages_per_sec", "5", FCVAR_GAMEDLL, ""); |