mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Remove spoof protection, interacts badly with HTTP download
This commit is contained in:
parent
aaf8311304
commit
0df35a990c
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)")
|
||||
|
|
Loading…
Reference in a new issue