aboutsummaryrefslogtreecommitdiffstats
path: root/code/client
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-04-22 22:21:56 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-04-22 22:21:56 +0000
commitf530c9e84b381e7ee6334efd907ec4f30bc02eab (patch)
tree039cb7da404774e596b75fa22d664dce7a188702 /code/client
parent005094d39f4371eb7fa09671ab6b067c0caf0c22 (diff)
downloadioquake3-aero-f530c9e84b381e7ee6334efd907ec4f30bc02eab.tar.gz
ioquake3-aero-f530c9e84b381e7ee6334efd907ec4f30bc02eab.zip
* cl_guid for semi-reliable server authentication (from tjw)
git-svn-id: svn://svn.icculus.org/quake3/trunk@720 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client')
-rw-r--r--code/client/cl_main.c25
-rw-r--r--code/client/client.h3
2 files changed, 28 insertions, 0 deletions
diff --git a/code/client/cl_main.c b/code/client/cl_main.c
index 9d89679..8f9cbae 100644
--- a/code/client/cl_main.c
+++ b/code/client/cl_main.c
@@ -2378,6 +2378,28 @@ void CL_StopVideo_f( void )
CL_CloseAVI( );
}
+static void CL_GenerateQKey(void)
+{
+ int len = 0;
+ unsigned char buff[2048];
+
+ len = FS_ReadFile(QKEY_FILE, NULL);
+ if(len >= (int)sizeof(buff)) {
+ Com_Printf("QKEY found.\n");
+ return;
+ }
+ else {
+ int i;
+ srand(time(0));
+ for(i = 0; i < sizeof(buff) - 1; i++) {
+ buff[i] = (unsigned char)(rand() % 255);
+ }
+ buff[i] = 0;
+ Com_Printf("QKEY generated\n");
+ FS_WriteFile(QKEY_FILE, buff, sizeof(buff));
+ }
+}
+
/*
====================
CL_Init
@@ -2526,6 +2548,9 @@ void CL_Init( void ) {
Cvar_Set( "cl_running", "1" );
+ CL_GenerateQKey();
+ Cvar_Get("cl_guid", Com_MD5File(QKEY_FILE, 0), CVAR_USERINFO | CVAR_ROM);
+
Com_Printf( "----- Client Initialization Complete -----\n" );
}
diff --git a/code/client/client.h b/code/client/client.h
index 73106f8..a9d0006 100644
--- a/code/client/client.h
+++ b/code/client/client.h
@@ -30,6 +30,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../cgame/cg_public.h"
#include "../game/bg_public.h"
+// tjw: file full of random crap that gets used to create cl_guid
+#define QKEY_FILE "qkey"
+
#define RETRANSMIT_TIMEOUT 3000 // time between connection packet retransmits