Permalink
Browse files

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
  • Loading branch information...
1 parent fe0ee16 commit b13c131e4e9fc152d4aab26d8d70333f0edc68d6 @DanielGibson DanielGibson committed Nov 13, 2012
@@ -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
/*
@@ -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();
@@ -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;
}
@@ -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
}
/*

1 comment on commit b13c131

Member

DanielGibson commented on b13c131 Nov 13, 2012

Note that you still need a valid CD-Key to even start dhewm3.

Please sign in to comment.