From ff1b1ae7b0a5e36de8e21a8ead058e3c5d4505e2 Mon Sep 17 00:00:00 2001 From: furo Date: Wed, 3 Apr 2024 00:24:24 +0200 Subject: [PATCH] Specify that `ec_password` is required to be set for econ to be enabled --- src/engine/shared/config_variables.h | 2 +- src/engine/shared/econ.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index adaf48860..c06d09a35 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -405,7 +405,7 @@ MACRO_CONFIG_INT(SvSkillLevel, sv_skill_level, 1, SERVERINFO_LEVEL_MIN, SERVERIN MACRO_CONFIG_STR(EcBindaddr, ec_bindaddr, 128, "localhost", CFGFLAG_ECON, "Address to bind the external console to. Anything but 'localhost' is dangerous") MACRO_CONFIG_INT(EcPort, ec_port, 0, 0, 65535, CFGFLAG_ECON, "Port to use for the external console") -MACRO_CONFIG_STR(EcPassword, ec_password, 128, "", CFGFLAG_ECON, "External console password") +MACRO_CONFIG_STR(EcPassword, ec_password, 128, "", CFGFLAG_ECON, "External console password. This option is required to be set for econ to be enabled.") MACRO_CONFIG_INT(EcBantime, ec_bantime, 0, 0, 1440, CFGFLAG_ECON, "The time a client gets banned if econ authentication fails. 0 just closes the connection") MACRO_CONFIG_INT(EcAuthTimeout, ec_auth_timeout, 30, 1, 120, CFGFLAG_ECON, "Time in seconds before the the econ authentication times out") MACRO_CONFIG_INT(EcOutputLevel, ec_output_level, 0, -3, 2, CFGFLAG_ECON, "Adjusts the amount of information in the external console (-3 = none, -2 = error only, -1 = warn, 0 = info, 1 = debug, 2 = trace)") diff --git a/src/engine/shared/econ.cpp b/src/engine/shared/econ.cpp index 782e4b64b..d0b726aa0 100644 --- a/src/engine/shared/econ.cpp +++ b/src/engine/shared/econ.cpp @@ -60,9 +60,15 @@ void CEcon::Init(CConfig *pConfig, IConsole *pConsole, CNetBan *pNetBan) m_Ready = false; m_UserClientId = -1; - if(g_Config.m_EcPort == 0 || g_Config.m_EcPassword[0] == 0) + if(g_Config.m_EcPort == 0) return; + if(g_Config.m_EcPassword[0] == 0) + { + Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "econ", "ec_password is required to be set for econ to be enabled."); + return; + } + NETADDR BindAddr; if(g_Config.m_EcBindaddr[0] == '\0') {