summaryrefslogtreecommitdiff
path: root/src/cl_main.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2011-04-04 14:10:51 +0400
committerAndrey Nazarov <skuller@skuller.net>2011-04-07 14:23:30 +0400
commitf071b8eb6c993f608c1361fba3fc9a7262289afc (patch)
tree0318cea66b9ab07835faba1c271509228de388f2 /src/cl_main.c
parent9b8ed7c2035d622dd10153848c3b4ed9d32c50d7 (diff)
Allow downloads to be disabled permanently.
Setting ‘allow_download’ variable to -1 will force the client to disable downloads until it is restarted. This can be used as a protection measure from malicious (or just stupid) servers that force downloads by stuffing commands.
Diffstat (limited to 'src/cl_main.c')
-rw-r--r--src/cl_main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cl_main.c b/src/cl_main.c
index 4a8adc8..e3accd5 100644
--- a/src/cl_main.c
+++ b/src/cl_main.c
@@ -2501,6 +2501,15 @@ static void cl_sync_changed( cvar_t *self ) {
CL_UpdateFrameTimes();
}
+// allow downloads to be permanently disabled as a
+// protection measure from malicious (or just stupid) servers
+// that force downloads by stuffing commands
+static void cl_allow_download_changed( cvar_t *self ) {
+ if( self->integer == -1 ) {
+ self->flags |= CVAR_ROM;
+ }
+}
+
static const cmdreg_t c_client[] = {
{ "cmd", CL_ForwardToServer_f },
{ "pause", CL_Pause_f },
@@ -2644,6 +2653,9 @@ static void CL_InitLocal ( void ) {
cl_vwep = Cvar_Get ( "cl_vwep", "1", CVAR_ARCHIVE );
cl_vwep->changed = cl_vwep_changed;
+ allow_download->changed = cl_allow_download_changed;
+ cl_allow_download_changed( allow_download );
+
//
// userinfo
//