Skip to content

Commit

Permalink
server: prevent using connect as an amplifier, never used handicap code
Browse files Browse the repository at this point in the history
removed
  • Loading branch information
IR4T4 committed Oct 7, 2018
1 parent 3342532 commit 8bff588
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/server/sv_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,9 @@ static qboolean SV_isClientIPValidToConnect(netadr_t from)
* @param[in] from
* @param[in] userinfo
*/
static qboolean SV_IsValidUserinfo(netadr_t from,const char *userinfo)
static qboolean SV_IsValidUserinfo(netadr_t from, const char *userinfo)
{
// FIXME: add some logging in for admins? we only do developer prints when a client is filtered

int version;

// NOTE: but we might need to store the protocol around for potential non http/ftp clients
Expand Down Expand Up @@ -312,9 +311,20 @@ void SV_DirectConnect(netadr_t from)

Com_DPrintf("SVC_DirectConnect ()\n");

// Prevent using connect as an amplifier
if (sv_protect->integer & SVP_IOQ3)
{
if(SVC_RateLimitAddress(from, 10, 1000))
{
SV_WriteAttackLog(va("Bad direct connect - rate limit from %s exceeded, dropping request\n",
NET_AdrToString(from)));
return;
}
}

Q_strncpyz(userinfo, Cmd_Argv(1), sizeof(userinfo));

// sort out clients we don't want to have in game
// sort out clients we don't want to have in game/does temp ban!
if (!SV_isValidClient(from, userinfo))
{
return;
Expand Down Expand Up @@ -1656,7 +1666,9 @@ void SV_UserinfoChanged(client_t *cl)
cl->rate = 5000;
}
}
val = Info_ValueForKey(cl->userinfo, "handicap"); // FIXME: unused?

/*
val = Info_ValueForKey(cl->userinfo, "handicap");
if (strlen(val))
{
i = atoi(val);
Expand All @@ -1665,6 +1677,7 @@ void SV_UserinfoChanged(client_t *cl)
Info_SetValueForKey(cl->userinfo, "handicap", "0");
}
}
*/

// snaps command
val = Info_ValueForKey(cl->userinfo, "snaps");
Expand Down

0 comments on commit 8bff588

Please sign in to comment.