summaryrefslogtreecommitdiff
path: root/src/game/g_client.c
diff options
context:
space:
mode:
authorM. Kristall <mkpdev@gmail.com>2009-10-03 12:38:32 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:07 +0000
commit8373b62e39599d7b27bf150735298863b19487cb (patch)
treeb7bb1f38f3dffd8a903abb4266f42d097bd4e0e7 /src/game/g_client.c
parent9d1a4aec5a948c2d0c0fefc5eca1b33f663eb07b (diff)
* Require each client to have a unique, valid GUID
Diffstat (limited to 'src/game/g_client.c')
-rw-r--r--src/game/g_client.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 640f3d36..7246a25a 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1196,8 +1196,8 @@ char *ClientConnect( int clientNum, qboolean firstTime )
gclient_t *client;
char userinfo[ MAX_INFO_STRING ];
gentity_t *ent;
- char guid[ 33 ];
char reason[ MAX_STRING_CHARS ] = {""};
+ int i;
ent = &g_entities[ clientNum ];
client = &level.clients[ clientNum ];
@@ -1207,7 +1207,7 @@ char *ClientConnect( int clientNum, qboolean firstTime )
trap_GetUserinfo( clientNum, userinfo, sizeof( userinfo ) );
value = Info_ValueForKey( userinfo, "cl_guid" );
- Q_strncpyz( guid, value, sizeof( guid ) );
+ Q_strncpyz( client->pers.guid, value, sizeof( client->pers.guid ) );
// check for admin ban
if( G_admin_ban_check( userinfo, reason, sizeof( reason ) ) )
@@ -1215,11 +1215,6 @@ char *ClientConnect( int clientNum, qboolean firstTime )
return va( "%s", reason );
}
-
- // IP filtering
- // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=500
- // recommanding PB based IP / GUID banning, the builtin system is pretty limited
- // check to see if they are on the banned IP list
value = Info_ValueForKey( userinfo, "ip" );
Q_strncpyz( client->pers.ip, value, sizeof( client->pers.ip ) );
@@ -1231,15 +1226,28 @@ char *ClientConnect( int clientNum, qboolean firstTime )
return "Invalid password";
// add guid to session so we don't have to keep parsing userinfo everywhere
- if( !guid[0] )
- {
- Q_strncpyz( client->pers.guid, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
- sizeof( client->pers.guid ) );
- }
- else
+ for( i = 0; i < sizeof( client->pers.guid ) - 1 &&
+ isxdigit( client->pers.guid[ i ] ); i++ );
+
+ if( i < sizeof( client->pers.guid ) - 1 )
+ return "Invalid GUID";
+
+ for( i = 0; i < level.maxclients; i++ )
{
- Q_strncpyz( client->pers.guid, guid, sizeof( client->pers.guid ) );
+ if( level.clients[ i ].pers.connected == CON_DISCONNECTED )
+ continue;
+
+ if( !Q_stricmp( client->pers.guid, level.clients[ i ].pers.guid ) )
+ {
+ if( !G_ClientIsLagging( level.clients + i ) )
+ {
+ trap_SendServerCommand( i, "cp \"Your GUID is not secure\"" );
+ return "Duplicate GUID";
+ }
+ trap_DropClient( i, "Ghost" );
+ }
}
+
// check for local client
if( !strcmp( client->pers.ip, "localhost" ) )
client->pers.localClient = qtrue;