summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/g_admin.c11
-rw-r--r--src/game/g_client.c36
2 files changed, 24 insertions, 23 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index ab047b5f..43ca0400 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -681,8 +681,7 @@ static void admin_log( gentity_t *admin, char *cmd, int skiparg )
tens,
sec,
( admin ) ? admin->s.clientNum : -1,
- ( admin ) ? admin->client->pers.guid
- : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ admin->client->pers.guid,
( admin ) ? admin->client->pers.netname : "console",
flags,
cmd,
@@ -698,8 +697,7 @@ static void admin_log( gentity_t *admin, char *cmd, int skiparg )
tens,
sec,
( admin ) ? admin->s.clientNum : -1,
- ( admin ) ? admin->client->pers.guid
- : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ admin->client->pers.guid,
( admin ) ? admin->client->pers.netname : "console",
flags,
cmd,
@@ -1427,11 +1425,6 @@ qboolean G_admin_setlevel( gentity_t *ent, int skiparg )
return qfalse;
}
- if( !Q_stricmp( guid, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ) )
- {
- ADMP( va( "^3!setlevel: ^7%s does not have a valid GUID\n", adminname ) );
- return qfalse;
- }
if( ent && !admin_higher_guid( ent->client->pers.guid, guid ) )
{
ADMP( "^3!setlevel: ^7sorry, but your intended victim has a higher"
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;