Only apply DNSBL bans once when player joins

Only ban DNSBL blacklisted players once when joining immediately after the DNSBL result is available, to prevent current players from having their runs ended when the `sv_dnsbl_ban` setting is enabled.

Note that enabling `sv_dnsbl` and `sv_dnsbl_ban` at the same time will still cause the players to be banned immediately. To prevent this, first enable `sv_dnsbl` for at least one tick, then enable `sv_dnsbl_ban`.

Closes #2640.
This commit is contained in:
Robert Müller 2024-07-23 14:12:46 +02:00
parent b7e1af4bbe
commit 7f2908d822

View file

@ -2890,12 +2890,12 @@ int CServer::Run()
str_format(aBuf, sizeof(aBuf), "ClientId=%d addr=<{%s}> secure=%s blacklisted", ClientId, aAddrStr, m_NetServer.HasSecurityToken(ClientId) ? "yes" : "no"); str_format(aBuf, sizeof(aBuf), "ClientId=%d addr=<{%s}> secure=%s blacklisted", ClientId, aAddrStr, m_NetServer.HasSecurityToken(ClientId) ? "yes" : "no");
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "dnsbl", aBuf); Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "dnsbl", aBuf);
}
}
if(m_aClients[ClientId].m_DnsblState == CClient::DNSBL_STATE_BLACKLISTED && Config()->m_SvDnsblBan) if(Config()->m_SvDnsblBan)
{ {
m_NetServer.NetBan()->BanAddr(m_NetServer.ClientAddr(ClientId), 60 * 10, Config()->m_SvDnsblBanReason); m_NetServer.NetBan()->BanAddr(m_NetServer.ClientAddr(ClientId), 60 * 10, Config()->m_SvDnsblBanReason);
}
}
} }
} }
} }