mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2025-01-31 11:20:32 +00:00
Require gamename if not supporting legacy protocol.
This commit is contained in:
parent
1a736dd725
commit
d9b72dedc1
2 changed files with 25 additions and 9 deletions
|
@ -3763,13 +3763,22 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
|
||||||
char *infoString;
|
char *infoString;
|
||||||
int prot;
|
int prot;
|
||||||
char *gamename;
|
char *gamename;
|
||||||
|
qboolean gameMismatch;
|
||||||
|
|
||||||
infoString = MSG_ReadString( msg );
|
infoString = MSG_ReadString( msg );
|
||||||
|
|
||||||
// if this isn't the correct gamename, ignore it
|
// if this isn't the correct gamename, ignore it
|
||||||
gamename = Info_ValueForKey( infoString, "gamename" );
|
gamename = Info_ValueForKey( infoString, "gamename" );
|
||||||
|
|
||||||
if (gamename && *gamename && strcmp(gamename, com_gamename->string))
|
#ifdef LEGACY_PROTOCOL
|
||||||
|
// gamename is optional for legacy protocol
|
||||||
|
if (com_legacyprotocol->integer && !*gamename)
|
||||||
|
gameMismatch = qfalse;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
gameMismatch = !*gamename || strcmp(gamename, com_gamename->string) != 0;
|
||||||
|
|
||||||
|
if (gameMismatch)
|
||||||
{
|
{
|
||||||
Com_DPrintf( "Game mismatch in info packet: %s\n", infoString );
|
Com_DPrintf( "Game mismatch in info packet: %s\n", infoString );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -60,6 +60,7 @@ void SV_GetChallenge(netadr_t from)
|
||||||
challenge_t *challenge;
|
challenge_t *challenge;
|
||||||
qboolean wasfound = qfalse;
|
qboolean wasfound = qfalse;
|
||||||
char *gameName;
|
char *gameName;
|
||||||
|
qboolean gameMismatch;
|
||||||
|
|
||||||
// ignore if we are in single player
|
// ignore if we are in single player
|
||||||
if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive")) {
|
if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive")) {
|
||||||
|
@ -67,16 +68,22 @@ void SV_GetChallenge(netadr_t from)
|
||||||
}
|
}
|
||||||
|
|
||||||
gameName = Cmd_Argv(2);
|
gameName = Cmd_Argv(2);
|
||||||
if(gameName && *gameName)
|
|
||||||
{
|
#ifdef LEGACY_PROTOCOL
|
||||||
// reject client if the heartbeat string sent by the client doesn't match ours
|
// gamename is optional for legacy protocol
|
||||||
if(strcmp(gameName, com_gamename->string))
|
if (com_legacyprotocol->integer && !*gameName)
|
||||||
|
gameMismatch = qfalse;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
gameMismatch = !*gameName || strcmp(gameName, com_gamename->string) != 0;
|
||||||
|
|
||||||
|
// reject client if the gamename string sent by the client doesn't match ours
|
||||||
|
if (gameMismatch)
|
||||||
{
|
{
|
||||||
NET_OutOfBandPrint(NS_SERVER, from, "print\nGame mismatch: This is a %s server\n",
|
NET_OutOfBandPrint(NS_SERVER, from, "print\nGame mismatch: This is a %s server\n",
|
||||||
com_gamename->string);
|
com_gamename->string);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
oldest = 0;
|
oldest = 0;
|
||||||
oldestClientTime = oldestTime = 0x7fffffff;
|
oldestClientTime = oldestTime = 0x7fffffff;
|
||||||
|
|
Loading…
Reference in a new issue