From: divverent Date: Mon, 25 May 2009 15:33:13 +0000 (+0000) Subject: srcon: add random digits to the the time X-Git-Tag: xonotic-v0.1.0preview~1630 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d8afcd1f69e506f67485f36647efa05d5fbc44e8;p=xonotic%2Fdarkplaces.git srcon: add random digits to the the time goal is to prevent replay attacks in a later change and increasing the time sync threshold git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8989 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host_cmd.c b/host_cmd.c index 053c5581..adceca5e 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -2399,7 +2399,7 @@ void Host_Rcon_f (void) // credit: taken from QuakeWorld { char buf[1500]; char argbuf[1500]; - dpsnprintf(argbuf, sizeof(argbuf), "%ld %s", (long) time(NULL), Cmd_Args()); + dpsnprintf(argbuf, sizeof(argbuf), "%ld.%06d %s", (long) time(NULL), (int) (random() % 1000000), Cmd_Args()); memcpy(buf, "\377\377\377\377srcon HMAC-MD4 TIME ", 24); if(HMAC_MDFOUR_16BYTES((unsigned char *) (buf + 24), (unsigned char *) argbuf, strlen(argbuf), (unsigned char *) rcon_password.string, strlen(rcon_password.string))) {