mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fixed rcon auth tries check
Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
parent
c7f897a144
commit
f4082adf50
|
@ -981,6 +981,23 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
|||
SendRconLine(ClientId, buf);
|
||||
dbg_msg("server", "'%s' ClientId=%d authed with Level=%d", ClientName(ClientId), ClientId, level);
|
||||
}
|
||||
else if(g_Config.m_SvRconMaxTries)
|
||||
{
|
||||
m_aClients[ClientId].m_AuthTries++;
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "Wrong password %d/%d.", m_aClients[ClientId].m_AuthTries, g_Config.m_SvRconMaxTries);
|
||||
SendRconLine(ClientId, aBuf);
|
||||
if(m_aClients[ClientId].m_AuthTries >= g_Config.m_SvRconMaxTries)
|
||||
{
|
||||
if(!g_Config.m_SvRconBantime)
|
||||
m_NetServer.Drop(ClientId, "Too many remote console authentication tries");
|
||||
else
|
||||
{
|
||||
NETADDR Addr = m_NetServer.ClientAddr(ClientId);
|
||||
BanAdd(Addr, g_Config.m_SvRconBantime,"Too many remote console authentication tries");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*else if(str_comp(pPw, g_Config.m_SvRconPassword) == 0)
|
||||
|
@ -995,23 +1012,6 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
|||
str_format(aBuf, sizeof(aBuf), "ClientId=%d authed", ClientId);
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
|
||||
}*/
|
||||
else if(g_Config.m_SvRconMaxTries)
|
||||
{
|
||||
m_aClients[ClientId].m_AuthTries++;
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "Wrong password %d/%d.", m_aClients[ClientId].m_AuthTries, g_Config.m_SvRconMaxTries);
|
||||
SendRconLine(ClientId, aBuf);
|
||||
if(m_aClients[ClientId].m_AuthTries >= g_Config.m_SvRconMaxTries)
|
||||
{
|
||||
if(!g_Config.m_SvRconBantime)
|
||||
m_NetServer.Drop(ClientId, "Too many remote console authentication tries");
|
||||
else
|
||||
{
|
||||
NETADDR Addr = m_NetServer.ClientAddr(ClientId);
|
||||
BanAdd(Addr, g_Config.m_SvRconBantime,"Too many remote console authentication tries");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendRconLine(ClientId, "Wrong password.");
|
||||
|
|
|
@ -33,7 +33,7 @@ MACRO_CONFIG_STR(SvRconPasswordHelper, sv_helper_pass, 32, "", CFGFLAG_SERVER, "
|
|||
//MACRO_CONFIG_INT(SvRconTries, sv_rcon_tries, 5, 0, 100, CFGFLAG_SERVER, "How many password tries are tolerated before the trying client gets banned", 3)
|
||||
//MACRO_CONFIG_INT(SvRconTriesBantime, sv_rcon_tries_bantime, 300, 0, 9999, CFGFLAG_SERVER, "How much time in seconds a client gets banned for too many wrong rcon tries", 3)
|
||||
MACRO_CONFIG_INT(SvRconMaxTries, sv_rcon_max_tries, 3, 0, 100, CFGFLAG_SERVER, "Maximum number of tries for remote console authentication", 3)
|
||||
MACRO_CONFIG_INT(SvRconBantime, sv_rcon_bantime, 5, 0, 1440, CFGFLAG_SERVER, "The time a client gets banned if remote console authentication fails. 0 makes it just use kick", 3)
|
||||
MACRO_CONFIG_INT(SvRconBantime, sv_rcon_bantime, 300, 0, 9999, CFGFLAG_SERVER, "The time a client gets banned if remote console authentication fails. 0 makes it just use kick", 3)
|
||||
MACRO_CONFIG_INT(SvNetmsgLimit, sv_netmsg_limit, 0, 0, 100, CFGFLAG_SERVER, "How many unauthorised spam tries are tolerated before the trying client will be ban", 3)
|
||||
MACRO_CONFIG_INT(SvNetmsgBanTime, sv_netmsg_bantime, 300, 0, 9999, CFGFLAG_SERVER, "How much time in seconds a client gets banned for too many unauthorised rcon commands", 3)
|
||||
|
||||
|
|
Loading…
Reference in a new issue