r5sdk/r5dev/engine/server/sv_main.cpp
Kawe Mazidjatari 1285d15623 Ban system and authentication improvements
* Fixed bug where multiple of the same entries get added to the global ban/refuse list.
* Fixed bug where we still use the client instance after deleting it in 'CBanSystem::BanListCheck()'.
* Load banlist at a later state (not at construction of class), this is needed for a future change of adapting the 'business' code to feature the game's FileSystem.
* CServer cleanup.
* More detailed ban messages (banned, added to refused list, removed from slot, etc..).
* Use localization key for banned message ("#Valve_Reject_Banned").
* Add const qualifiers to all CPylon methods.

Note:
* This commit requires changes on the master server, these changes are already performed, however the new master server isn't live yet until we publish the new release.
2022-08-30 12:07:09 +02:00

29 lines
1021 B
C++

#include "core/stdafx.h"
#include "tier0/threadtools.h"
#include "tier0/frametask.h"
#include "engine/server/sv_main.h"
#include "networksystem/pylon.h"
#include "networksystem/bansystem.h"
//-----------------------------------------------------------------------------
// Purpose: checks if particular client is banned on the comp server
//-----------------------------------------------------------------------------
void SV_IsClientBanned(const string& svIPAddr, const uint64_t nNucleusID)
{
string svError;
bool bCompBanned = g_pMasterServer->CheckForBan(svIPAddr, nNucleusID, svError);
if (bCompBanned)
{
if (!ThreadInMainThread())
{
g_TaskScheduler->Dispatch([svError, nNucleusID]
{
g_pBanSystem->AddConnectionRefuse(svError, nNucleusID); // Add to the vector.
}, 0);
}
Warning(eDLL_T::SERVER, "Added '%s' to refused list ('%llu' is banned from the master server!)\n", svIPAddr.c_str(), nNucleusID);
}
}
///////////////////////////////////////////////////////////////////////////////