mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
More bad actor cvars
This commit is contained in:
parent
30ca69e51d
commit
630555ca51
4 changed files with 42 additions and 7 deletions
|
|
@ -183,6 +183,9 @@ consvar_t cv_allowguests = CVAR_INIT ("allowguests", "On", CV_SAVE, CV_OnOff, NU
|
|||
consvar_t cv_nochallenge = CVAR_INIT ("nochallenge", "0", 0, CV_Unsigned, NULL);
|
||||
consvar_t cv_badresults = CVAR_INIT ("badresults", "0", 0, CV_Unsigned, NULL);
|
||||
consvar_t cv_noresults = CVAR_INIT ("noresults", "0", 0, CV_Unsigned, NULL);
|
||||
consvar_t cv_badjointime = CVAR_INIT ("badjointime", "0", 0, CV_Unsigned, NULL);
|
||||
consvar_t cv_badip = CVAR_INIT ("badip", "0", 0, CV_Unsigned, NULL);
|
||||
consvar_t cv_badchallengetime = CVAR_INIT ("badchallengetime", "0", 0, CV_Unsigned, NULL);
|
||||
#endif
|
||||
|
||||
// engine
|
||||
|
|
@ -6330,7 +6333,15 @@ static void UpdateChallenges(void)
|
|||
|
||||
// Random noise so it's difficult to reuse the response
|
||||
// Current time so that difficult to reuse the challenge
|
||||
const time_t now = time(NULL);
|
||||
time_t now = time(NULL);
|
||||
#ifdef DEVELOP
|
||||
if (cv_badchallengetime.value)
|
||||
{
|
||||
CV_AddValue(&cv_badchallengetime, -1);
|
||||
CONS_Alert(CONS_WARNING, "cv_badchallengetime enabled, scrubbing time from PT_CHALLENGEALL\n");
|
||||
now = 0;
|
||||
}
|
||||
#endif
|
||||
CONS_Printf("now: %ld, gamemap: %hd\n", now, gamemap);
|
||||
csprng(netbuffer->u.challengeall.secret, sizeof(netbuffer->u.challengeall.secret));
|
||||
memcpy(netbuffer->u.challengeall.secret, &now, sizeof(now)); // First few bytes are the timestamp...
|
||||
|
|
|
|||
|
|
@ -530,6 +530,9 @@ extern consvar_t cv_allowguests;
|
|||
extern consvar_t cv_nochallenge;
|
||||
extern consvar_t cv_badresults;
|
||||
extern consvar_t cv_noresults;
|
||||
extern consvar_t cv_badjointime;
|
||||
extern consvar_t cv_badip;
|
||||
extern consvar_t cv_badchallengetime;
|
||||
#endif
|
||||
|
||||
// Used in d_net, the only dependence
|
||||
|
|
|
|||
|
|
@ -949,13 +949,16 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_allowguests);
|
||||
|
||||
#ifdef DEVELOP
|
||||
CV_RegisterVar(&cv_badjoin); // implemented
|
||||
CV_RegisterVar(&cv_badtraffic); // implemented
|
||||
CV_RegisterVar(&cv_badresponse); // implemented
|
||||
CV_RegisterVar(&cv_badjoin);
|
||||
CV_RegisterVar(&cv_badtraffic);
|
||||
CV_RegisterVar(&cv_badresponse);
|
||||
CV_RegisterVar(&cv_noresponse);
|
||||
CV_RegisterVar(&cv_nochallenge); // implemented
|
||||
CV_RegisterVar(&cv_badresults); // implemented
|
||||
CV_RegisterVar(&cv_noresults); // implemented
|
||||
CV_RegisterVar(&cv_nochallenge);
|
||||
CV_RegisterVar(&cv_badresults);
|
||||
CV_RegisterVar(&cv_noresults);
|
||||
CV_RegisterVar(&cv_badjointime);
|
||||
CV_RegisterVar(&cv_badip);
|
||||
CV_RegisterVar(&cv_badchallengetime);
|
||||
#endif
|
||||
|
||||
// HUD
|
||||
|
|
|
|||
|
|
@ -1325,11 +1325,29 @@ void PT_ClientKey(INT32 node)
|
|||
netbuffer->packettype = PT_SERVERCHALLENGE;
|
||||
time_t now = time(NULL);
|
||||
|
||||
#ifdef DEVELOP
|
||||
if (cv_badjointime.value)
|
||||
{
|
||||
CV_AddValue(&cv_badjointime, -1);
|
||||
CONS_Alert(CONS_WARNING, "cv_badjointime enabled, scrubbing time from PT_SERVERCHALLENGE\n");
|
||||
now = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Include our IP and current time in the message to be signed, to guard against signature reuse.
|
||||
csprng(lastSentChallenge[node], sizeof(serverchallenge_pak));
|
||||
memcpy(lastSentChallenge[node], &ourIP, sizeof(ourIP));
|
||||
memcpy(lastSentChallenge[node] + sizeof(ourIP), &now, sizeof(time_t));
|
||||
|
||||
#ifdef DEVELOP
|
||||
if (cv_badip.value)
|
||||
{
|
||||
CV_AddValue(&cv_badip, -1);
|
||||
CONS_Alert(CONS_WARNING, "cv_badip enabled, scrubbing IP from PT_SERVERCHALLENGE\n");
|
||||
memset(lastSentChallenge[node], 0, sizeof(ourIP));
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(&netbuffer->u.serverchallenge, lastSentChallenge[node], sizeof(serverchallenge_pak));
|
||||
HSendPacket(node, false, 0, sizeof (serverchallenge_pak));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue