Revert "better spam protection. Closes #82. Feedback Please"

This reverts commit daac101024.
This commit is contained in:
heinrich5991 2010-10-14 08:42:29 +02:00
parent d5755f8ad2
commit 0cd8390036
5 changed files with 8 additions and 31 deletions

View file

@ -1725,7 +1725,7 @@ void CServer::CheckPass(int ClientId, const char *pPw)
else else
{ {
NETADDR Addr = m_NetServer.ClientAddr(ClientId); 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");
} }
} }
} }

View file

@ -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_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_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(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(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) 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(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(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(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(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) 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(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(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_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) //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 #endif

View file

@ -624,7 +624,7 @@ void CGameContext::OnSetAuthed(int client_id, int Level)
{ {
m_apPlayers[client_id]->m_Authed = Level; m_apPlayers[client_id]->m_Authed = Level;
char buf[11]; 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)) if( !strcmp(m_aVoteCommand,buf))
{ {
m_VoteEnforce = CGameContext::VOTE_ENFORCE_NO; 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(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; 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); 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(); pPlayer->m_Last_Chat = Server()->Tick();
} }
else else
@ -903,7 +887,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
{ {
char aBuf[64] = {0}; char aBuf[64] = {0};
Server()->GetClientIP(KickId, aBuf, sizeof(aBuf)); 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_apPlayers[ClientId]->m_Last_KickVote = time_get();
m_VoteKick = true; m_VoteKick = true;

View file

@ -132,7 +132,7 @@ void CPlayer::OnDisconnect()
str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", m_ClientID, Server()->ClientName(m_ClientID)); str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", m_ClientID, Server()->ClientName(m_ClientID));
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf); GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf);
if(m_Muted > 0) { 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); GameServer()->Console()->ExecuteLine(Cmd, 3, -1);
} }
} }

View file

@ -78,9 +78,6 @@ public:
int64 m_Last_ChangeInfo; int64 m_Last_ChangeInfo;
int64 m_Last_Emote; int64 m_Last_Emote;
int64 m_Last_Kill; int64 m_Last_Kill;
char m_LastMessage1[370];
char m_LastMessage2[370];
int m_SpamCount;
bool m_Invisible; bool m_Invisible;