i fix
This commit is contained in:
parent
04dd1c21d6
commit
8ee180f1a8
@ -212,7 +212,7 @@ public void SQL_OnDatabaseConnect(Database db, const char[] error, any data)
|
||||
g_hDatabase = db;
|
||||
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "CREATE TABLE IF NOT EXISTS connections (`auth` varchar(32), `address` varchar(16), PRIMARY KEY (`auth`))");
|
||||
Format(sQuery, sizeof(sQuery), "CREATE TABLE IF NOT EXISTS connections (`auth` varchar(32), `type` varchar(32), `address` varchar(16), PRIMARY KEY (`auth`))");
|
||||
|
||||
g_hDatabase.Query(SQL_OnQueryCompleted, sQuery, _, DBPrio_High);
|
||||
}
|
||||
@ -238,33 +238,46 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
|
||||
char sAddress[16];
|
||||
GetClientIP(client, sAddress, sizeof(sAddress));
|
||||
|
||||
char sConnectionType[32];
|
||||
if(!SteamClientAuthenticated(sAuthID))
|
||||
sConnectionType = "RevEmu";
|
||||
else
|
||||
sConnectionType = "SteamLegit";
|
||||
|
||||
if(results.RowCount && results.FetchRow())
|
||||
{
|
||||
int iFieldNum;
|
||||
char sResultAddress[16];
|
||||
char sResultConnectionType[32];
|
||||
|
||||
results.FieldNameToNum("address", iFieldNum);
|
||||
results.FetchString(iFieldNum, sResultAddress, sizeof(sResultAddress));
|
||||
|
||||
results.FieldNameToNum("type", iFieldNum);
|
||||
results.FetchString(iFieldNum, sResultConnectionType, sizeof(sResultConnectionType));
|
||||
|
||||
delete results;
|
||||
|
||||
if(!SteamClientAuthenticated(sAuthID))
|
||||
{
|
||||
if(StrEqual(sAddress, sResultAddress, false))
|
||||
if(!StrEqual(sConnectionType, sResultConnectionType, false) && StrEqual(sResultConnectionType, "SteamLegit", false))
|
||||
{
|
||||
LogMessage("%L tried to join with a legitimate steamid while not authenticated with steam. Allowing connection, IPs match. (Known: %s)", client, sAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage("%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);
|
||||
KickClient(client, "Trying to join with a legitimate steamid while not authenticated with steam.");
|
||||
return;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage("%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);
|
||||
KickClient(client, "Trying to join with a legitimate steamid while not authenticated with steam.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO connections (auth, address) VALUES ('%s', '%s') ON DUPLICATE KEY UPDATE address='%s';", sAuthID, sAddress, sAddress);
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO connections (auth, type, address) VALUES ('%s', '%s', '%s') ON DUPLICATE KEY UPDATE type='%s', address='%s';", sAuthID, sConnectionType, sAddress, sConnectionType, sAddress);
|
||||
|
||||
g_hDatabase.Query(SQL_OnQueryCompleted, sQuery, _, DBPrio_Low);
|
||||
}
|
Loading…
Reference in New Issue
Block a user