Implement a simple download filter.

`cl_nodownload_list` is a whitespace seperated list of strings, files
containing one of these strings in their name are never downloaded. Set
to `.dll .dylib .so` by default to prevent downloading libraries which
can be injected into client.

Closes #1114.
This commit is contained in:
Yamagi 2024-06-22 16:52:42 +02:00
parent d5c7845271
commit 468f90ad48
4 changed files with 20 additions and 2 deletions

View File

@ -138,14 +138,18 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
loading. If set to `0` pause mode is never entered, this is the loading. If set to `0` pause mode is never entered, this is the
Vanilla Quake II behaviour. Vanilla Quake II behaviour.
* **cl_model_preview_start**: start frame value in multiplayer model * **cl_model_preview_start**: Start frame value in multiplayer model
preview. `-1` - don't show animation. Defaults to `84` for show preview. `-1` - don't show animation. Defaults to `84` for show
salute animation. salute animation.
* **cl_model_preview_end**: end frame value in multiplayer model * **cl_model_preview_end**: End frame value in multiplayer model
preview. `-1` - don't show animation. Defaults to `94` for show preview. `-1` - don't show animation. Defaults to `94` for show
salute animation. salute animation.
* **cl_nodownload_list**: Whitespace seperated list of strings, files
having one these strings in their name are never downloaded. Set to
`.dll .dylib .so` by default.
* **cl_r1q2_lightstyle**: Since the first release Yamagi Quake II used * **cl_r1q2_lightstyle**: Since the first release Yamagi Quake II used
the R1Q2 colors for the dynamic lights of rockets. Set to `0` to get the R1Q2 colors for the dynamic lights of rockets. Set to `0` to get
the Vanilla Quake II colors. Defaults to `1`. the Vanilla Quake II colors. Defaults to `1`.

View File

@ -571,6 +571,17 @@ CL_CheckOrDownloadFile(char *filename)
return true; return true;
} }
char *nodownload = strtok(cl_nodownload_list->string, " ");
while (nodownload != NULL)
{
if (Q_strcasestr(filename, nodownload))
{
Com_Printf("Filename is filtered by cl_nodownload_list: %s\n", filename);
return true;
}
nodownload = strtok(NULL, " ");
}
#ifdef USE_CURL #ifdef USE_CURL
if (!forceudp) if (!forceudp)
{ {

View File

@ -51,6 +51,7 @@ cvar_t *cl_add_entities;
cvar_t *cl_add_blend; cvar_t *cl_add_blend;
cvar_t *cl_kickangles; cvar_t *cl_kickangles;
cvar_t *cl_laseralpha; cvar_t *cl_laseralpha;
cvar_t *cl_nodownload_list;
cvar_t *cl_shownet; cvar_t *cl_shownet;
cvar_t *cl_showmiss; cvar_t *cl_showmiss;
@ -517,6 +518,7 @@ CL_InitLocal(void)
cl_showfps = Cvar_Get("cl_showfps", "0", CVAR_ARCHIVE); cl_showfps = Cvar_Get("cl_showfps", "0", CVAR_ARCHIVE);
cl_showspeed = Cvar_Get("cl_showspeed", "0", CVAR_ARCHIVE); cl_showspeed = Cvar_Get("cl_showspeed", "0", CVAR_ARCHIVE);
cl_laseralpha = Cvar_Get("cl_laseralpha", "0.3", 0); cl_laseralpha = Cvar_Get("cl_laseralpha", "0.3", 0);
cl_nodownload_list = Cvar_Get("cl_nodownload_list", ".dll .dylib .so", 0);
cl_upspeed = Cvar_Get("cl_upspeed", "200", 0); cl_upspeed = Cvar_Get("cl_upspeed", "200", 0);
cl_forwardspeed = Cvar_Get("cl_forwardspeed", "200", 0); cl_forwardspeed = Cvar_Get("cl_forwardspeed", "200", 0);

View File

@ -317,6 +317,7 @@ extern cvar_t *cl_kickangles;
extern cvar_t *cl_r1q2_lightstyle; extern cvar_t *cl_r1q2_lightstyle;
extern cvar_t *cl_limitsparksounds; extern cvar_t *cl_limitsparksounds;
extern cvar_t *cl_laseralpha; extern cvar_t *cl_laseralpha;
extern cvar_t *cl_nodownload_list;
typedef struct typedef struct
{ {