Exemple #1
0
/**
 * @brief Handles a connectionless message from a client
 * @sa NET_OOB_Printf
 * @param[out] stream The stream to write to
 * @param msg The message buffer to read the connectionless data from
 */
static void SV_ConnectionlessPacket (struct net_stream *stream, dbuffer *msg)
{
	const char *c;
	char s[512];
	char buf[256];

	NET_ReadStringLine(msg, s, sizeof(s));

	Cmd_TokenizeString(s, false);

	c = Cmd_Argv(0);
	Com_DPrintf(DEBUG_SERVER, "Packet : %s\n", c);

	if (Q_streq(c, "teaminfo"))
		SVC_TeamInfo(stream);
	else if (Q_streq(c, "info"))
		SVC_Info(stream);
	else if (Q_streq(c, "status"))
		SVC_Status(stream);
	else if (Q_streq(c, "connect"))
		SVC_DirectConnect(stream);
	else if (Q_streq(c, "rcon"))
		SVC_RemoteCommand(stream);
	else
		Com_Printf("Bad connectionless packet from %s:\n%s\n", NET_StreamPeerToName(stream, buf, sizeof(buf), true), s);
}
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
	char	*s;
	char	*c;
	#ifdef USE_AUTH
	netadr_t	authServerIP;
	#endif

	MSG_BeginReadingOOB( msg );
	MSG_ReadLong( msg );		// skip the -1 marker

	if (!Q_strncmp("connect", (char *) &msg->data[4], 7)) {
		Huff_Decompress(msg, 12);
	}

	s = MSG_ReadStringLine( msg );
	Cmd_TokenizeString( s );

	c = Cmd_Argv(0);
	Com_DPrintf ("SV packet %s : %s\n", NET_AdrToString(from), c);

	if (!Q_stricmp(c, "getstatus")) {
		if (SV_CheckDRDoS(from)) { return; }
		SVC_Status( from  );
  } else if (!Q_stricmp(c, "getinfo")) {
		if (SV_CheckDRDoS(from)) { return; }
		SVC_Info( from );
	} else if (!Q_stricmp(c, "getchallenge")) {
		SV_GetChallenge( from );
	} else if (!Q_stricmp(c, "connect")) {
		SV_DirectConnect( from );
	} else if (!Q_stricmp(c, "ipAuthorize")) {
		SV_AuthorizeIpPacket( from );
	}
	#ifdef USE_AUTH
	// @Barbatos @Kalish
	else if ( (!Q_stricmp(c, "AUTH:SV")))
	{
		NET_StringToAdr(sv_authServerIP->string, &authServerIP);
		
		if ( !NET_CompareBaseAdr( from, authServerIP ) ) {
			Com_Printf( "AUTH not from the Auth Server\n" );
			return;
		}
		VM_Call(gvm, GAME_AUTHSERVER_PACKET);
	}
	#endif
	
	else if (!Q_stricmp(c, "rcon")) {
		SVC_RemoteCommand( from, msg );
	}else if (!Q_stricmp(c, "rconRecovery")) {
		SVC_RconRecoveryRemoteCommand( from, msg );
	} else if (!Q_stricmp(c, "disconnect")) {
		// if a client starts up a local server, we may see some spurious
		// server disconnect messages when their new server sees our final
		// sequenced messages to the old client
	} else {
		Com_DPrintf ("bad connectionless packet from %s:\n%s\n"
		, NET_AdrToString (from), s);
	}
}
Exemple #3
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket(void)
{
    const char * s;
    const char * c;

    MSG_BeginReading(&net_message);
    MSG_ReadLong(&net_message); // skip the -1 marker

    s = MSG_ReadStringLine(&net_message);

    Cmd_TokenizeString(s, false);

    c = Cmd_Argv(0);
    Com_DPrintf("Packet %s : %s\n", NET_AdrToString(net_from), c);

    if (!strcmp(c, "ping"))
        SVC_Ping();
    else if (!strcmp(c, "ack"))
        SVC_Ack();
    else if (!strcmp(c, "status"))
        SVC_Status();
    else if (!strcmp(c, "info"))
        SVC_Info();
    else if (!strcmp(c, "getchallenge"))
        SVC_GetChallenge();
    else if (!strcmp(c, "connect"))
        SVC_DirectConnect();
    else if (!strcmp(c, "rcon"))
        SVC_RemoteCommand();
    else
        Com_Printf("bad connectionless packet from %s:\n%s\n", NET_AdrToString(net_from), s);
}
Exemple #4
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
	char    *s;
	char    *c;

	MSG_BeginReadingOOB( msg );
	MSG_ReadLong( msg );        // skip the -1 marker

	s = MSG_ReadStringLine( msg );

	Cmd_TokenizeString( s );

	c = Cmd_Argv( 0 );
	Com_DPrintf( "SV packet %s : %s\n", NET_AdrToString( from ), c );

	if ( !Q_stricmp( c,"getstatus" ) ) {
		SVC_Status( from  );
	} else if ( !Q_stricmp( c,"getinfo" ) ) {
		SVC_Info( from );
	} else if ( !Q_stricmp( c,"getchallenge" ) ) {
		SV_GetChallenge( from );
	} else if ( !Q_stricmp( c,"connect" ) ) {
		SV_DirectConnect( from );
	} else if ( !Q_stricmp( c,"ipAuthorize" ) ) {
		SV_AuthorizeIpPacket( from );
	} else if ( !Q_stricmp( c, "rcon" ) ) {
		SVC_RemoteCommand( from, msg );
	} else if ( !Q_stricmp( c,"disconnect" ) ) {
		// if a client starts up a local server, we may see some spurious
		// server disconnect messages when their new server sees our final
		// sequenced messages to the old client
	} else {
		Com_DPrintf( "bad connectionless packet from %s:\n%s\n"
					 , NET_AdrToString( from ), s );
	}
}
Exemple #5
0
/**
 * @brief Handles a connectionless message from a client
 * @sa NET_OOB_Printf
 * @param[out] stream The stream to write to
 * @param msg The message buffer to read the connectionless data from
 */
static void SV_ConnectionlessPacket (struct net_stream* stream, dbuffer* msg)
{
    char s[512];

    NET_ReadStringLine(msg, s, sizeof(s));
    Cmd_TokenizeString(s, false, false);

    const char* c = Cmd_Argv(0);
    Com_DPrintf(DEBUG_SERVER, "Packet : %s\n", c);

    if (Q_streq(c, SV_CMD_TEAMINFO)) {
        SVC_TeamInfo(stream);
    } else if (Q_streq(c, SV_CMD_INFO)) {
        SVC_Info(stream);
    } else if (Q_streq(c, SV_CMD_STATUS)) {
        SVC_Status(stream);
    } else if (Q_streq(c, SV_CMD_CONNECT)) {
        SVC_DirectConnect(stream);
    } else if (Q_streq(c, SV_CMD_RCON)) {
        SVC_RemoteCommand(stream);
    } else {
        char buf[256];
        Com_Printf("Bad connectionless packet from %s:\n%s\n", NET_StreamPeerToName(stream, buf, sizeof(buf), true), s);
    }
}
Exemple #6
0
/*
 * =================
 * SV_ConnectionlessPacket
 *
 * A connectionless packet has four leading 0xff
 * characters to distinguish it from a game channel.
 * Clients that are in the game can still send
 * connectionless packets.
 * =================
 */
void SV_ConnectionlessPacket(void)
{
    char *s;
    char *c;

    // r1ch fix: make sure we never talk to ourselves
//	if (NET_IsLocalAddress (net_from.ip[0] == 127) && !NET_IsLocalHost(net_from) && ShortSwap(net_from.port) == server_port)

/*	if ( (net_from.ip[0] == 127) && (net_from.type != NA_LOOPBACK) && (ShortSwap(net_from.port) == server_port) )
 *      {
 *              Com_DPrintf ("dropped %d byte connectionless packet from self! (spoofing attack?)\n", net_message.cursize);
 *              return;
 *      }*/

    MSG_BeginReading(&net_message);
    MSG_ReadLong(&net_message);                 // skip the -1 marker

    s = MSG_ReadStringLine(&net_message);

    Cmd_TokenizeString(s, false);

    c = Cmd_Argv(0);
    Com_DPrintf("Packet %s : %s\n", NET_AdrToString(net_from), c);

    if (!strcmp(c, "ping"))
    {
        SVC_Ping();
    }
    else if (!strcmp(c, "ack"))
    {
        SVC_Ack();
    }
    else if (!strcmp(c, "status"))
    {
        SVC_Status();
    }
    else if (!strcmp(c, "info"))
    {
        SVC_Info();
    }
    else if (!strcmp(c, "getchallenge"))
    {
        SVC_GetChallenge();
    }
    else if (!strcmp(c, "connect"))
    {
        SVC_DirectConnect();
    }
    else if (!strcmp(c, "rcon"))
    {
        SVC_RemoteCommand();
    }
    else
    {
        Com_Printf("bad connectionless packet from %s:\n%s\n"
                   , NET_AdrToString(net_from), s);
    }
}
Exemple #7
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
	char    *s;
	const char    *c;

	MSG_BeginReadingOOB( msg );
	MSG_ReadLong( msg );        // skip the -1 marker

#if !defined RTCW_SP
	if ( !Q_strncmp( "connect", reinterpret_cast<const char*> (&msg->data[4]), 7 ) ) {
		Huff_Decompress( msg, 12 );
	}
#endif // RTCW_XX

	s = MSG_ReadStringLine( msg );

	Cmd_TokenizeString( s );

	c = Cmd_Argv( 0 );
	Com_DPrintf( "SV packet %s : %s\n", NET_AdrToString( from ), c );

	if ( !Q_stricmp( c,"getstatus" ) ) {
		SVC_Status( from  );
	} else if ( !Q_stricmp( c,"getinfo" ) ) {
		SVC_Info( from );
	} else if ( !Q_stricmp( c,"getchallenge" ) ) {
		SV_GetChallenge( from );
	} else if ( !Q_stricmp( c,"connect" ) ) {
		SV_DirectConnect( from );

#if !defined RTCW_ET || (defined RTCW_ET && AUTHORIZE_SUPPORT)
	} else if ( !Q_stricmp( c,"ipAuthorize" ) ) {
		SV_AuthorizeIpPacket( from );
#endif // RTCW_XX

	} else if ( !Q_stricmp( c, "rcon" ) ) {
		SVC_RemoteCommand( from, msg );

#if defined RTCW_MP
// DHM - Nerve
#ifdef UPDATE_SERVER
	} else if ( !Q_stricmp( c, "getUpdateInfo" ) ) {
		SVC_GetUpdateInfo( from );
#endif
// DHM - Nerve
#endif // RTCW_XX

	} else if ( !Q_stricmp( c,"disconnect" ) ) {
		// if a client starts up a local server, we may see some spurious
		// server disconnect messages when their new server sees our final
		// sequenced messages to the old client
	} else {
		Com_DPrintf( "bad connectionless packet from %s:\n%s\n"
					 , NET_AdrToString( from ), s );
	}
}
Exemple #8
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
	char	*s;
	char	*c;

	MSG_BeginReadingOOB( msg );
	MSG_ReadLong( msg );		// skip the -1 marker

	if (!Q_strncmp("connect", (char *) &msg->data[4], 7)) {
		Huff_Decompress(msg, 12);
	}

	s = MSG_ReadStringLine( msg );
	Cmd_TokenizeString( s );

	c = Cmd_Argv(0);

	if (!Q_stricmp(c, "getstatus")) {
		if (SV_CheckDRDoS(from)) { return; }
		SVC_Status( from  );
  } else if (!Q_stricmp(c, "getinfo")) {
		if (SV_CheckDRDoS(from)) { return; }
		SVC_Info( from );
	} else if (!Q_stricmp(c, "getchallenge")) {
		SV_GetChallenge( from );
	} else if (!Q_stricmp(c, "connect")) {
		SV_DirectConnect( from );
	/*
	} else if (!Q_stricmp(c, "ipAuthorize")) {
		SV_AuthorizeIpPacket( from );
	*/
	} else if (!Q_stricmp(c, "rcon")) {
		SVC_RemoteCommand( from, msg );
	////////////////////////////////////////////////
	// separator for ip2loc.patch and playerdb.patch
	////////////////////////////////////////////////
	} else if (!Q_stricmp(c, "disconnect")) {
		// if a client starts up a local server, we may see some spurious
		// server disconnect messages when their new server sees our final
		// sequenced messages to the old client
	} else {
		Com_DPrintf ("bad connectionless packet from %s:\n%s\n"
		, NET_AdrToString (from), s);
	}

	// We moved this from the top of this function to the bottom.
	// During a DRDoS attack we get thousands of lines of packets
	// that just garble the screen.  Since we return from this
	// function early if a DRDoS is detected, we don't print a line
	// for each attacking packet anymore.
	Com_DPrintf ("SV packet %s : %s\n", NET_AdrToString(from), c);
}
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
static void SV_ConnectionlessPacket (void)
{
	const char	*s;
	const char	*c;

	MSG_BeginReading ();
	MSG_ReadLong ();	// skip the -1 marker

	s = MSG_ReadStringLine ();

	Cmd_TokenizeString (s);

	c = Cmd_Argv(0);

	if (!strcmp(c, "ping") || ( c[0] == A2A_PING && (c[1] == 0 || c[1] == '\n')) )
	{
		SVC_Ping ();
		return;
	}
	if (c[0] == A2A_ACK && (c[1] == 0 || c[1] == '\n') )
	{
		Con_Printf ("A2A_ACK from %s\n", NET_AdrToString (net_from));
		return;
	}
	else if (c[0] == A2S_ECHO)
	{
		NET_SendPacket (net_message.cursize, net_message.data, net_from);
		return;
	}
	else if (!strcmp(c,"status"))
	{
		SVC_Status ();
		return;
	}
	else if (!strcmp(c,"log"))
	{
		SVC_Log ();
		return;
	}
	else if (!strcmp(c,"connect"))
	{
		SVC_DirectConnect ();
		return;
	}
	else if (!strcmp(c, "rcon"))
		SVC_RemoteCommand ();
	else
		Con_Printf ("bad connectionless packet from %s:\n%s\n", NET_AdrToString (net_from), s);
}
Exemple #10
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket(netadr_t from, msg_t * msg) {
	char *s, *c;

	MSG_BeginReadingOOB(msg);
	MSG_ReadLong(msg);			// skip the -1 marker

	if(!Q_strncmp("connect", (char *)&msg->data[4], 7)) {
		Huff_Decompress(msg, 12);
	}

	s = MSG_ReadStringLine(msg);

	Cmd_TokenizeString(s);

	c = Cmd_Argv(0);
	Com_DPrintf("SV packet %s : %s\n", NET_AdrToString(from), c);

	if(!Q_stricmp(c, "getstatus")) {
		if (SV_CheckDRDoS(from)) {
			return; 
		}
		SVC_Status(from);
	} else if(!Q_stricmp(c, "getinfo")) {
		if (SV_CheckDRDoS(from)) {
			return;
		}
		SVC_Info(from);
	} else if(!Q_stricmp(c, "getchallenge")) {
		SV_GetChallenge(from);
	} else if(!Q_stricmp(c, "connect")) {
		SV_DirectConnect(from);
	} else if(!Q_stricmp(c, "rcon")) {
		SVC_RemoteCommand(from, msg);
	}
#if defined (UPDATE_SERVER)
	else if ( !Q_stricmp( c, "getUpdateInfo" ) ) {
		SVC_GetUpdateInfo( from );
	}
#endif
	else if(!Q_stricmp(c, "disconnect")) {
		// if a client starts up a local server, we may see some spurious
		// server disconnect messages when their new server sees our final
		// sequenced messages to the old client
	} else {
		Com_DPrintf("bad connectionless packet from %s:\n%s\n", NET_AdrToString(from), s);
	}
}
Exemple #11
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket (void)
{
    char	*s;
    char	*c;
    int s_token = 0;
    // r1ch fix: make sure we never talk to ourselves
//	if (NET_IsLocalAddress (net_from.ip[0] == 127) && !NET_IsLocalHost(net_from) && ShortSwap(net_from.port) == server_port)
    /*	if ( (net_from.ip[0] == 127) && (net_from.type != NA_LOOPBACK) && (ShortSwap(net_from.port) == server_port) )
    	{
    		Com_DPrintf ("dropped %d byte connectionless packet from self! (spoofing attack?)\n", net_message.cursize);
    		return;
    	}*/

    MSG_BeginReading (&net_message);
    MSG_ReadLong (&net_message);		// skip the -1 marker

    s = MSG_ReadStringLine (&net_message);

    Cmd_TokenizeString (s, false);

    c = Cmd_Argv(0);
    Com_DPrintf ("Packet %s : %s\n", NET_AdrToString(net_from), c);

    if ((s_token = Q_STLookup(&packet_stable, c)) != -1) {
        if (s_token == s_ping)
            SVC_Ping ();
        else if (s_token == s_ack)
            SVC_Ack ();
        else if (s_token == s_status)
            SVC_Status ();
        else if (s_token == s_info)
            SVC_Info ();
        else if (s_token == s_getchallenge)
            SVC_GetChallenge ();
        else if (s_token == s_connect)
            SVC_DirectConnect ();
        else if (s_token == s_rcon)
            SVC_RemoteCommand ();
    } else
        Com_Printf ("bad connectionless packet from %s:\n%s\n"
                    , NET_AdrToString (net_from), s);
}
Exemple #12
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
	char	*s;
	char	*c;

	MSG_BeginReadingOOB( msg );
	MSG_ReadLong( msg );		// skip the -1 marker

	if (!Q_strncmp("connect", (const char *)&msg->data[4], 7)) {
		Huff_Decompress(msg, 12);
	}

	s = MSG_ReadStringLine( msg );
	Cmd_TokenizeString( s );

	c = Cmd_Argv(0);
	Com_DPrintf ("SV packet %s : %s\n", NET_AdrToString(from), c);

	if (!Q_stricmp(c, "getstatus")) {
		SVC_Status( from  );
//	} else if (!Q_stricmp(c, "getinfo")) {
//		SVC_Info( from );	// Pass along the client's nonce so we can echo
	} else if (!Q_stricmp(c, "getchallenge")) {
		SV_GetChallenge( from );
	} else if (!Q_stricmp(c, "connect")) {
		SV_DirectConnect( from );
#ifndef _XBOX	// No authorization on Xbox
	} else if (!Q_stricmp(c, "ipAuthorize")) {
		SV_AuthorizeIpPacket( from );
#endif
	} else if (!Q_stricmp(c, "rcon")) {
		SVC_RemoteCommand( from, msg );
	} else if (!Q_stricmp(c, "disconnect")) {
		// if a client starts up a local server, we may see some spurious
		// server disconnect messages when their new server sees our final
		// sequenced messages to the old client
	} else {
		Com_DPrintf ("bad connectionless packet from %s:\n%s\n"
		, NET_AdrToString (from), s);
	}
}
void CL_DeployOOB(netadr_t from, msg_t* msg)
{
	if (lastGsrCommand == GSR_RCON)
	{
		return SVC_RemoteCommand(from, msg);
	}

	if (lastGsrCommand == GSR_INFORESPONSE)
	{
		return CL_ServerInfoPacket(from, msg);
	}

	if (lastGsrCommand == GSR_GETSERVERSRESPONSE)
	{
		return CL_ServersResponsePacket(msg);
	}
	
#ifdef WE_DO_WANT_NUI
	if (lastGsrCommand == GSR_STATUSRESPONSE)
	{
		return g_nuiDraw->HandleStatusResponse(from, msg);
	}
#endif
}
Exemple #14
0
/*
=================
SV_ConnectionlessPacket

A connectionless packet has four leading 0xff
characters to distinguish it from a game channel.
Clients that are in the game can still send
connectionless packets.
=================
*/
void SV_ConnectionlessPacket (void)
{
	char	*s;
	char	*c;

	MSG_BeginReading ();
	MSG_ReadLong ();		// skip the -1 marker

	s = MSG_ReadStringLine ();
	s[1023] = 0;

	Cmd_TokenizeString (s);

	c = Cmd_Argv(0);

	if (!strcmp(c, "ping") || ( c[0] == A2A_PING && (c[1] == 0 || c[1] == '\n')) )
	{
		SVC_Ping ();
		return;
	}
	if (c[0] == A2A_ACK && (c[1] == 0 || c[1] == '\n') )
	{
		Com_Printf ("A2A_ACK from %s\n", NET_AdrToString (net_from));
		return;
	}
	else if (!strcmp(c,"status"))
	{
		SVC_Status ();
		return;
	}
	else if (!strcmp(c,"log"))
	{
		SVC_Log ();
		return;
	}
	else if (!strcmp(c,"connect"))
	{
		SVC_DirectConnect ();
		return;
	}
#ifdef MAUTH
	else if (c[0] == M2S_AUTH_TOK && (c[1] == 0 || c[1] == '\n') )
	{
        Com_Printf("MAUTH: Adding token from %s to auth queue\n", NET_AdrToString(net_from));
        // Provisionally add auth record...
        if (SV_AuthListAdd(&authtokq))
        {
            //SV_AuthListPrint(&authtokq);
            //SV_AuthListPrint(&authclientq);
            // Send S2M_AUTH_TOK_CHK as a spoofing check...
            Master_AuthTokChk(authtokq.start->name, authtokq.start->hash);
        }
        else
        {
            Com_Printf("MAUTH: Failure to add token from %s -- already added?\n", NET_AdrToString(net_from));
            // FIXME Send S2M_AUTH_TOK_NACK
        }
		return;
	}
	else if (c[0] == M2S_AUTH_TOK_ACK && (c[1] == 0 || c[1] == '\n') )
	{
        // The master is sending us the correct name and hash;
        // check that what we've got agrees with this.

        // FIXME do we trust this packet?
       
        char tok_ack = S2C_AUTH_TOK_ACK;
        authclient_t *newclient = NULL;
        qbool result;
        result = SV_AuthListValidate(&authtokq, &newclient);
        //SV_AuthListPrint(&authtokq);
        //SV_AuthListPrint(&authclientq);

        // Check the client is valid...
        if( !result )
        {
            Com_Printf("MAUTH: Client is not valid!\n");
            return;
        }
        
        // Tell client they can connect...
        Com_Printf("MAUTH: Telling client %s on %s to connect...\n", newclient->name, NET_AdrToString(newclient->client_addr));
		NET_SendPacket (NS_SERVER, 1, &tok_ack, newclient->client_addr);
		return;
	}
	/*else if (c[0] == M2S_AUTH_TOK_NACK && (c[1] == 0 || c[1] == '\n') )
    {
        // Master said this token not valid -- FIXME how can we trust this?
        // FIXME remove player details from auth queue.
        Com_Printf("MAUTH: Player invalid!\n");
    }*/
#endif
	else if (!strcmp(c,"getchallenge"))
	{
		SVC_GetChallenge ();
		return;
	}
	else if (!strcmp(c, "rcon"))
		SVC_RemoteCommand ();
	else
		Com_Printf ("bad connectionless packet from %s:\n%s\n"
		, NET_AdrToString (net_from), s);
}
Exemple #15
0
void SV_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
	char* s;
	char* c;
	
	MSG_BeginReading(msg);
	MSG_ReadLong(msg);
	
	#if CODPATCH == 5
	
	void (*SV_Netchan_AddOOBProfilePacket)(int);
	*(int*)&SV_Netchan_AddOOBProfilePacket = 0x8094928;
	SV_Netchan_AddOOBProfilePacket(msg->cursize);
	
	#endif
	
	//dumpbase((int*)msg, sizeof(msg_t));
	
	if ( !Q_strncmp( "connect", (char*)&msg->data[4], 7 ) )
		Huff_Decompress( msg, 12 );
	
	s = MSG_ReadStringLine(msg);
	
	Cmd_TokenizeString(s);
	
	c = Cmd_Argv(0);
	
	if ( !Q_stricmp( c,"getstatus" ) ) {
		SVC_Status( &from  );
	} else if ( !Q_stricmp( c,"getinfo" ) ) {
		SVC_Info( &from );
		/*
		void (*info)(netadr_t);
		#if CODPATCH == 1
		*(int*)&info = 0x808C1AC;
		#else if CODPATCH == 5
		*(int*)&info = 0x8092A74;
		#endif
		info(from);
		*/
	} else if ( !Q_stricmp( c,"getchallenge" ) ) {
		SV_GetChallenge( &from );
	} else if ( !Q_stricmp( c,"connect" ) ) {
		SV_DirectConnect( from );
	} else if ( !Q_stricmp( c,"ipAuthorize" ) ) {
		SV_AuthorizeIpPacket( from );
	} else if(!Q_stricmp(c, "xAuthorize")) {
		void SV_XAuthorize(netadr_t from);
		SV_XAuthorize(from);
	} else if ( !Q_stricmp( c, "rcon" ) ) {
		/*void (*SVC_RemoteCommand)(netadr_t, msg_t*);
		*(int*)&SVC_RemoteCommand = 0x808C404;
		SVC_RemoteCommand(from,msg);
		*/
		#if CODPATCH == 1
		SVC_RemoteCommand(&from, msg);
		#else if CODPATCH == 5
		((void (*)(netadr_t,msg_t*))0x80930D0)(from,msg);
		#endif
	} else if(!Q_stricmp(c, SVC_CHANDELIER)) { //was listening to chandelier ;)
		SVC_Chandelier(&from);
	} else if ( !Q_stricmp( c,"disconnect" ) ) {
		// if a client starts up a local server, we may see some spurious
		// server disconnect messages when their new server sees our final
		// sequenced messages to the old client*/
	} else {
		Com_DPrintf( "bad connectionless packet '%s' from %s.\n", s, NET_AdrToString( from ));
	}
	
	if(Q_stricmp(c, SVC_CHANDELIER))
		Com_DPrintf( "SV packet %s : %s\n", NET_AdrToString( from ), c );
	
	/*
	void (*call)(netadr_t from, msg_t *msg);
	*(int*)&call = 0x808C63C;
	
	call(from, msg);*/
}