From cc1c2f0e379907793c9878be57e4577f1a3efb90 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sat, 17 Nov 2018 22:26:18 -0500 Subject: [PATCH] [core] server.compat-module-load = "disable" controls whether default and compatibility modules are loaded, including default modules mod_indexfile, mod_staticfile, mod_dirlisting and if mod_authn* modules are loaded when mod_auth in server.modules and if mod_openssl is loaded when ssl. directives are seen default: server.compat-module-load = "enable" (preserve existing behavior) recommended config: explicitly load desired modules in desired order --- src/base.h | 2 ++ src/configfile.c | 5 +++-- src/server.c | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/base.h b/src/base.h index 25726146..46a82983 100644 --- a/src/base.h +++ b/src/base.h @@ -345,6 +345,8 @@ typedef struct { time_t loadts; double loadavg[3]; buffer *syslog_facility; + + unsigned short compat_module_load; } server_config; typedef struct server_socket { diff --git a/src/configfile.c b/src/configfile.c index 2c315aa7..9c7ff249 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -235,7 +235,7 @@ static int config_insert(server *srv) { { "server.network-backend", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 44 */ { "server.upload-dirs", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_SERVER }, /* 45 */ { "server.core-files", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 46 */ - { "unused-slot-moved-to-mod-openssl", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 47 */ + { "server.compat-module-load", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 47 */ { "unused-slot-moved-to-mod-openssl", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 48 */ { "etag.use-inode", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 49 */ @@ -302,6 +302,7 @@ static int config_insert(server *srv) { cv[44].destination = srv->srvconf.network_backend; cv[45].destination = srv->srvconf.upload_tempdirs; cv[46].destination = &(srv->srvconf.enable_cores); + cv[47].destination = &(srv->srvconf.compat_module_load); cv[52].destination = &(srv->srvconf.reject_expect_100_with_417); cv[55].destination = srv->srvconf.breakagelog_file; @@ -542,7 +543,7 @@ static int config_insert(server *srv) { log_error_write(srv, __FILE__, __LINE__, "s", "unexpected value for server.modules; expected list of \"mod_xxxxxx\" strings"); ret = HANDLER_ERROR; - } else { + } else if (srv->srvconf.compat_module_load) { data_string *ds; int prepend_mod_indexfile = 1; int append_mod_dirlisting = 1; diff --git a/src/server.c b/src/server.c index b4279dcf..85b2f4a8 100644 --- a/src/server.c +++ b/src/server.c @@ -300,6 +300,7 @@ static server *server_init(void) { srv->srvconf.loadavg[0] = 0.0; srv->srvconf.loadavg[1] = 0.0; srv->srvconf.loadavg[2] = 0.0; + srv->srvconf.compat_module_load = 1; /* use syslog */ srv->errorlog_fd = STDERR_FILENO;