From 0df35a990cb0dcc8e413415017ba0692a0129e6b Mon Sep 17 00:00:00 2001 From: def Date: Tue, 27 Jan 2015 23:13:47 +0100 Subject: [PATCH] Remove spoof protection, interacts badly with HTTP download --- src/engine/server/server.cpp | 72 +--------------------------- src/engine/server/server.h | 6 --- src/engine/shared/config_variables.h | 1 - 3 files changed, 2 insertions(+), 77 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index a59cf0dfc..4469562b1 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -745,8 +745,6 @@ int CServer::NewClientCallback(int ClientID, void *pUser) pThis->m_aClients[ClientID].m_LastAuthed = AUTHED_NO; pThis->m_aClients[ClientID].m_AuthTries = 0; pThis->m_aClients[ClientID].m_pRconCmdToSend = 0; - pThis->m_aClients[ClientID].m_NonceCount = 0; - pThis->m_aClients[ClientID].m_LastNonceCount = 0; pThis->m_aClients[ClientID].m_Traffic = 0; pThis->m_aClients[ClientID].m_TrafficSince = 0; memset(&pThis->m_aClients[ClientID].m_Addr, 0, sizeof(NETADDR)); @@ -937,64 +935,12 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) SpoofProtectedAlready = true; } - if(g_Config.m_SvSpoofProtection && !SpoofProtectedAlready) - { - //set nonce - m_aClients[ClientID].m_Nonce = rand()%5+5;//5-9 - m_aClients[ClientID].m_LastNonceCount = Tick(); - m_aClients[ClientID].m_State = CClient::STATE_SPOOFCHECK; - - CMsgPacker Msg(NETMSG_MAP_CHANGE); - Msg.AddString("", 0);//mapname - Msg.AddInt(0);//crc - Msg.AddInt(0);//size - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true); - } - else - { - m_aClients[ClientID].m_State = CClient::STATE_CONNECTING; - SendMap(ClientID); - } + m_aClients[ClientID].m_State = CClient::STATE_CONNECTING; + SendMap(ClientID); } } else if(Msg == NETMSG_REQUEST_MAP_DATA) { - if(g_Config.m_SvSpoofProtection) - { - if(m_aClients[ClientID].m_State == CClient::STATE_SPOOFCHECK) - { - int Chunk = Unpacker.GetInt(); - if(m_aClients[ClientID].m_NonceCount != Chunk || m_aClients[ClientID].m_LastNonceCount+TickSpeed() < Tick())//wrong number sent - m_NetServer.Drop(ClientID, "Kicked by spoofprotection. Please try again!"); - - m_aClients[ClientID].m_LastNonceCount = Tick(); - - if(m_aClients[ClientID].m_NonceCount != m_aClients[ClientID].m_Nonce) - { - CMsgPacker Msg(NETMSG_MAP_DATA); - Msg.AddInt(0);//last - Msg.AddInt(0);//crc - Msg.AddInt(m_aClients[ClientID].m_NonceCount);//chunk - Msg.AddInt(1);//size - Msg.AddRaw("a", 1);//data - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true); - m_aClients[ClientID].m_NonceCount++; - } - else//done. continue as usual - { - m_aClients[ClientID].m_State = CClient::STATE_POSTSPOOFCHECK; - dbg_msg(0, "done"); - } - - return; - } - else if(m_aClients[ClientID].m_State == CClient::STATE_POSTSPOOFCHECK) - {//Too many noncenumbers sent - m_NetServer.Drop(ClientID, "Kicked by spoofprotection. Please try again!"); - return; - } - } - if(m_aClients[ClientID].m_State < CClient::STATE_CONNECTING) return; // no map w/o password, sorry guys @@ -1466,20 +1412,6 @@ void CServer::PumpNetwork() m_ServerBan.Update(); m_Econ.Update(); - - if(g_Config.m_SvSpoofProtection) - { - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(m_aClients[i].m_State == CClient::STATE_POSTSPOOFCHECK) - //if(m_aClients[i].m_State == CClient::STATE_POSTSPOOFCHECK && - // m_aClients[i].m_LastNonceCount+TickSpeed() < Tick()) - { // when the time is over: continue joining process - m_aClients[i].m_State = CClient::STATE_CONNECTING; - SendMap(i); - } - } - } } char *CServer::GetMapName() diff --git a/src/engine/server/server.h b/src/engine/server/server.h index 0f8be1ca8..5e3cff296 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -98,8 +98,6 @@ public: STATE_EMPTY = 0, STATE_AUTH, STATE_CONNECTING, - STATE_SPOOFCHECK, - STATE_POSTSPOOFCHECK, STATE_READY, STATE_INGAME, @@ -139,10 +137,6 @@ public: int m_LastAuthed; int m_AuthTries; - int m_Nonce; // number to reach - int m_NonceCount; // current num - int64 m_LastNonceCount; - const IConsole::CCommandInfo *m_pRconCmdToSend; void Reset(); diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index cf0fd2dfe..8407cc940 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -320,7 +320,6 @@ MACRO_CONFIG_INT(SvSpamMuteDuration, sv_spam_mute_duration, 60, 0, 3600 , CFGFLA MACRO_CONFIG_INT(SvEvents, sv_events, 1, 0, 1, CFGFLAG_SERVER, "Enable triggering of server events, like the happy eyeemotes on some holidays.") MACRO_CONFIG_INT(SvRankCheats, sv_rank_cheats, 0, 0, 1, CFGFLAG_SERVER, "Enable ranks after cheats have been used (file based server only)") -MACRO_CONFIG_INT(SvSpoofProtection, sv_spoof_protection, 0, 0, 1, CFGFLAG_SERVER, "Enable spoof protection") MACRO_CONFIG_INT(SvShutdownWhenEmpty, sv_shutdown_when_empty, 0, 0, 1, CFGFLAG_SERVER, "Shutdown server as soon as noone is on it anymore") MACRO_CONFIG_INT(SvKillProtection, sv_kill_protection, 20, 0, 9999, CFGFLAG_SERVER, "0 - Disable, 1-9999 minutes") MACRO_CONFIG_INT(SvSoloServer, sv_solo_server, 0, 0, 1, CFGFLAG_SERVER, "Set server to solo mode (no player interactions, has to be set before loading the map)")