summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2014-07-14 00:56:25 +0200
committer/dev/humancontroller <devhc@example.com>2017-03-09 13:51:18 +0100
commit34d78537d8b33801f8cb477720bd4f826f2d2829 (patch)
tree7e6e7f5d967611d8eb0c7e9aefdec20d129f3c91
parent488b8162060e68a01d2521398f6587337dc75e04 (diff)
support GUIDless 1.1 clients
differentiate between 1.1-without-GUID, 1.1-with-GUID, and GPP clients - mark their group in listplayers - generate random GUIDs for GUIDless clients, but do not allow them to gain admin levels - use empty GUID strings for the ban entries of GUIDless clients
-rw-r--r--src/game/g_admin.c18
-rw-r--r--src/game/g_client.c16
-rw-r--r--src/game/g_local.h3
-rw-r--r--src/game/g_namelog.c1
4 files changed, 32 insertions, 6 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 372891e7..2f92d5c2 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -1428,6 +1428,12 @@ qboolean G_admin_setlevel( gentity_t *ent )
return qfalse;
}
+ if( vic && vic->client->pers.guidless )
+ {
+ ADMP( va( "^3setlevel: ^7%s^7 has no GUID\n", vic->client->pers.netname ) );
+ return qfalse;
+ }
+
if( !a && vic )
{
for( a = g_admin_admins; a && a->next; a = a->next );
@@ -1645,7 +1651,7 @@ qboolean G_admin_kick( gentity_t *ent )
reason ) );
admin_create_ban( ent,
vic->client->pers.netname,
- vic->client->pers.guid,
+ vic->client->pers.guidless ? "" : vic->client->pers.guid,
&vic->client->pers.ip,
MAX( 1, G_admin_parse_time( g_adminTempBan.string ) ),
( *reason ) ? reason : "kicked by admin" );
@@ -1834,7 +1840,7 @@ qboolean G_admin_ban( gentity_t *ent )
match->slot == -1 ?
match->name[ match->nameOffset ] :
level.clients[ match->slot ].pers.netname,
- match->guid,
+ match->guidless ? "" : match->guid,
&ip,
seconds, reason );
}
@@ -1853,7 +1859,7 @@ qboolean G_admin_ban( gentity_t *ent )
match->slot == -1 ?
match->name[ match->nameOffset ] :
level.clients[ match->slot ].pers.netname,
- match->guid,
+ match->guidless ? "" : match->guid,
&match->ip[ i ],
seconds, reason );
admin_log( va( "[%s]", match->ip[ i ].str ) );
@@ -2420,12 +2426,12 @@ qboolean G_admin_listplayers( gentity_t *ent )
colorlen += 2;
}
- ADMBP( va( "%2i ^%c%c^7 %-2i^2%c^7 %*s^7 ^1%c%c^7 %s^7 %s%s%s\n",
+ ADMBP( va( "%2i ^%c%c %s %s^7 %*s^7 ^1%c%c^7 %s^7 %s%s%s\n",
i,
c,
t,
- l ? l->level : 0,
- hint ? '*' : ' ',
+ p->pers.guidless ? "^1---" : va( "^7%-2i^2%c", l ? l->level : 0, hint ? '*' : ' ' ),
+ p->pers.alternateProtocol == 2 ? "^11" : p->pers.alternateProtocol == 1 ? "^3G" : " ",
admin_level_maxname + colorlen,
lname,
muted,
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 99f928cf..7ddd00ec 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1064,6 +1064,22 @@ char *ClientConnect( int clientNum, qboolean firstTime )
client->pers.admin = G_admin_admin( client->pers.guid );
+ client->pers.alternateProtocol = trap_Cvar_VariableIntegerValue( va( "sv_clAltProto%i", clientNum ) );
+
+ if( client->pers.alternateProtocol == 2 && client->pers.guid[ 0 ] == '\0' )
+ {
+ size_t len = strlen( client->pers.ip.str );
+ if( len == 0 )
+ len = 1;
+ for( i = 0; i < sizeof( client->pers.guid ) - 1; ++i )
+ {
+ int j = client->pers.ip.str[ i % len ] + rand() / ( RAND_MAX / 16 + 1 );
+ client->pers.guid[ i ] = "0123456789ABCDEF"[ j % 16 ];
+ }
+ client->pers.guid[ sizeof( client->pers.guid ) - 1 ] = '\0';
+ client->pers.guidless = qtrue;
+ }
+
// check for admin ban
if( G_admin_ban_check( ent, reason, sizeof( reason ) ) )
{
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 35fafb69..b6d65c78 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -264,6 +264,7 @@ typedef struct namelog_s
char name[ MAX_NAMELOG_NAMES ][ MAX_NAME_LENGTH ];
addr_t ip[ MAX_NAMELOG_ADDRS ];
char guid[ 33 ];
+ qboolean guidless;
int slot;
qboolean banned;
@@ -322,7 +323,9 @@ typedef struct
int floodTime;
vec3_t lastDeathLocation;
+ int alternateProtocol;
char guid[ 33 ];
+ qboolean guidless;
addr_t ip;
char voice[ MAX_VOICE_NAME_LEN ];
qboolean useUnlagged;
diff --git a/src/game/g_namelog.c b/src/game/g_namelog.c
index 66136844..6655c2c4 100644
--- a/src/game/g_namelog.c
+++ b/src/game/g_namelog.c
@@ -50,6 +50,7 @@ void G_namelog_connect( gclient_t *client )
{
n = BG_Alloc( sizeof( namelog_t ) );
strcpy( n->guid, client->pers.guid );
+ n->guidless = client->pers.guidless;
if( p )
{
p->next = n;