a bit clean up on features we abandoned again. remaking logaction to logmessage and allowing the webclient to go through without being blocked by steamID check
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
ConVar g_hCvar_BlockSpoof;
|
||||
ConVar g_hCvar_BlockAdmin;
|
||||
ConVar g_hCvar_BlockVoice;
|
||||
ConVar g_hCvar_AuthenticationTime;
|
||||
|
||||
/* DATABASE */
|
||||
Database g_hDatabase;
|
||||
@@ -53,7 +52,6 @@ public void OnPluginStart()
|
||||
g_hCvar_BlockSpoof = CreateConVar("sm_manager_block_spoof", "1", "Kick unauthenticated people that join with known steamids.", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
g_hCvar_BlockAdmin = CreateConVar("sm_manager_block_admin", "1", "Should unauthenticated people be blocked from admin?", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
g_hCvar_BlockVoice = CreateConVar("sm_manager_block_voice", "1", "Should unauthenticated people be blocked from voice?", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
g_hCvar_AuthenticationTime = CreateConVar("sm_manager_authentication_time", "15", "Time in seconds after which a client needs to be assigned to a SteamID", FCVAR_NONE, true, 1.0);
|
||||
|
||||
AddMultiTargetFilter("@steam", Filter_Steam, "Steam Players", false);
|
||||
AddMultiTargetFilter("@nosteam", Filter_NoSteam, "No-Steam Players", false);
|
||||
@@ -258,14 +256,6 @@ public EConnect OnClientPreConnectEx(const char[] sName, char sPassword[255], co
|
||||
return k_OnClientPreConnectEx_Accept;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientPutInServer(int client)
|
||||
{
|
||||
//CreateTimer(g_hCvar_AuthenticationTime.FloatValue, CheckAuth, GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -273,9 +263,22 @@ public void OnClientAuthorized(int client, const char[] sAuthID)
|
||||
{
|
||||
char sAddress[16];
|
||||
GetClientIP(client, sAddress, sizeof(sAddress));
|
||||
static char sCountry[32];
|
||||
//if its the webclient its not a malicious steam ID steal, just pure coincidence if it were to hit a real steam players steamID.
|
||||
char allowed_ips[128];
|
||||
ConVar sv_set_steam_id_ips = FindConVar("sv_set_steam_id_ips");
|
||||
if (sv_set_steam_id_ips != null)
|
||||
{
|
||||
sv_set_steam_id_ips.GetString(allowed_ips, sizeof(allowed_ips));
|
||||
if (StrEqual(sAddress, allowed_ips))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//just kicking all nosteamers from algeria. not very cool but so be it.
|
||||
/*
|
||||
static char sCountry[32];
|
||||
if (GeoipCountry(sAddress, sCountry, sizeof(sCountry)) && StrEqual(sCountry, "Algeria", false))
|
||||
{
|
||||
if (!SteamClientAuthenticatedEx(sAuthID))
|
||||
@@ -336,52 +339,6 @@ public void OnClientPostAdminCheck(int client)
|
||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action CheckAuth(Handle timer, int data)
|
||||
{
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(data)) == 0)
|
||||
return Plugin_Stop;
|
||||
|
||||
char sAuthID[32];
|
||||
if(!GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), true))
|
||||
{
|
||||
LogMessage("%L could not be assigned to a SteamID, kicking client.", client);
|
||||
//KickClient(client, "Invalid STEAMID");
|
||||
if (IsValidClient(client))
|
||||
{
|
||||
Panel hNotifyPanel = new Panel(GetMenuStyleHandle(MenuStyle_Radio));
|
||||
hNotifyPanel.DrawItem("WARNING: Your SteamID is Invalid: Reconnecting you to the server in 8 Seconds.", ITEMDRAW_RAWLINE);
|
||||
hNotifyPanel.DrawItem("", ITEMDRAW_SPACER);
|
||||
hNotifyPanel.DrawItem("IMPORTANT: You may disconnect, reconnect if necessary!", ITEMDRAW_RAWLINE);
|
||||
hNotifyPanel.Send(client, MenuHandler_NotifyPanel, 8);
|
||||
delete hNotifyPanel;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
PrintToChat(client, "WARNING: Your SteamID is Invalid: Reconnecting you to the server in 8 Seconds.");
|
||||
}
|
||||
|
||||
CreateTimer(8.0, forceClientRetry, GetClientSerial(client));
|
||||
}
|
||||
}
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
public Action forceClientRetry(Handle timer, int data)
|
||||
{
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(data)) == 0)
|
||||
return Plugin_Stop;
|
||||
if (IsValidClient(client))
|
||||
{
|
||||
ClientCommand(client, "retry");
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
stock bool IsValidClient(int client)
|
||||
{
|
||||
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsClientSourceTV(client) && !IsFakeClient(client))
|
||||
@@ -389,16 +346,6 @@ stock bool IsValidClient(int client)
|
||||
return false;
|
||||
}
|
||||
|
||||
int MenuHandler_NotifyPanel(Menu hMenu, MenuAction iAction, int iParam1, int iParam2)
|
||||
{
|
||||
switch (iAction)
|
||||
{
|
||||
case MenuAction_Select, MenuAction_Cancel:
|
||||
delete hMenu;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -465,13 +412,12 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
|
||||
{
|
||||
if(StrEqual(sAddress, sResultAddress, false))
|
||||
{
|
||||
LogMessage("%L tried to join with a legitimate steamid while not authenticated with steam. Allowing connection, IPs match. (Known: %s)", client, sAddress);
|
||||
LogMessage("%N tried to join with a legitimate steamid while not authenticated with steam. Allowing connection, IPs match. (Known: %s)", client, sAddress);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogAction(client, -1, "\"%L\" tried to join with a legitimate steamid while not authenticated with steam. Refusing connection, IPs dont match. (Known: %s | Current: %s)", client, sResultAddress, sAddress);
|
||||
static char sCountry[32];
|
||||
LogMessage("%N tried to join with a legitimate steamid while not authenticated with steam. Refusing connection, IPs dont match. (Known: %s | Current: %s)", client, sResultAddress, sAddress);
|
||||
KickClient(client, "Trying to join with a legitimate steamid while not authenticated with steam.");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user