CD-Key check for internet-games can now be disabled

with ID_ENFORCE_KEY_CLIENT 0

This patch is from Kot-in-Action Creative Artel

Fixes #55
This commit is contained in:
Daniel Gibson 2012-11-13 23:47:35 +01:00
parent fe0ee16ccb
commit b13c131e4e
4 changed files with 25 additions and 2 deletions

View file

@ -75,6 +75,8 @@ If you have questions concerning this license or the applicable additional terms
#define ID_ALLOW_TOOLS
#endif
#define ID_ENFORCE_KEY_CLIENT 0
#ifndef ID_ENFORCE_KEY
# if !defined( ID_DEDICATED )
# define ID_ENFORCE_KEY 1
@ -83,6 +85,14 @@ If you have questions concerning this license or the applicable additional terms
# endif
#endif
#ifndef ID_ENFORCE_KEY_CLIENT
# if ID_ENFORCE_KEY
# define ID_ENFORCE_KEY_CLIENT 1
# else
# define ID_ENFORCE_KEY_CLIENT 0
# endif
#endif
// async network
/*

View file

@ -3248,7 +3248,7 @@ idSessionLocal::CDKeysAuthReply
===============
*/
void idSessionLocal::CDKeysAuthReply( bool valid, const char *auth_msg ) {
assert( authEmitTimeout > 0 );
//assert( authEmitTimeout > 0 );
if ( authWaitBox ) {
// close the wait box
StopBox();

View file

@ -1664,7 +1664,7 @@ void idAsyncClient::SetupConnection( void ) {
// do not make the protocol depend on PB
msg.WriteShort( 0 );
clientPort.SendPacket( serverAddress, msg.GetData(), msg.GetSize() );
#ifdef ID_ENFORCE_KEY_CLIENT
if ( idAsyncNetwork::LANServer.GetBool() ) {
common->Printf( "net_LANServer is set, connecting in LAN mode\n" );
} else {
@ -1686,6 +1686,12 @@ void idAsyncClient::SetupConnection( void ) {
}
clientPort.SendPacket( idAsyncNetwork::GetMasterAddress(), msg.GetData(), msg.GetSize() );
}
#else
if (! Sys_IsLANAddress( serverAddress ) ) {
common->Printf( "Build Does not have CD Key Enforcement enabled. The Server ( %s ) is not within the lan addresses. Attemting to connect.\n", Sys_NetAdrToString( serverAddress ) );
}
common->Printf( "Not Testing key.\n" );
#endif
} else {
return;
}

View file

@ -1520,6 +1520,7 @@ void idAsyncServer::ProcessChallengeMessage( const netadr_t from, const idBitMsg
serverPort.SendPacket( from, outMsg.GetData(), outMsg.GetSize() );
#if ID_ENFORCE_KEY_CLIENT
if ( Sys_IsLANAddress( from ) ) {
// no CD Key check for LAN clients
challenges[i].authState = CDK_OK;
@ -1540,6 +1541,12 @@ void idAsyncServer::ProcessChallengeMessage( const netadr_t from, const idBitMsg
serverPort.SendPacket( idAsyncNetwork::GetMasterAddress(), outMsg.GetData(), outMsg.GetSize() );
}
}
#else
if (! Sys_IsLANAddress( from ) ) {
common->Printf( "Build Does not have CD Key Enforcement enabled. Client %s is not a LAN address, but will be accepted\n", Sys_NetAdrToString( from ) );
}
challenges[i].authState = CDK_OK;
#endif
}
/*