httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r1857731 - in /httpd/httpd/trunk: modules/dav/fs/mod_dav_fs.c modules/md/mod_md_config.c server/core.c
Date Thu, 18 Apr 2019 10:25:33 GMT
Author: jorton
Date: Thu Apr 18 10:25:33 2019
New Revision: 1857731

URL: http://svn.apache.org/viewvc?rev=1857731&view=rev
Log:
Fix use of StateDir directive after r1852982:

* server/core.c (reset_config): Rename from reset_config_defines;
  tie core_state_dir to pconf lifetime in this cleanup.
  (core_pre_config): Adjust accordingly.

* modules/md/mod_md_config.c (md_config_post_config): Pick up base_dir
  from statedir in post-config phase so StateDir can influence it.

* modules/dav/fs/mod_dav_fs.c (dav_fs_create_server_config): Don't
  init lockdb_path here.  (dav_fs_post_config): New function; set
  lockdb_path based on configured statedir. 

Modified:
    httpd/httpd/trunk/modules/dav/fs/mod_dav_fs.c
    httpd/httpd/trunk/modules/md/mod_md_config.c
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/modules/dav/fs/mod_dav_fs.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/fs/mod_dav_fs.c?rev=1857731&r1=1857730&r2=1857731&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/fs/mod_dav_fs.c (original)
+++ httpd/httpd/trunk/modules/dav/fs/mod_dav_fs.c Thu Apr 18 10:25:33 2019
@@ -46,11 +46,7 @@ const char *dav_get_lockdb_path(const re
 
 static void *dav_fs_create_server_config(apr_pool_t *p, server_rec *s)
 {
-    dav_fs_server_conf *conf = apr_pcalloc(p, sizeof(dav_fs_server_conf));
-
-    conf->lockdb_path = ap_state_dir_relative(p, DEFAULT_DAV_LOCKDB);
-
-    return conf;
+    return apr_pcalloc(p, sizeof(dav_fs_server_conf));
 }
 
 static void *dav_fs_merge_server_config(apr_pool_t *p,
@@ -68,6 +64,24 @@ static void *dav_fs_merge_server_config(
     return newconf;
 }
 
+static apr_status_t dav_fs_post_config(apr_pool_t *p, apr_pool_t *plog,
+                                       apr_pool_t *ptemp, server_rec *base_server)
+{
+    server_rec *s;
+
+    for (s = base_server; s; s = s->next) {
+        dav_fs_server_conf *conf;
+
+        conf = ap_get_module_config(s->module_config, &dav_fs_module);
+
+        if (!conf->lockdb_path) {
+            conf->lockdb_path = ap_state_dir_relative(p, DEFAULT_DAV_LOCKDB);
+        }
+    }
+
+    return OK;
+}
+
 /*
  * Command handler for the DAVLockDB directive, which is TAKE1
  */
@@ -98,6 +112,8 @@ static const command_rec dav_fs_cmds[] =
 
 static void register_hooks(apr_pool_t *p)
 {
+    ap_hook_post_config(dav_fs_post_config, NULL, NULL, APR_HOOK_MIDDLE);
+
     dav_hook_gather_propsets(dav_fs_gather_propsets, NULL, NULL,
                              APR_HOOK_MIDDLE);
     dav_hook_find_liveprop(dav_fs_find_liveprop, NULL, NULL, APR_HOOK_MIDDLE);

Modified: httpd/httpd/trunk/modules/md/mod_md_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/md/mod_md_config.c?rev=1857731&r1=1857730&r2=1857731&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/md/mod_md_config.c (original)
+++ httpd/httpd/trunk/modules/md/mod_md_config.c Thu Apr 18 10:25:33 2019
@@ -121,11 +121,6 @@ static md_mod_conf_t *md_mod_conf_get(ap
         mod_md_config->mds = apr_array_make(pool, 5, sizeof(const md_t *));
         mod_md_config->unused_names = apr_array_make(pool, 5, sizeof(const md_t *));
         
-#if AP_MODULE_MAGIC_AT_LEAST(20180906, 2)
-        mod_md_config->base_dir = ap_state_dir_relative(pool,
-                                                        MD_DEFAULT_BASE_DIR);
-#endif
-
         apr_pool_cleanup_register(pool, NULL, cleanup_mod_config, apr_pool_cleanup_null);
     }
     
@@ -877,6 +872,12 @@ apr_status_t md_config_post_config(serve
     if (mc->hsts_max_age > 0) {
         mc->hsts_header = apr_psprintf(p, "max-age=%d", mc->hsts_max_age);
     }
+
+#if AP_MODULE_MAGIC_AT_LEAST(20180906, 2)
+    if (mc->base_dir == NULL) {
+        mc->base_dir = ap_state_dir_relative(p, MD_DEFAULT_BASE_DIR);
+    }
+#endif
     
     return APR_SUCCESS;
 }

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1857731&r1=1857730&r2=1857731&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Thu Apr 18 10:25:33 2019
@@ -1489,12 +1489,15 @@ AP_DECLARE(const char *) ap_resolve_env(
     return res_buf;
 }
 
-static int reset_config_defines(void *dummy)
+/* pconf cleanup - clear global variables set from config here. */
+static apr_status_t reset_config(void *dummy)
 {
     ap_server_config_defines = saved_server_config_defines;
     saved_server_config_defines = NULL;
     server_config_defined_vars = NULL;
-    return OK;
+    core_state_dir = NULL;
+
+    return APR_SUCCESS;
 }
 
 /*
@@ -5294,13 +5297,11 @@ static int core_pre_config(apr_pool_t *p
 
     if (!saved_server_config_defines)
         init_config_defines(pconf);
-    apr_pool_cleanup_register(pconf, NULL, reset_config_defines,
-                              apr_pool_cleanup_null);
+    apr_pool_cleanup_register(pconf, NULL, reset_config, apr_pool_cleanup_null);
 
     ap_regcomp_set_default_cflags(AP_REG_DOLLAR_ENDONLY);
 
     mpm_common_pre_config(pconf);
-    core_state_dir = NULL;
 
     return OK;
 }



Mime
View raw message