2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-17 09:07:54 +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
if (sv_rcon_condebug.value > 0.0f)
#endif
Con_Printf("Banning %s for rcon hacking attempts\n", NET_AdrToString(net_from)); 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");
@ -3457,7 +3450,6 @@ void SV_Rcon(netadr_t *net_from_)
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

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
#ifdef REHLDS_FIXES
if (sv_redirected == RD_NONE || sv_rcon_condebug.value > 0.0f)
#endif
{
Sys_Printf("%s", Dest); 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)