mirror of
https://github.com/rehlds/rehlds.git
synced 2025-02-05 18:20:45 +03:00
Hash cdkey once when client connected
This commit is contained in:
parent
8276436809
commit
55da681497
@ -2317,7 +2317,7 @@ void EXT_FUNC SV_ConnectClient_internal(void)
|
|||||||
char userinfo[1024];
|
char userinfo[1024];
|
||||||
#endif
|
#endif
|
||||||
char protinfo[1024];
|
char protinfo[1024];
|
||||||
char cdkey[64];
|
char cdkey[64] = {};
|
||||||
const char *s;
|
const char *s;
|
||||||
char name[32];
|
char name[32];
|
||||||
char szRawCertificate[512];
|
char szRawCertificate[512];
|
||||||
@ -2508,9 +2508,16 @@ void EXT_FUNC SV_ConnectClient_internal(void)
|
|||||||
{
|
{
|
||||||
Con_DPrintf("Client %s connected\nAdr: %s\n", name, NET_AdrToString(host_client->netchan.remote_address));
|
Con_DPrintf("Client %s connected\nAdr: %s\n", name, NET_AdrToString(host_client->netchan.remote_address));
|
||||||
}
|
}
|
||||||
|
#ifndef REHLDS_OPT_PEDANTIC
|
||||||
Q_strncpy(host_client->hashedcdkey, cdkey, 32);
|
Q_strncpy(host_client->hashedcdkey, cdkey, 32);
|
||||||
|
host_client->hashedcdkey[32] = '\0';
|
||||||
|
#else
|
||||||
|
MD5Context_t ctx;
|
||||||
|
MD5Init(&ctx);
|
||||||
|
MD5Update(&ctx, (unsigned char *)cdkey, sizeof(cdkey));
|
||||||
|
MD5Final((unsigned char *)host_client->hashedcdkey, &ctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
host_client->hashedcdkey[32] = 0;
|
|
||||||
host_client->active = FALSE;
|
host_client->active = FALSE;
|
||||||
host_client->spawned = FALSE;
|
host_client->spawned = FALSE;
|
||||||
host_client->connected = TRUE;
|
host_client->connected = TRUE;
|
||||||
@ -3801,18 +3808,26 @@ int SV_CalcPing(client_t *cl)
|
|||||||
void EXT_FUNC SV_WriteFullClientUpdate_internal(IGameClient *client, char *info, size_t maxlen, sizebuf_t *sb, IGameClient *receiver)
|
void EXT_FUNC SV_WriteFullClientUpdate_internal(IGameClient *client, char *info, size_t maxlen, sizebuf_t *sb, IGameClient *receiver)
|
||||||
{
|
{
|
||||||
client_t* cl = client->GetClient();
|
client_t* cl = client->GetClient();
|
||||||
MD5Context_t ctx;
|
|
||||||
|
#ifndef REHLDS_OPT_PEDANTIC
|
||||||
unsigned char digest[16];
|
unsigned char digest[16];
|
||||||
|
|
||||||
|
MD5Context_t ctx;
|
||||||
MD5Init(&ctx);
|
MD5Init(&ctx);
|
||||||
MD5Update(&ctx, (unsigned char*)cl->hashedcdkey, sizeof(cl->hashedcdkey));
|
MD5Update(&ctx, (unsigned char*)cl->hashedcdkey, sizeof(cl->hashedcdkey));
|
||||||
MD5Final(digest, &ctx);
|
MD5Final(digest, &ctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
MSG_WriteByte(sb, svc_updateuserinfo);
|
MSG_WriteByte(sb, svc_updateuserinfo);
|
||||||
MSG_WriteByte(sb, cl - g_psvs.clients);
|
MSG_WriteByte(sb, cl - g_psvs.clients);
|
||||||
MSG_WriteLong(sb, cl->userid);
|
MSG_WriteLong(sb, cl->userid);
|
||||||
MSG_WriteString(sb, info);
|
MSG_WriteString(sb, info);
|
||||||
|
|
||||||
|
#ifndef REHLDS_OPT_PEDANTIC
|
||||||
MSG_WriteBuf(sb, sizeof(digest), digest);
|
MSG_WriteBuf(sb, sizeof(digest), digest);
|
||||||
|
#else
|
||||||
|
MSG_WriteBuf(sb, 16, cl->hashedcdkey);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SV_SendFullClientUpdateForAll(client_t *client)
|
void SV_SendFullClientUpdateForAll(client_t *client)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user