mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 05:58:19 +00:00
Merge pull request #9007 from Learath2/pr_olddomain
Ban compromised old versions
This commit is contained in:
commit
be74009fbf
|
@ -1434,6 +1434,11 @@ bool CServer::CheckReservedSlotAuth(int ClientId, const char *pPassword)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CServer::DropOldClient(int ClientId)
|
||||
{
|
||||
m_NetServer.Drop(ClientId, "This version of the client is compromised. Do not click the update button. ddnet.org/olddomain");
|
||||
}
|
||||
|
||||
void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
||||
{
|
||||
int ClientId = pPacket->m_ClientId;
|
||||
|
@ -1495,6 +1500,13 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(DDNetVersion < VERSION_DDNET_NEW_DOMAIN)
|
||||
{
|
||||
DropOldClient(ClientId);
|
||||
return;
|
||||
}
|
||||
|
||||
m_aClients[ClientId].m_ConnectionId = *pConnectionId;
|
||||
m_aClients[ClientId].m_DDNetVersion = DDNetVersion;
|
||||
str_copy(m_aClients[ClientId].m_aDDNetVersionStr, pDDNetVersionStr);
|
||||
|
@ -1512,6 +1524,13 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!m_aClients[ClientId].m_GotDDNetVersionPacket)
|
||||
{
|
||||
DropOldClient(ClientId);
|
||||
return;
|
||||
}
|
||||
|
||||
if(str_comp(pVersion, GameServer()->NetVersion()) != 0 && str_comp(pVersion, "0.7 802f1be60a05665f") != 0)
|
||||
{
|
||||
// wrong version
|
||||
|
|
|
@ -337,6 +337,7 @@ public:
|
|||
void UpdateClientRconCommands();
|
||||
|
||||
bool CheckReservedSlotAuth(int ClientId, const char *pPassword);
|
||||
void DropOldClient(int ClientId);
|
||||
void ProcessClientPacket(CNetChunk *pPacket);
|
||||
|
||||
class CCache
|
||||
|
|
|
@ -126,6 +126,8 @@ enum
|
|||
VERSION_DDNET_MULTI_LASER = 16040,
|
||||
VERSION_DDNET_ENTITY_NETOBJS = 16200,
|
||||
VERSION_DDNET_REDIRECT = 17020,
|
||||
|
||||
VERSION_DDNET_NEW_DOMAIN = 16040,
|
||||
};
|
||||
|
||||
typedef std::bitset<MAX_CLIENTS> CClientMask;
|
||||
|
|
Loading…
Reference in a new issue