mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-14 00:21:16 +00:00
* cl_guid for semi-reliable server authentication (from tjw)
This commit is contained in:
parent
68b9eb3fba
commit
8aecee5158
4 changed files with 31 additions and 0 deletions
2
Makefile
2
Makefile
|
@ -779,6 +779,7 @@ Q3OBJ = \
|
||||||
$(B)/client/cvar.o \
|
$(B)/client/cvar.o \
|
||||||
$(B)/client/files.o \
|
$(B)/client/files.o \
|
||||||
$(B)/client/md4.o \
|
$(B)/client/md4.o \
|
||||||
|
$(B)/client/md5.o \
|
||||||
$(B)/client/msg.o \
|
$(B)/client/msg.o \
|
||||||
$(B)/client/net_chan.o \
|
$(B)/client/net_chan.o \
|
||||||
$(B)/client/huffman.o \
|
$(B)/client/huffman.o \
|
||||||
|
@ -1029,6 +1030,7 @@ $(B)/client/common.o : $(CMDIR)/common.c; $(DO_CC)
|
||||||
$(B)/client/cvar.o : $(CMDIR)/cvar.c; $(DO_CC)
|
$(B)/client/cvar.o : $(CMDIR)/cvar.c; $(DO_CC)
|
||||||
$(B)/client/files.o : $(CMDIR)/files.c; $(DO_CC)
|
$(B)/client/files.o : $(CMDIR)/files.c; $(DO_CC)
|
||||||
$(B)/client/md4.o : $(CMDIR)/md4.c; $(DO_CC)
|
$(B)/client/md4.o : $(CMDIR)/md4.c; $(DO_CC)
|
||||||
|
$(B)/client/md5.o : $(CMDIR)/md5.c; $(DO_CC)
|
||||||
$(B)/client/msg.o : $(CMDIR)/msg.c; $(DO_CC)
|
$(B)/client/msg.o : $(CMDIR)/msg.c; $(DO_CC)
|
||||||
$(B)/client/net_chan.o : $(CMDIR)/net_chan.c; $(DO_CC)
|
$(B)/client/net_chan.o : $(CMDIR)/net_chan.c; $(DO_CC)
|
||||||
$(B)/client/huffman.o : $(CMDIR)/huffman.c; $(DO_CC)
|
$(B)/client/huffman.o : $(CMDIR)/huffman.c; $(DO_CC)
|
||||||
|
|
|
@ -2378,6 +2378,28 @@ void CL_StopVideo_f( void )
|
||||||
CL_CloseAVI( );
|
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
|
CL_Init
|
||||||
|
@ -2526,6 +2548,9 @@ void CL_Init( void ) {
|
||||||
|
|
||||||
Cvar_Set( "cl_running", "1" );
|
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" );
|
Com_Printf( "----- Client Initialization Complete -----\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#include "../cgame/cg_public.h"
|
#include "../cgame/cg_public.h"
|
||||||
#include "../game/bg_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
|
#define RETRANSMIT_TIMEOUT 3000 // time between connection packet retransmits
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -729,6 +729,7 @@ void Com_Quit_f( void );
|
||||||
int Com_EventLoop( void );
|
int Com_EventLoop( void );
|
||||||
int Com_Milliseconds( void ); // will be journaled properly
|
int Com_Milliseconds( void ); // will be journaled properly
|
||||||
unsigned Com_BlockChecksum( const void *buffer, int length );
|
unsigned Com_BlockChecksum( const void *buffer, int length );
|
||||||
|
char *Com_MD5File(const char *filename, int length);
|
||||||
int Com_HashKey(char *string, int maxlen);
|
int Com_HashKey(char *string, int maxlen);
|
||||||
int Com_Filter(char *filter, char *name, int casesensitive);
|
int Com_Filter(char *filter, char *name, int casesensitive);
|
||||||
int Com_FilterPath(char *filter, char *name, int casesensitive);
|
int Com_FilterPath(char *filter, char *name, int casesensitive);
|
||||||
|
|
Loading…
Reference in a new issue