aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKawe Mazidjatari <48657826+Mauler125@users.noreply.github.com>2022-07-10 12:12:55 +0200
committerKawe Mazidjatari <48657826+Mauler125@users.noreply.github.com>2022-07-10 12:12:55 +0200
commit388b76eca0419a0d1fb691c57e974ad604955dad (patch)
tree0a14289000610d9c31c53f77aac6eaeaee936605
parentbe37827d471f2f7c6f1ea88edcf97eda539fd72f (diff)
downloadNorthstarLauncher-388b76eca0419a0d1fb691c57e974ad604955dad.tar.gz
NorthstarLauncher-388b76eca0419a0d1fb691c57e974ad604955dad.zip
Allow auth with RCON using 3rd argument from CCommand.
'rcon PASS' will use the 'rcon_password' convar as password to auth with the server. 'rcon PASS yourpassword' will use the third argument from CCommand to auth with the server.
-rw-r--r--NorthstarDedicatedTest/rcon_shared.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/NorthstarDedicatedTest/rcon_shared.cpp b/NorthstarDedicatedTest/rcon_shared.cpp
index 86892ea8..c4dc4c6c 100644
--- a/NorthstarDedicatedTest/rcon_shared.cpp
+++ b/NorthstarDedicatedTest/rcon_shared.cpp
@@ -32,7 +32,7 @@ void _RCON_CmdQuery_f(const CCommand& args)
if (args.ArgC() < 2)
{
- if (g_pRConClient->IsInitialized() && !g_pRConClient->IsConnected() && strlen(CVar_rcon_password->GetString()) > 0)
+ if (g_pRConClient->IsInitialized() && !g_pRConClient->IsConnected())
{
g_pRConClient->Connect();
}
@@ -48,8 +48,15 @@ void _RCON_CmdQuery_f(const CCommand& args)
{
if (strcmp(args.Arg(1), "PASS") == 0) // Auth with RCON server using rcon_password ConVar value.
{
- std::string svCmdQuery =
- g_pRConClient->Serialize(CVar_rcon_password->GetString(), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
+ std::string svCmdQuery;
+ if (args.ArgC() > 2)
+ {
+ svCmdQuery = g_pRConClient->Serialize(args.Arg(2), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
+ }
+ else // Use 'rcon_password' ConVar as password.
+ {
+ svCmdQuery = g_pRConClient->Serialize(CVar_rcon_password->GetString(), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
+ }
g_pRConClient->Send(svCmdQuery);
return;
}