mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-22 20:11:44 +00:00
fix some compile bugs...
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5657 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
b63dc8b880
commit
73af4c8bf1
2 changed files with 12 additions and 14 deletions
|
@ -2324,6 +2324,10 @@ static void PM_PackageEnabled(package_t *p)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifndef HAVE_CLIENT
|
||||
#define Menu_Prompt(cb,ctx,msg,yes,no,cancel) Con_Printf(CON_WARNING msg "\n")
|
||||
#endif
|
||||
|
||||
if (FS_NativePath(ef->name, p->fsroot, native, sizeof(native)) && Sys_SetUpdatedBinary(native))
|
||||
Menu_Prompt(NULL, NULL, "Engine binary updated.\nRestart to use.", NULL, NULL, NULL);
|
||||
else
|
||||
|
|
|
@ -793,17 +793,12 @@ static svm_server_t *SVM_Heartbeat(const char *gamename, netadr_t *adr, int numc
|
|||
return server;
|
||||
}
|
||||
|
||||
#ifdef TCPCONNECT
|
||||
void tobase64(unsigned char *out, int outlen, unsigned char *in, int inlen);
|
||||
#endif
|
||||
void SVM_GenChallenge(char *out, size_t outsize, netadr_t *foradr)
|
||||
{ //this function needs to return some sort of unguessable string so that you can't spoof the server with fake responses
|
||||
char adr[64];
|
||||
static char randumb[16];
|
||||
const unsigned char *strings[] = {randumb, (const unsigned char *)NET_AdrToString(adr, sizeof(adr), foradr)};
|
||||
size_t lengths[] = {sizeof(randumb)-1, strlen(strings[1])};
|
||||
char digest[4*5];
|
||||
int digestsize;
|
||||
char digest[256];
|
||||
void *ctx = alloca(hash_sha1.contextsize);
|
||||
|
||||
if (!*randumb)
|
||||
{
|
||||
|
@ -813,15 +808,14 @@ void SVM_GenChallenge(char *out, size_t outsize, netadr_t *foradr)
|
|||
while (!randumb[i])
|
||||
randumb[i] = rand();
|
||||
}
|
||||
NET_AdrToString(adr, sizeof(adr), foradr);
|
||||
|
||||
digestsize = SHA1_m(digest, sizeof(digest), countof(lengths), strings, lengths);
|
||||
hash_sha1.init(ctx);
|
||||
hash_sha1.process(ctx, randumb, sizeof(randumb)-1);
|
||||
hash_sha1.process(ctx, adr, strlen(adr));
|
||||
hash_sha1.terminate(digest, ctx);
|
||||
|
||||
#ifdef TCPCONNECT
|
||||
tobase64(out, outsize, digest, min(16, digestsize)); //truncate it, so its not excessive
|
||||
#else
|
||||
Q_snprintfz(out, outsize, "%08x", *(int*)digest);
|
||||
(void)digestsize;
|
||||
#endif
|
||||
Base64_EncodeBlock(digest, hash_sha1.digestsize, out, outsize);
|
||||
}
|
||||
|
||||
//switch net_from's reported connection, so we reply from a different udp socket from the one a packet was received from.
|
||||
|
|
Loading…
Reference in a new issue