2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-17 00:58:18 +03:00

Reworked sv_rcon_condebug (#214)

This commit is contained in:
s1lentq 2016-06-13 17:42:49 +06:00 committed by theAsmodai
parent 762923fbc3
commit b6630824a3
2 changed files with 14 additions and 16 deletions

View File

@ -3387,11 +3387,7 @@ int SV_Rcon_Validate(void)
if (SV_CheckRconFailure(&net_from)) if (SV_CheckRconFailure(&net_from))
{ {
#ifdef REHLDS_FIXES Con_Printf("Banning %s for rcon hacking attempts\n", NET_AdrToString(net_from));
if (sv_rcon_condebug.value > 0.0f)
#endif
Con_Printf("Banning %s for rcon hacking attempts\n", NET_AdrToString(net_from));
Cbuf_AddText(va("addip %i %s\n", (int)sv_rcon_banpenalty.value, NET_BaseAdrToString(net_from))); Cbuf_AddText(va("addip %i %s\n", (int)sv_rcon_banpenalty.value, NET_BaseAdrToString(net_from)));
return 3; return 3;
} }
@ -3421,13 +3417,9 @@ void SV_Rcon(netadr_t *net_from_)
Q_memcpy(remaining, &net_message.data[Q_strlen("rcon")], len); Q_memcpy(remaining, &net_message.data[Q_strlen("rcon")], len);
remaining[len] = 0; remaining[len] = 0;
#ifndef REHLDS_FIXES #ifdef REHLDS_FIXES
bool bConDebug = true; if (sv_rcon_condebug.value > 0.0f)
#else
bool bConDebug = (sv_rcon_condebug.value > 0.0f);
#endif #endif
if (bConDebug)
{ {
if (invalid) if (invalid)
{ {
@ -3442,7 +3434,8 @@ void SV_Rcon(netadr_t *net_from_)
} }
SV_BeginRedirect(RD_PACKET, net_from_); SV_BeginRedirect(RD_PACKET, net_from_);
if (bConDebug && invalid)
if (invalid)
{ {
if (invalid == 2) if (invalid == 2)
Con_Printf("Bad rcon_password.\n"); Con_Printf("Bad rcon_password.\n");
@ -3450,15 +3443,14 @@ void SV_Rcon(netadr_t *net_from_)
Con_Printf("Bad rcon_password.\nNo password set for this server.\n"); Con_Printf("Bad rcon_password.\nNo password set for this server.\n");
else else
Con_Printf("Bad rcon_password.\n"); Con_Printf("Bad rcon_password.\n");
SV_EndRedirect(); SV_EndRedirect();
return; return;
} }
char *data = COM_Parse(COM_Parse(COM_Parse(remaining))); char *data = COM_Parse(COM_Parse(COM_Parse(remaining)));
if (!data) if (!data)
{ {
if (bConDebug) Con_Printf("Empty rcon\n");
Con_Printf("Empty rcon\n");
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
//missing SV_EndRedirect() //missing SV_EndRedirect()

View File

@ -1341,7 +1341,13 @@ void EXT_FUNC Con_Printf(const char *fmt, ...)
FR_Log("REHLDS_CON", Dest); FR_Log("REHLDS_CON", Dest);
#endif #endif
Sys_Printf("%s", Dest); #ifdef REHLDS_FIXES
if (sv_redirected == RD_NONE || sv_rcon_condebug.value > 0.0f)
#endif
{
Sys_Printf("%s", Dest);
}
if (sv_redirected) if (sv_redirected)
{ {
if ((Q_strlen(outputbuf) + Q_strlen(Dest)) > sizeof(outputbuf) - 1) if ((Q_strlen(outputbuf) + Q_strlen(Dest)) > sizeof(outputbuf) - 1)