From 0cd8390036f452d16e721e4f917d2ba358ee83ed Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Thu, 14 Oct 2010 08:42:29 +0200 Subject: [PATCH] Revert "better spam protection. Closes #82. Feedback Please" This reverts commit daac10102462b175305116e4e3ac8557e79ff12c. --- src/engine/server/server.cpp | 2 +- src/engine/shared/config_variables.h | 8 ++------ src/game/server/gamecontext.cpp | 24 ++++-------------------- src/game/server/player.cpp | 2 +- src/game/server/player.h | 3 --- 5 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 8c816ac78..41d99d2a0 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1725,7 +1725,7 @@ void CServer::CheckPass(int ClientId, const char *pPw) else { NETADDR Addr = m_NetServer.ClientAddr(ClientId); - BanAdd(Addr, g_Config.m_SvRconBantime*60, "Too many remote console authentication tries"); + BanAdd(Addr, g_Config.m_SvRconBantime, "Too many remote console authentication tries"); } } } diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index f43bea1cc..1d0091ab9 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -72,7 +72,7 @@ MACRO_CONFIG_INT(SvHighBandwidth, sv_high_bandwidth, 0, 0, 1, CFGFLAG_SERVER, "U MACRO_CONFIG_INT(SvRegister, sv_register, 1, 0, 1, CFGFLAG_SERVER, "Register server with master server for public listing", 3) /*MACRO_CONFIG_STR(SvRconPassword, sv_rcon_password, 32, "", CFGFLAG_SERVER, "Remote console password")*/ 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(Debug, debug, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Debug mode", 3) MACRO_CONFIG_INT(DbgStress, dbg_stress, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress systems", 3) @@ -107,7 +107,7 @@ MACRO_CONFIG_INT(SvPauseTime, sv_pause_time, 0, 0, 1, CFGFLAG_SERVER, "Whether ' MACRO_CONFIG_INT(SvEmotionalTees, sv_emotional_tees, 1, 0, 1, CFGFLAG_SERVER, "Whether eye change of tees is enabled or not", 3) MACRO_CONFIG_INT(SvEmoticonDelay, sv_emoticon_delay, 3, 0, 9999, CFGFLAG_SERVER, "The time in seconds between over-head emoticons", 3) -MACRO_CONFIG_INT(SvChatDelay, sv_chat_delay, 0, 0, 9999, CFGFLAG_SERVER, "The time in seconds between chat messages", 3) +MACRO_CONFIG_INT(SvChatDelay, sv_chat_delay, 1, 0, 9999, CFGFLAG_SERVER, "The time in seconds between chat messages", 3) MACRO_CONFIG_INT(SvTeamChangeDelay, sv_team_change_delay, 3, 0, 9999, CFGFLAG_SERVER, "The time in seconds between team changes (spectator/in game)", 3) MACRO_CONFIG_INT(SvInfoChangeDelay, sv_info_change_delay, 5, 0, 9999, CFGFLAG_SERVER, "The time in seconds between info changes (name/skin/color)", 3) MACRO_CONFIG_INT(SvVoteMapTimeDelay, sv_vote_map_delay,0,0,9999,CFGFLAG_SERVER, "The minimum time in seconds between map votes", 3) @@ -141,9 +141,5 @@ MACRO_CONFIG_STR(SvRulesLine7, sv_rules_line7, 40, "", CFGFLAG_SERVER, "Rules li MACRO_CONFIG_STR(SvRulesLine8, sv_rules_line8, 40, "", CFGFLAG_SERVER, "Rules line 8", 4) MACRO_CONFIG_STR(SvRulesLine9, sv_rules_line9, 40, "", CFGFLAG_SERVER, "Rules line 9", 4) MACRO_CONFIG_STR(SvRulesLine10, sv_rules_line10, 40, "", CFGFLAG_SERVER, "Rules line 10", 4) - -MACRO_CONFIG_INT(SvChatSpamMuteTime, sv_chat_spam_mutetime, 1, 0, 1440, CFGFLAG_SERVER, "Time in minutes to mute the spammer", 3) -MACRO_CONFIG_INT(SvChatSpamCount, sv_chat_spam_count, 4, 0, 20, CFGFLAG_SERVER, "Number of spam tries from the same user before muting him", 3) -MACRO_CONFIG_INT(SvChatSpamProtection, sv_chat_spam_protection, 1, 0, 1, CFGFLAG_SERVER, "Alternate chat protection system active or not", 3) //MACRO_CONFIG_INT(SvReconnectTime, sv_reconnect_time,5,0,9999,CFGFLAG_SERVER, "The time in seconds between leaves and joins of clients with the same ip", 3) #endif diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 7b042e813..1dc2fd969 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -624,7 +624,7 @@ void CGameContext::OnSetAuthed(int client_id, int Level) { m_apPlayers[client_id]->m_Authed = Level; char buf[11]; - str_format(buf, sizeof(buf), "ban %d %d", client_id, g_Config.m_SvVoteKickBantime*60); + str_format(buf, sizeof(buf), "ban %d %d", client_id, g_Config.m_SvVoteKickBantime); if( !strcmp(m_aVoteCommand,buf)) { m_VoteEnforce = CGameContext::VOTE_ENFORCE_NO; @@ -726,27 +726,11 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) { if(m_apPlayers[ClientId]->m_Muted == 0) { - if(/*g_Config.m_SvSpamprotection && */pPlayer->m_Last_Chat && pPlayer->m_Last_Chat + Server()->TickSpeed() * g_Config.m_SvChatDelay > Server()->Tick()) + if(/*g_Config.m_SvSpamprotection && */pPlayer->m_Last_Chat && pPlayer->m_Last_Chat + Server()->TickSpeed() + g_Config.m_SvChatDelay > Server()->Tick()) return; - if(g_Config.m_SvChatSpamProtection) - { - if(!str_comp_nocase(pMsg->m_pMessage, pPlayer->m_LastMessage1)) - if(!str_comp_nocase(pPlayer->m_LastMessage1, pPlayer->m_LastMessage2)) - { - pPlayer->m_SpamCount++; - if(pPlayer->m_SpamCount > g_Config.m_SvChatSpamCount) - m_apPlayers[ClientId]->m_Muted = g_Config.m_SvChatSpamMuteTime * 60 * Server()->TickSpeed(); - return; - } - } SendChat(ClientId, Team, pMsg->m_pMessage); - if(g_Config.m_SvChatSpamProtection) - { - str_copy(pPlayer->m_LastMessage2, pPlayer->m_LastMessage1, sizeof(pPlayer->m_LastMessage2)); - str_copy(pPlayer->m_LastMessage1, pMsg->m_pMessage, sizeof(pPlayer->m_LastMessage1)); - pPlayer->m_SpamCount = 0; - } + pPlayer->m_Last_Chat = Server()->Tick(); } else @@ -903,7 +887,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) { char aBuf[64] = {0}; Server()->GetClientIP(KickId, aBuf, sizeof(aBuf)); - str_format(aCmd, sizeof(aCmd), "ban %s %d \"Banned by vote\"", aBuf, g_Config.m_SvVoteKickBantime*60); + str_format(aCmd, sizeof(aCmd), "ban %s %d \"Banned by vote\"", aBuf, g_Config.m_SvVoteKickBantime); } m_apPlayers[ClientId]->m_Last_KickVote = time_get(); m_VoteKick = true; diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 867358b9f..1c09a4833 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -132,7 +132,7 @@ void CPlayer::OnDisconnect() str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", m_ClientID, Server()->ClientName(m_ClientID)); GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf); if(m_Muted > 0) { - str_format(Cmd, sizeof(Cmd), "ban %d %d '%s'", m_ClientID, m_Muted/Server()->TickSpeed()/60, "ppc"); + str_format(Cmd, sizeof(Cmd), "ban %d %d '%s'", m_ClientID, m_Muted/Server()->TickSpeed(), "ppc"); GameServer()->Console()->ExecuteLine(Cmd, 3, -1); } } diff --git a/src/game/server/player.h b/src/game/server/player.h index 22effb680..41f3de569 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -78,9 +78,6 @@ public: int64 m_Last_ChangeInfo; int64 m_Last_Emote; int64 m_Last_Kill; - char m_LastMessage1[370]; - char m_LastMessage2[370]; - int m_SpamCount; bool m_Invisible;