From c512345fa2830b7e0f4fe67ab626e9d9ba0644c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Sat, 7 Nov 2015 12:51:11 +0000 Subject: [PATCH] [config] check config option scope; warn if server option is given in conditional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Stefan Bühler git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3049 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/configfile-glue.c | 15 ++- src/configfile.c | 229 ++++++++++++++++++++------------------ src/mod_access.c | 3 +- src/mod_accesslog.c | 3 +- src/mod_alias.c | 3 +- src/mod_auth.c | 7 +- src/mod_cgi.c | 3 +- src/mod_cml.c | 3 +- src/mod_compress.c | 3 +- src/mod_dirlisting.c | 7 +- src/mod_evasive.c | 3 +- src/mod_evhost.c | 3 +- src/mod_expire.c | 3 +- src/mod_extforward.c | 3 +- src/mod_fastcgi.c | 9 +- src/mod_flv_streaming.c | 3 +- src/mod_indexfile.c | 3 +- src/mod_magnet.c | 3 +- src/mod_mysql_vhost.c | 23 ++-- src/mod_proxy.c | 9 +- src/mod_redirect.c | 7 +- src/mod_rewrite.c | 18 ++- src/mod_rrdtool.c | 9 +- src/mod_scgi.c | 9 +- src/mod_secure_download.c | 7 +- src/mod_setenv.c | 3 +- src/mod_simple_vhost.c | 3 +- src/mod_skeleton.c | 3 +- src/mod_ssi.c | 3 +- src/mod_staticfile.c | 3 +- src/mod_status.c | 3 +- src/mod_trigger_b4_dl.c | 3 +- src/mod_uploadprogress.c | 3 +- src/mod_userdir.c | 3 +- src/mod_usertrack.c | 3 +- src/mod_webdav.c | 3 +- src/plugin.h | 4 +- 38 files changed, 235 insertions(+), 191 deletions(-) diff --git a/NEWS b/NEWS index f57eae8d..0b943ef6 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ NEWS * [core] don't buffer request bodies smaller than 64k on disk * add force_assert for many allocations and function results * [mod_secdownload] use a hopefully constant time comparison to check hash (fixes #2679) + * [config] check config option scope; warn if server option is given in conditional - 1.4.37 - 2015-08-30 * [mod_proxy] remove debug log line from error log (fixes #2659) diff --git a/src/configfile-glue.c b/src/configfile-glue.c index 807e3074..c03df11d 100644 --- a/src/configfile-glue.c +++ b/src/configfile-glue.c @@ -24,7 +24,7 @@ /* handle global options */ /* parse config array */ -int config_insert_values_internal(server *srv, array *ca, const config_values_t cv[]) { +int config_insert_values_internal(server *srv, array *ca, const config_values_t cv[], config_scope_type_t scope) { size_t i; data_unset *du; @@ -36,6 +36,14 @@ int config_insert_values_internal(server *srv, array *ca, const config_values_t continue; } + if ((T_CONFIG_SCOPE_SERVER == cv[i].scope) + && (T_CONFIG_SCOPE_SERVER != scope)) { + /* server scope options should only be set in server scope, not in conditionals */ + log_error_write(srv, __FILE__, __LINE__, "ss", + "DEPRECATED: don't set server options in conditionals, variable:", + cv[i].key); + } + switch (cv[i].type) { case T_CONFIG_ARRAY: if (du->type == TYPE_ARRAY) { @@ -135,7 +143,6 @@ int config_insert_values_internal(server *srv, array *ca, const config_values_t } } - log_error_write(srv, __FILE__, __LINE__, "ssb", "got a string but expected an integer:", cv[i].key, ds->value); return -1; @@ -185,7 +192,7 @@ int config_insert_values_internal(server *srv, array *ca, const config_values_t return 0; } -int config_insert_values_global(server *srv, array *ca, const config_values_t cv[]) { +int config_insert_values_global(server *srv, array *ca, const config_values_t cv[], config_scope_type_t scope) { size_t i; data_unset *du; @@ -207,7 +214,7 @@ int config_insert_values_global(server *srv, array *ca, const config_values_t cv array_insert_unique(srv->config_touched, (data_unset *)touched); } - return config_insert_values_internal(srv, ca, cv); + return config_insert_values_internal(srv, ca, cv, scope); } static unsigned short sock_addr_get_port(sock_addr *addr) { diff --git a/src/configfile.c b/src/configfile.c index f1809ac1..4d14ae8c 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -26,130 +26,146 @@ static int config_insert(server *srv) { buffer *stat_cache_string; config_values_t cv[] = { - { "server.bind", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 0 */ - { "server.errorlog", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 1 */ - { "server.errorfile-prefix", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 2 */ - { "server.chroot", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 3 */ - { "server.username", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 4 */ - { "server.groupname", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 5 */ - { "server.port", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 6 */ - { "server.tag", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 7 */ - { "server.use-ipv6", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */ - { "server.modules", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_SERVER }, /* 9 */ + { "server.bind", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 0 */ + { "server.errorlog", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 1 */ + { "server.errorfile-prefix", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 2 */ + { "server.chroot", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 3 */ + { "server.username", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 4 */ + { "server.groupname", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 5 */ + { "server.port", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 6 */ + { "server.tag", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 7 */ + { "server.use-ipv6", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */ + { "server.modules", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_SERVER }, /* 9 */ - { "server.event-handler", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 10 */ - { "server.pid-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 11 */ - { "server.max-request-size", NULL, T_CONFIG_INT, T_CONFIG_SCOPE_CONNECTION }, /* 12 */ - { "server.max-worker", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 13 */ - { "server.document-root", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 14 */ - { "server.force-lowercase-filenames", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },/* 15 */ - { "debug.log-condition-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 16 */ - { "server.max-keep-alive-requests", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },/* 17 */ - { "server.name", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 18 */ - { "server.max-keep-alive-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 19 */ + { "server.event-handler", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 10 */ + { "server.pid-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 11 */ + { "server.max-request-size", NULL, T_CONFIG_INT, T_CONFIG_SCOPE_SERVER }, /* 12 */ + { "server.max-worker", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 13 */ + { "server.document-root", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 14 */ + { "server.force-lowercase-filenames", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 15 */ + { "debug.log-condition-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 16 */ + { "server.max-keep-alive-requests", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 17 */ + { "server.name", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 18 */ + { "server.max-keep-alive-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 19 */ - { "server.max-read-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 20 */ - { "server.max-write-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 21 */ - { "server.error-handler-404", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 22 */ - { "server.max-fds", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 23 */ + { "server.max-read-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 20 */ + { "server.max-write-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 21 */ + { "server.error-handler-404", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 22 */ + { "server.max-fds", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 23 */ #ifdef HAVE_LSTAT - { "server.follow-symlink", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 24 */ + { "server.follow-symlink", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 24 */ #else { "server.follow-symlink", - "Your system lacks lstat(). We can not differ symlinks from files." - "Please remove server.follow-symlinks from your config.", - T_CONFIG_UNSUPPORTED, T_CONFIG_SCOPE_UNSET }, /* 24 */ + "Your system lacks lstat(). We can not differ symlinks from files." + "Please remove server.follow-symlinks from your config.", + T_CONFIG_UNSUPPORTED, T_CONFIG_SCOPE_UNSET }, #endif - { "server.kbytes-per-second", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 25 */ - { "connection.kbytes-per-second", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 26 */ - { "mimetype.use-xattr", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 27 */ - { "mimetype.assign", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 28 */ - { "ssl.pemfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 29 */ + { "server.kbytes-per-second", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 25 */ + { "connection.kbytes-per-second", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 26 */ + { "mimetype.use-xattr", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 27 */ + { "mimetype.assign", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 28 */ + { "ssl.pemfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 29 */ - { "ssl.engine", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 30 */ + { "ssl.engine", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 30 */ + { "debug.log-file-not-found", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 31 */ + { "debug.log-request-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 32 */ + { "debug.log-response-header", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 33 */ + { "debug.log-request-header", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 34 */ + { "debug.log-ssl-noise", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 35 */ + { "server.protocol-http11", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 36 */ + { "debug.log-request-header-on-error", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 37 */ + { "debug.log-state-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 38 */ + { "ssl.ca-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 39 */ - { "debug.log-file-not-found", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 31 */ - { "debug.log-request-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 32 */ - { "debug.log-response-header", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 33 */ - { "debug.log-request-header", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 34 */ - { "debug.log-ssl-noise", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 35 */ + { "server.errorlog-use-syslog", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 40 */ + { "server.range-requests", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 41 */ + { "server.stat-cache-engine", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 42 */ + { "server.max-connections", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 43 */ + { "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 */ + { "ssl.cipher-list", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 47 */ + { "ssl.use-sslv2", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 48 */ + { "etag.use-inode", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 49 */ - { "server.protocol-http11", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 36 */ - { "debug.log-request-header-on-error", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 37 */ - { "debug.log-state-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 38 */ - { "ssl.ca-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 39 */ + { "etag.use-mtime", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 50 */ + { "etag.use-size", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 51 */ + { "server.reject-expect-100-with-417", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 52 */ + { "debug.log-timeouts", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 53 */ + { "server.defer-accept", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 54 */ + { "server.breakagelog", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 55 */ + { "ssl.verifyclient.activate", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 56 */ + { "ssl.verifyclient.enforce", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 57 */ + { "ssl.verifyclient.depth", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 58 */ + { "ssl.verifyclient.username", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 59 */ - { "server.errorlog-use-syslog", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 40 */ - { "server.range-requests", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 41 */ - { "server.stat-cache-engine", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 42 */ - { "server.max-connections", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 43 */ - { "server.network-backend", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 44 */ - { "server.upload-dirs", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 45 */ - { "server.core-files", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 46 */ - { "ssl.cipher-list", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 47 */ - { "ssl.use-sslv2", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 48 */ - { "etag.use-inode", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 49 */ - { "etag.use-mtime", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 50 */ - { "etag.use-size", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 51 */ - { "server.reject-expect-100-with-417", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 52 */ - { "debug.log-timeouts", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 53 */ - { "server.defer-accept", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 54 */ - { "server.breakagelog", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 55 */ - { "ssl.verifyclient.activate", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 56 */ - { "ssl.verifyclient.enforce", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 57 */ - { "ssl.verifyclient.depth", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 58 */ - { "ssl.verifyclient.username", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 59 */ - { "ssl.verifyclient.exportcert", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 60 */ + { "ssl.verifyclient.exportcert", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 60 */ + { "server.set-v6only", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 61 */ + { "ssl.use-sslv3", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 62 */ + { "ssl.dh-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 63 */ + { "ssl.ec-curve", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 64 */ + { "ssl.disable-client-renegotiation", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 65 */ + { "ssl.honor-cipher-order", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 66 */ + { "ssl.empty-fragments", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 67 */ - { "server.set-v6only", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 61 */ - { "ssl.use-sslv3", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 62 */ - { "ssl.dh-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 63 */ - { "ssl.ec-curve", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 64 */ - { "ssl.disable-client-renegotiation", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },/* 65 */ - { "ssl.honor-cipher-order", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 66 */ - { "ssl.empty-fragments", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 67 */ + { "server.host", + "use server.bind instead", + T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, + { "server.docroot", + "use server.document-root instead", + T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, + { "server.virtual-root", + "load mod_simple_vhost and use simple-vhost.server-root instead", + T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, + { "server.virtual-default-host", + "load mod_simple_vhost and use simple-vhost.default-host instead", + T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, + { "server.virtual-docroot", + "load mod_simple_vhost and use simple-vhost.document-root instead", + T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, + { "server.userid", + "use server.username instead", + T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, + { "server.groupid", + "use server.groupname instead", + T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, + { "server.use-keep-alive", + "use server.max-keep-alive-requests = 0 instead", + T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, + { "server.force-lower-case-files", + "use server.force-lowercase-filenames instead", + T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - { "server.host", "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - { "server.docroot", "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - { "server.virtual-root", "load mod_simple_vhost and use simple-vhost.server-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - { "server.virtual-default-host", "load mod_simple_vhost and use simple-vhost.default-host instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - { "server.virtual-docroot", "load mod_simple_vhost and use simple-vhost.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - { "server.userid", "use server.username instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - { "server.groupid", "use server.groupname instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - { "server.use-keep-alive", "use server.max-keep-alive-requests = 0 instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - { "server.force-lower-case-files", "use server.force-lowercase-filenames instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - - { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } + { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } }; - - /* 0 */ + /* all T_CONFIG_SCOPE_SERVER options */ cv[0].destination = srv->srvconf.bindhost; cv[1].destination = srv->srvconf.errorlog_file; cv[3].destination = srv->srvconf.changeroot; cv[4].destination = srv->srvconf.username; cv[5].destination = srv->srvconf.groupname; cv[6].destination = &(srv->srvconf.port); - cv[9].destination = srv->srvconf.modules; + cv[10].destination = srv->srvconf.event_handler; cv[11].destination = srv->srvconf.pid_file; - + cv[12].destination = &(srv->srvconf.max_request_size); cv[13].destination = &(srv->srvconf.max_worker); + cv[23].destination = &(srv->srvconf.max_fds); + cv[37].destination = &(srv->srvconf.log_request_header_on_error); cv[38].destination = &(srv->srvconf.log_state_handling); cv[40].destination = &(srv->srvconf.errorlog_use_syslog); - stat_cache_string = buffer_init(); cv[42].destination = stat_cache_string; + cv[43].destination = &(srv->srvconf.max_conns); cv[44].destination = srv->srvconf.network_backend; cv[45].destination = srv->srvconf.upload_tempdirs; cv[46].destination = &(srv->srvconf.enable_cores); - cv[43].destination = &(srv->srvconf.max_conns); - cv[12].destination = &(srv->srvconf.max_request_size); cv[52].destination = &(srv->srvconf.reject_expect_100_with_417); cv[55].destination = srv->srvconf.breakagelog_file; @@ -158,6 +174,7 @@ static int config_insert(server *srv) { force_assert(srv->config_storage); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; specific_config *s; s = calloc(1, sizeof(specific_config)); @@ -206,69 +223,65 @@ static int config_insert(server *srv) { s->ssl_verifyclient_export_cert = 0; s->ssl_disable_client_renegotiation = 1; + /* all T_CONFIG_SCOPE_CONNECTION options */ cv[2].destination = s->errorfile_prefix; - cv[7].destination = s->server_tag; cv[8].destination = &(s->use_ipv6); - cv[61].destination = &(s->set_v6only); - cv[54].destination = &(s->defer_accept); - - /* 13 max-worker */ cv[14].destination = s->document_root; cv[15].destination = &(s->force_lowercase_filenames); cv[16].destination = &(s->log_condition_handling); cv[17].destination = &(s->max_keep_alive_requests); cv[18].destination = s->server_name; cv[19].destination = &(s->max_keep_alive_idle); + cv[20].destination = &(s->max_read_idle); cv[21].destination = &(s->max_write_idle); cv[22].destination = s->error_handler; #ifdef HAVE_LSTAT cv[24].destination = &(s->follow_symlink); #endif - /* 23 -> max-fds */ cv[25].destination = &(s->global_kbytes_per_second); cv[26].destination = &(s->kbytes_per_second); cv[27].destination = &(s->use_xattr); cv[28].destination = s->mimetypes; cv[29].destination = s->ssl_pemfile; - cv[30].destination = &(s->ssl_enabled); + cv[30].destination = &(s->ssl_enabled); cv[31].destination = &(s->log_file_not_found); cv[32].destination = &(s->log_request_handling); cv[33].destination = &(s->log_response_header); cv[34].destination = &(s->log_request_header); cv[35].destination = &(s->log_ssl_noise); - cv[53].destination = &(s->log_timeouts); - cv[36].destination = &(s->allow_http11); cv[39].destination = s->ssl_ca_file; - cv[41].destination = &(s->range_requests); + cv[41].destination = &(s->range_requests); cv[47].destination = s->ssl_cipher_list; cv[48].destination = &(s->ssl_use_sslv2); - cv[62].destination = &(s->ssl_use_sslv3); - cv[63].destination = s->ssl_dh_file; - cv[64].destination = s->ssl_ec_curve; - cv[66].destination = &(s->ssl_honor_cipher_order); - cv[67].destination = &(s->ssl_empty_fragments); - cv[49].destination = &(s->etag_use_inode); + cv[50].destination = &(s->etag_use_mtime); cv[51].destination = &(s->etag_use_size); - - /* ssl.verify */ + cv[53].destination = &(s->log_timeouts); + cv[54].destination = &(s->defer_accept); cv[56].destination = &(s->ssl_verifyclient); cv[57].destination = &(s->ssl_verifyclient_enforce); cv[58].destination = &(s->ssl_verifyclient_depth); cv[59].destination = s->ssl_verifyclient_username; + cv[60].destination = &(s->ssl_verifyclient_export_cert); + cv[61].destination = &(s->set_v6only); + cv[62].destination = &(s->ssl_use_sslv3); + cv[63].destination = s->ssl_dh_file; + cv[64].destination = s->ssl_ec_curve; cv[65].destination = &(s->ssl_disable_client_renegotiation); + cv[66].destination = &(s->ssl_honor_cipher_order); + cv[67].destination = &(s->ssl_empty_fragments); srv->config_storage[i] = s; - if (0 != (ret = config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv))) { + if (0 != (ret = config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION))) { break; } } diff --git a/src/mod_access.c b/src/mod_access.c index e6a9a14f..4e7a349a 100644 --- a/src/mod_access.c +++ b/src/mod_access.c @@ -66,6 +66,7 @@ SETDEFAULTS_FUNC(mod_access_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -75,7 +76,7 @@ SETDEFAULTS_FUNC(mod_access_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_accesslog.c b/src/mod_accesslog.c index 542a9266..a784401f 100644 --- a/src/mod_accesslog.c +++ b/src/mod_accesslog.c @@ -476,6 +476,7 @@ SETDEFAULTS_FUNC(log_access_open) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -497,7 +498,7 @@ SETDEFAULTS_FUNC(log_access_open) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } diff --git a/src/mod_alias.c b/src/mod_alias.c index f9d7b513..e761286b 100644 --- a/src/mod_alias.c +++ b/src/mod_alias.c @@ -75,6 +75,7 @@ SETDEFAULTS_FUNC(mod_alias_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -83,7 +84,7 @@ SETDEFAULTS_FUNC(mod_alias_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } if (s->alias->used >= 2) { diff --git a/src/mod_auth.c b/src/mod_auth.c index 91106b4a..5b07e52f 100644 --- a/src/mod_auth.c +++ b/src/mod_auth.c @@ -367,10 +367,10 @@ SETDEFAULTS_FUNC(mod_auth_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(mod_auth_plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; mod_auth_plugin_config *s; size_t n; data_array *da; - array *ca; s = calloc(1, sizeof(mod_auth_plugin_config)); s->auth_plain_groupfile = buffer_init(); @@ -413,9 +413,8 @@ SETDEFAULTS_FUNC(mod_auth_set_defaults) { cv[14].destination = &(s->auth_debug); p->config_storage[i] = s; - ca = ((data_config *)srv->config_context->data[i])->value; - if (0 != config_insert_values_global(srv, ca, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } @@ -453,7 +452,7 @@ SETDEFAULTS_FUNC(mod_auth_set_defaults) { #endif /* no auth.require for this section */ - if (NULL == (da = (data_array *)array_get_element(ca, "auth.require"))) continue; + if (NULL == (da = (data_array *)array_get_element(config->value, "auth.require"))) continue; if (da->type != TYPE_ARRAY) continue; diff --git a/src/mod_cgi.c b/src/mod_cgi.c index 9af2c6e6..798edaba 100644 --- a/src/mod_cgi.c +++ b/src/mod_cgi.c @@ -164,6 +164,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) { force_assert(p->config_storage); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -177,7 +178,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_cml.c b/src/mod_cml.c index 98f8d77e..3cdc3b85 100644 --- a/src/mod_cml.c +++ b/src/mod_cml.c @@ -88,6 +88,7 @@ SETDEFAULTS_FUNC(mod_cml_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = malloc(sizeof(plugin_config)); @@ -106,7 +107,7 @@ SETDEFAULTS_FUNC(mod_cml_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } diff --git a/src/mod_compress.c b/src/mod_compress.c index 29d5ab53..510d2f5e 100644 --- a/src/mod_compress.c +++ b/src/mod_compress.c @@ -165,6 +165,7 @@ SETDEFAULTS_FUNC(mod_compress_setdefaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; array *encodings_arr = array_init(); @@ -181,7 +182,7 @@ SETDEFAULTS_FUNC(mod_compress_setdefaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } diff --git a/src/mod_dirlisting.c b/src/mod_dirlisting.c index 48ac9b49..338cb427 100644 --- a/src/mod_dirlisting.c +++ b/src/mod_dirlisting.c @@ -239,8 +239,8 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; - array *ca; data_unset *du_excludes; s = calloc(1, sizeof(plugin_config)); @@ -275,13 +275,12 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) { cv[13].destination = &(s->auto_layout); p->config_storage[i] = s; - ca = ((data_config *)srv->config_context->data[i])->value; - if (0 != config_insert_values_global(srv, ca, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } - if (NULL != (du_excludes = array_get_element(ca, CONFIG_EXCLUDE))) { + if (NULL != (du_excludes = array_get_element(config->value, CONFIG_EXCLUDE))) { array *excludes_list; size_t j; diff --git a/src/mod_evasive.c b/src/mod_evasive.c index da45c9a7..35c64c0a 100644 --- a/src/mod_evasive.c +++ b/src/mod_evasive.c @@ -83,6 +83,7 @@ SETDEFAULTS_FUNC(mod_evasive_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -94,7 +95,7 @@ SETDEFAULTS_FUNC(mod_evasive_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_evhost.c b/src/mod_evhost.c index 3c49adfa..908329bb 100644 --- a/src/mod_evhost.c +++ b/src/mod_evhost.c @@ -131,6 +131,7 @@ SETDEFAULTS_FUNC(mod_evhost_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -142,7 +143,7 @@ SETDEFAULTS_FUNC(mod_evhost_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } diff --git a/src/mod_expire.c b/src/mod_expire.c index 0794c157..1fcfec0e 100644 --- a/src/mod_expire.c +++ b/src/mod_expire.c @@ -225,6 +225,7 @@ SETDEFAULTS_FUNC(mod_expire_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -234,7 +235,7 @@ SETDEFAULTS_FUNC(mod_expire_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } diff --git a/src/mod_extforward.c b/src/mod_extforward.c index 25dde926..bbea336a 100644 --- a/src/mod_extforward.c +++ b/src/mod_extforward.c @@ -168,6 +168,7 @@ SETDEFAULTS_FUNC(mod_extforward_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -179,7 +180,7 @@ SETDEFAULTS_FUNC(mod_extforward_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c index f70a411f..63405ee0 100644 --- a/src/mod_fastcgi.c +++ b/src/mod_fastcgi.c @@ -1172,8 +1172,8 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; - array *ca; s = malloc(sizeof(plugin_config)); s->exts = fastcgi_extensions_init(); @@ -1185,9 +1185,8 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) { cv[2].destination = s->ext_mapping; p->config_storage[i] = s; - ca = ((data_config *)srv->config_context->data[i])->value; - if (0 != config_insert_values_global(srv, ca, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { goto error; } @@ -1195,7 +1194,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) { * = ( ... ) */ - if (NULL != (du = array_get_element(ca, "fastcgi.server"))) { + if (NULL != (du = array_get_element(config->value, "fastcgi.server"))) { size_t j; data_array *da = (data_array *)du; @@ -1305,7 +1304,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) { fcv[14].destination = &(host->kill_signal); fcv[15].destination = &(host->fix_root_path_name); - if (0 != config_insert_values_internal(srv, da_host->value, fcv)) { + if (0 != config_insert_values_internal(srv, da_host->value, fcv, T_CONFIG_SCOPE_CONNECTION)) { goto error; } diff --git a/src/mod_flv_streaming.c b/src/mod_flv_streaming.c index 6e92c742..2a69cf5e 100644 --- a/src/mod_flv_streaming.c +++ b/src/mod_flv_streaming.c @@ -87,6 +87,7 @@ SETDEFAULTS_FUNC(mod_flv_streaming_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -96,7 +97,7 @@ SETDEFAULTS_FUNC(mod_flv_streaming_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_indexfile.c b/src/mod_indexfile.c index 3c57256a..652e74a4 100644 --- a/src/mod_indexfile.c +++ b/src/mod_indexfile.c @@ -84,6 +84,7 @@ SETDEFAULTS_FUNC(mod_indexfile_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -94,7 +95,7 @@ SETDEFAULTS_FUNC(mod_indexfile_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_magnet.c b/src/mod_magnet.c index e3ff290c..056fe493 100644 --- a/src/mod_magnet.c +++ b/src/mod_magnet.c @@ -106,6 +106,7 @@ SETDEFAULTS_FUNC(mod_magnet_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -117,7 +118,7 @@ SETDEFAULTS_FUNC(mod_magnet_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_mysql_vhost.c b/src/mod_mysql_vhost.c index 21260d5c..06fe2828 100644 --- a/src/mod_mysql_vhost.c +++ b/src/mod_mysql_vhost.c @@ -166,20 +166,21 @@ SERVER_FUNC(mod_mysql_vhost_set_defaults) { buffer *sel; config_values_t cv[] = { - { "mysql-vhost.db", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, - { "mysql-vhost.user", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, - { "mysql-vhost.pass", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, - { "mysql-vhost.sock", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, - { "mysql-vhost.sql", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, - { "mysql-vhost.hostname", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, - { "mysql-vhost.port", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, - { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } + { "mysql-vhost.db", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 0 */ + { "mysql-vhost.user", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 1 */ + { "mysql-vhost.pass", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 2 */ + { "mysql-vhost.sock", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 3 */ + { "mysql-vhost.sql", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 4 */ + { "mysql-vhost.hostname", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 5 */ + { "mysql-vhost.port", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 6 */ + { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } }; p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); sel = buffer_init(); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -205,9 +206,9 @@ SERVER_FUNC(mod_mysql_vhost_set_defaults) { p->config_storage[i] = s; - if (config_insert_values_global(srv, - ((data_config *)srv->config_context->data[i])->value, - cv)) return HANDLER_ERROR; + if (config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { + return HANDLER_ERROR; + } s->mysql_pre = buffer_init(); s->mysql_post = buffer_init(); diff --git a/src/mod_proxy.c b/src/mod_proxy.c index bbbdd696..b7d4b438 100644 --- a/src/mod_proxy.c +++ b/src/mod_proxy.c @@ -196,8 +196,8 @@ SETDEFAULTS_FUNC(mod_proxy_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; - array *ca; s = malloc(sizeof(plugin_config)); s->extensions = array_init(); @@ -210,9 +210,8 @@ SETDEFAULTS_FUNC(mod_proxy_set_defaults) { buffer_reset(p->balance_buf); p->config_storage[i] = s; - ca = ((data_config *)srv->config_context->data[i])->value; - if (0 != config_insert_values_global(srv, ca, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } @@ -230,7 +229,7 @@ SETDEFAULTS_FUNC(mod_proxy_set_defaults) { return HANDLER_ERROR; } - if (NULL != (du = array_get_element(ca, "proxy.server"))) { + if (NULL != (du = array_get_element(config->value, "proxy.server"))) { size_t j; data_array *da = (data_array *)du; @@ -296,7 +295,7 @@ SETDEFAULTS_FUNC(mod_proxy_set_defaults) { pcv[0].destination = df->host; pcv[1].destination = &(df->port); - if (0 != config_insert_values_internal(srv, da_host->value, pcv)) { + if (0 != config_insert_values_internal(srv, da_host->value, pcv, T_CONFIG_SCOPE_CONNECTION)) { df->free((data_unset*) df); return HANDLER_ERROR; } diff --git a/src/mod_redirect.c b/src/mod_redirect.c index 769c8c8e..c72c1d37 100644 --- a/src/mod_redirect.c +++ b/src/mod_redirect.c @@ -81,9 +81,9 @@ SETDEFAULTS_FUNC(mod_redirect_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; size_t j; - array *ca; data_unset *du; data_array *da; @@ -95,13 +95,12 @@ SETDEFAULTS_FUNC(mod_redirect_set_defaults) { cv[1].destination = &(s->redirect_code); p->config_storage[i] = s; - ca = ((data_config *)srv->config_context->data[i])->value; - if (0 != config_insert_values_global(srv, ca, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } - if (NULL == (du = array_get_element(ca, "url.redirect"))) { + if (NULL == (du = array_get_element(config->value, "url.redirect"))) { /* no url.redirect defined */ continue; } diff --git a/src/mod_rewrite.c b/src/mod_rewrite.c index 113cc549..464b0826 100644 --- a/src/mod_rewrite.c +++ b/src/mod_rewrite.c @@ -252,7 +252,7 @@ SETDEFAULTS_FUNC(mod_rewrite_set_defaults) { #endif for (i = 0; i < srv->config_context->used; i++) { - array *ca; + data_config const* config = (data_config const*)srv->config_context->data[i]; #ifdef HAVE_PCRE_H plugin_config *s; @@ -262,21 +262,19 @@ SETDEFAULTS_FUNC(mod_rewrite_set_defaults) { p->config_storage[i] = s; #endif - ca = ((data_config *)srv->config_context->data[i])->value; - - if (0 != config_insert_values_global(srv, ca, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } #ifndef HAVE_PCRE_H # define parse_config_entry(srv, ca, x, option, y) parse_config_entry(srv, ca, option) #endif - parse_config_entry(srv, ca, s->rewrite, "url.rewrite-once", 1); - parse_config_entry(srv, ca, s->rewrite, "url.rewrite-final", 1); - parse_config_entry(srv, ca, s->rewrite_NF, "url.rewrite-if-not-file", 1); - parse_config_entry(srv, ca, s->rewrite_NF, "url.rewrite-repeat-if-not-file", 0); - parse_config_entry(srv, ca, s->rewrite, "url.rewrite", 1); - parse_config_entry(srv, ca, s->rewrite, "url.rewrite-repeat", 0); + parse_config_entry(srv, config->value, s->rewrite, "url.rewrite-once", 1); + parse_config_entry(srv, config->value, s->rewrite, "url.rewrite-final", 1); + parse_config_entry(srv, config->value, s->rewrite_NF, "url.rewrite-if-not-file", 1); + parse_config_entry(srv, config->value, s->rewrite_NF, "url.rewrite-repeat-if-not-file", 0); + parse_config_entry(srv, config->value, s->rewrite, "url.rewrite", 1); + parse_config_entry(srv, config->value, s->rewrite, "url.rewrite-repeat", 0); } return HANDLER_GO_ON; diff --git a/src/mod_rrdtool.c b/src/mod_rrdtool.c index 6b8cdaee..b0c41729 100644 --- a/src/mod_rrdtool.c +++ b/src/mod_rrdtool.c @@ -339,9 +339,9 @@ SETDEFAULTS_FUNC(mod_rrd_set_defaults) { size_t i; config_values_t cv[] = { - { "rrdtool.binary", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, - { "rrdtool.db-name", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, - { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } + { "rrdtool.binary", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 0 */ + { "rrdtool.db-name", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 1 */ + { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } }; if (!p) return HANDLER_ERROR; @@ -350,6 +350,7 @@ SETDEFAULTS_FUNC(mod_rrd_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -364,7 +365,7 @@ SETDEFAULTS_FUNC(mod_rrd_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } diff --git a/src/mod_scgi.c b/src/mod_scgi.c index dd87dcd4..4c629a76 100644 --- a/src/mod_scgi.c +++ b/src/mod_scgi.c @@ -939,8 +939,8 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) { force_assert(p->config_storage); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; - array *ca; s = malloc(sizeof(plugin_config)); force_assert(s); @@ -951,9 +951,8 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) { cv[1].destination = &(s->debug); p->config_storage[i] = s; - ca = ((data_config *)srv->config_context->data[i])->value; - if (0 != config_insert_values_global(srv, ca, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { goto error; } @@ -961,7 +960,7 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) { * = ( ... ) */ - if (NULL != (du = array_get_element(ca, "scgi.server"))) { + if (NULL != (du = array_get_element(config->value, "scgi.server"))) { size_t j; data_array *da = (data_array *)du; @@ -1064,7 +1063,7 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) { fcv[13].destination = &(df->fix_root_path_name); - if (0 != config_insert_values_internal(srv, da_host->value, fcv)) { + if (0 != config_insert_values_internal(srv, da_host->value, fcv, T_CONFIG_SCOPE_CONNECTION)) { goto error; } diff --git a/src/mod_secure_download.c b/src/mod_secure_download.c index 34539da6..3a41bbc4 100644 --- a/src/mod_secure_download.c +++ b/src/mod_secure_download.c @@ -8,6 +8,10 @@ #include #include +#ifdef USE_OPENSSL +#include +#endif + #include "md5.h" #define HASHLEN 16 @@ -112,6 +116,7 @@ SETDEFAULTS_FUNC(mod_secdownload_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -127,7 +132,7 @@ SETDEFAULTS_FUNC(mod_secdownload_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_setenv.c b/src/mod_setenv.c index 34075c13..04d9a1a4 100644 --- a/src/mod_setenv.c +++ b/src/mod_setenv.c @@ -101,6 +101,7 @@ SETDEFAULTS_FUNC(mod_setenv_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -114,7 +115,7 @@ SETDEFAULTS_FUNC(mod_setenv_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_simple_vhost.c b/src/mod_simple_vhost.c index fec8d54b..2d0daec8 100644 --- a/src/mod_simple_vhost.c +++ b/src/mod_simple_vhost.c @@ -92,6 +92,7 @@ SETDEFAULTS_FUNC(mod_simple_vhost_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -114,7 +115,7 @@ SETDEFAULTS_FUNC(mod_simple_vhost_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_skeleton.c b/src/mod_skeleton.c index f6c088af..d1819ffa 100644 --- a/src/mod_skeleton.c +++ b/src/mod_skeleton.c @@ -111,6 +111,7 @@ SETDEFAULTS_FUNC(mod_skeleton_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -120,7 +121,7 @@ SETDEFAULTS_FUNC(mod_skeleton_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_ssi.c b/src/mod_ssi.c index 07b695d7..8afacc43 100644 --- a/src/mod_ssi.c +++ b/src/mod_ssi.c @@ -113,6 +113,7 @@ SETDEFAULTS_FUNC(mod_ssi_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -124,7 +125,7 @@ SETDEFAULTS_FUNC(mod_ssi_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c index 22929bb1..6560c975 100644 --- a/src/mod_staticfile.c +++ b/src/mod_staticfile.c @@ -96,6 +96,7 @@ SETDEFAULTS_FUNC(mod_staticfile_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -109,7 +110,7 @@ SETDEFAULTS_FUNC(mod_staticfile_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_status.c b/src/mod_status.c index 708a1690..3bfb7f5c 100644 --- a/src/mod_status.c +++ b/src/mod_status.c @@ -118,6 +118,7 @@ SETDEFAULTS_FUNC(mod_status_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -133,7 +134,7 @@ SETDEFAULTS_FUNC(mod_status_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_trigger_b4_dl.c b/src/mod_trigger_b4_dl.c index 197bf69f..79a6a3c9 100644 --- a/src/mod_trigger_b4_dl.c +++ b/src/mod_trigger_b4_dl.c @@ -148,6 +148,7 @@ SETDEFAULTS_FUNC(mod_trigger_b4_dl_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; #if defined(HAVE_PCRE_H) const char *errptr; @@ -173,7 +174,7 @@ SETDEFAULTS_FUNC(mod_trigger_b4_dl_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } #if defined(HAVE_GDBM_H) diff --git a/src/mod_uploadprogress.c b/src/mod_uploadprogress.c index ce7cc69c..0c4f001c 100644 --- a/src/mod_uploadprogress.c +++ b/src/mod_uploadprogress.c @@ -206,6 +206,7 @@ SETDEFAULTS_FUNC(mod_uploadprogress_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -215,7 +216,7 @@ SETDEFAULTS_FUNC(mod_uploadprogress_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_userdir.c b/src/mod_userdir.c index f6f1d8ac..d2193d99 100644 --- a/src/mod_userdir.c +++ b/src/mod_userdir.c @@ -101,6 +101,7 @@ SETDEFAULTS_FUNC(mod_userdir_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -122,7 +123,7 @@ SETDEFAULTS_FUNC(mod_userdir_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } } diff --git a/src/mod_usertrack.c b/src/mod_usertrack.c index 3adedcfd..eacef0fc 100644 --- a/src/mod_usertrack.c +++ b/src/mod_usertrack.c @@ -83,6 +83,7 @@ SETDEFAULTS_FUNC(mod_usertrack_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -96,7 +97,7 @@ SETDEFAULTS_FUNC(mod_usertrack_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } diff --git a/src/mod_webdav.c b/src/mod_webdav.c index 2c1fe87c..445f4e22 100644 --- a/src/mod_webdav.c +++ b/src/mod_webdav.c @@ -182,6 +182,7 @@ SETDEFAULTS_FUNC(mod_webdav_set_defaults) { p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { + data_config const* config = (data_config const*)srv->config_context->data[i]; plugin_config *s; s = calloc(1, sizeof(plugin_config)); @@ -194,7 +195,7 @@ SETDEFAULTS_FUNC(mod_webdav_set_defaults) { p->config_storage[i] = s; - if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) { + if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) { return HANDLER_ERROR; } diff --git a/src/plugin.h b/src/plugin.h index cadce54d..73533626 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -82,8 +82,8 @@ handler_t plugins_call_init(server *srv); handler_t plugins_call_set_defaults(server *srv); handler_t plugins_call_cleanup(server *srv); -int config_insert_values_global(server *srv, array *ca, const config_values_t *cv); -int config_insert_values_internal(server *srv, array *ca, const config_values_t *cv); +int config_insert_values_global(server *srv, array *ca, const config_values_t *cv, config_scope_type_t scope); +int config_insert_values_internal(server *srv, array *ca, const config_values_t *cv, config_scope_type_t scope); int config_setup_connection(server *srv, connection *con); int config_patch_connection(server *srv, connection *con, comp_key_t comp); int config_check_cond(server *srv, connection *con, data_config *dc);