Browse Source

server: fix wrong xashid key on server, it's uuid now

pull/2/head
Alibek Omarov 4 years ago
parent
commit
f5e400de69
  1. 6
      engine/common/sys_con.c
  2. 14
      engine/server/sv_client.c
  3. 6
      engine/server/sv_filter.c
  4. 3
      engine/server/sv_main.c

6
engine/common/sys_con.c

@ -22,10 +22,10 @@ GNU General Public License for more details.
#define XASH_COLORIZE_CONSOLE #define XASH_COLORIZE_CONSOLE
// use with caution, running engine in Qt Creator may cause a freeze in read() call // use with caution, running engine in Qt Creator may cause a freeze in read() call
// I was never encountered this bug anywhere else, so still enable by default // I was never encountered this bug anywhere else, so still enable by default
// #define XASH_USE_SELECT // #define XASH_USE_SELECT 1
#endif #endif
#ifdef XASH_USE_SELECT #if XASH_USE_SELECT
// non-blocking console input // non-blocking console input
#include <sys/select.h> #include <sys/select.h>
#endif #endif
@ -42,7 +42,7 @@ static LogData s_ld;
char *Sys_Input( void ) char *Sys_Input( void )
{ {
#ifdef XASH_USE_SELECT #if XASH_USE_SELECT
{ {
fd_set rfds; fd_set rfds;
static char line[1024]; static char line[1024];

14
engine/server/sv_client.c

@ -376,17 +376,6 @@ void SV_ConnectClient( netadr_t from )
// build a new connection // build a new connection
// accept the new client // accept the new client
if( Q_strncpy( newcl->useragent, Cmd_Argv( 6 ), MAX_INFO_STRING ) )
{
const char *id = Info_ValueForKey( newcl->useragent, "i" );
if( *id )
{
//sscanf( id, "%llx", &newcl->WonID );
}
// Q_strncpy( cl->auth_id, id, sizeof( cl->auth_id ) );
}
sv.current_client = newcl; sv.current_client = newcl;
newcl->edict = EDICT_NUM( (newcl - svs.clients) + 1 ); newcl->edict = EDICT_NUM( (newcl - svs.clients) + 1 );
@ -396,6 +385,7 @@ void SV_ConnectClient( netadr_t from )
newcl->userid = g_userid++; // create unique userid newcl->userid = g_userid++; // create unique userid
newcl->state = cs_connected; newcl->state = cs_connected;
newcl->extensions = extensions & (NET_EXT_SPLITSIZE); newcl->extensions = extensions & (NET_EXT_SPLITSIZE);
Q_strncpy( newcl->useragent, protinfo, MAX_INFO_STRING );
// reset viewentities (from previous level) // reset viewentities (from previous level)
memset( newcl->viewentity, 0, sizeof( newcl->viewentity )); memset( newcl->viewentity, 0, sizeof( newcl->viewentity ));
@ -411,7 +401,7 @@ void SV_ConnectClient( netadr_t from )
// build protinfo answer // build protinfo answer
protinfo[0] = '\0'; protinfo[0] = '\0';
Info_SetValueForKey( protinfo, "ext", va( "%d",newcl->extensions ), sizeof( protinfo ) ); Info_SetValueForKey( protinfo, "ext", va( "%d", newcl->extensions ), sizeof( protinfo ) );
// send the connect packet to the client // send the connect packet to the client
Netchan_OutOfBandPrint( NS_SERVER, from, "client_connect %s", protinfo ); Netchan_OutOfBandPrint( NS_SERVER, from, "client_connect %s", protinfo );

6
engine/server/sv_filter.c

@ -184,7 +184,7 @@ static void SV_BanID_f( void )
for( i = 0, cl1 = svs.clients; i < sv_maxclients->value; i++, cl1++ ) for( i = 0, cl1 = svs.clients; i < sv_maxclients->value; i++, cl1++ )
{ {
if( !Q_strncmp( id, Info_ValueForKey( cl1->useragent, "i" ), len ) ) if( !Q_strncmp( id, Info_ValueForKey( cl1->useragent, "uuid" ), len ) )
{ {
cl = cl1; cl = cl1;
break; break;
@ -197,7 +197,7 @@ static void SV_BanID_f( void )
Con_DPrintf( S_WARN "banid: no such player\n" ); Con_DPrintf( S_WARN "banid: no such player\n" );
} }
else else
id = Info_ValueForKey( cl->useragent, "i" ); id = Info_ValueForKey( cl->useragent, "uuid" );
if( !id[0] ) if( !id[0] )
{ {
@ -254,7 +254,7 @@ static void SV_RemoveID_f( void )
if( num >= sv_maxclients->value || num < 0 ) if( num >= sv_maxclients->value || num < 0 )
return; return;
id = Info_ValueForKey( svs.clients[num].useragent, "i" ); id = Info_ValueForKey( svs.clients[num].useragent, "uuid" );
} }
if( !id[0] ) if( !id[0] )

3
engine/server/sv_main.c

@ -782,7 +782,7 @@ send error message and return false on wrong input devices
qboolean SV_ProcessUserAgent( netadr_t from, const char *useragent ) qboolean SV_ProcessUserAgent( netadr_t from, const char *useragent )
{ {
const char *input_devices_str = Info_ValueForKey( useragent, "d" ); const char *input_devices_str = Info_ValueForKey( useragent, "d" );
const char *id = Info_ValueForKey( useragent, "i" ); const char *id = Info_ValueForKey( useragent, "uuid" );
if( !sv_allow_noinputdevices->value && ( !input_devices_str || !input_devices_str[0] ) ) if( !sv_allow_noinputdevices->value && ( !input_devices_str || !input_devices_str[0] ) )
{ {
@ -871,7 +871,6 @@ void SV_Init( void )
Cvar_RegisterVariable( &sv_fps ); Cvar_RegisterVariable( &sv_fps );
Cvar_RegisterVariable( &showtriggers ); Cvar_RegisterVariable( &showtriggers );
Cvar_RegisterVariable( &sv_aim ); Cvar_RegisterVariable( &sv_aim );
Cvar_RegisterVariable( &motdfile );
Cvar_RegisterVariable( &deathmatch ); Cvar_RegisterVariable( &deathmatch );
Cvar_RegisterVariable( &coop ); Cvar_RegisterVariable( &coop );
Cvar_RegisterVariable( &teamplay ); Cvar_RegisterVariable( &teamplay );

Loading…
Cancel
Save