altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.37-r1842929+.patch

59234c
# ./pullrev.sh 1842929 1842931
59234c
http://svn.apache.org/viewvc?view=revision&revision=1842929
59234c
http://svn.apache.org/viewvc?view=revision&revision=1842931
59234c
59234c
--- httpd-2.4.37/acinclude.m4.r1842929+
59234c
+++ httpd-2.4.37/acinclude.m4
59234c
@@ -45,6 +45,7 @@
59234c
   APACHE_SUBST(installbuilddir)
59234c
   APACHE_SUBST(runtimedir)
59234c
   APACHE_SUBST(proxycachedir)
59234c
+  APACHE_SUBST(statedir)
59234c
   APACHE_SUBST(other_targets)
59234c
   APACHE_SUBST(progname)
59234c
   APACHE_SUBST(prefix)
59234c
@@ -663,6 +664,7 @@
59234c
   APACHE_SUBST_EXPANDED_ARG(runtimedir)
59234c
   APACHE_SUBST_EXPANDED_ARG(logfiledir)
59234c
   APACHE_SUBST_EXPANDED_ARG(proxycachedir)
59234c
+  APACHE_SUBST_EXPANDED_ARG(statedir)
59234c
 ])
59234c
 
59234c
 dnl 
59234c
--- httpd-2.4.37/config.layout.r1842929+
59234c
+++ httpd-2.4.37/config.layout
59234c
@@ -29,6 +29,7 @@
59234c
     includedir:    ${prefix}/include
59234c
     localstatedir: ${prefix}
59234c
     runtimedir:    ${localstatedir}/logs
59234c
+    statedir:      ${localstatedir}/state
59234c
     logfiledir:    ${localstatedir}/logs
59234c
     proxycachedir: ${localstatedir}/proxy
59234c
 </Layout>
59234c
@@ -54,6 +55,7 @@
59234c
     includedir:    ${prefix}/include+
59234c
     localstatedir: ${prefix}/var+
59234c
     runtimedir:    ${localstatedir}/run
59234c
+    statedir:      ${localstatedir}/state
59234c
     logfiledir:    ${localstatedir}/log
59234c
     proxycachedir: ${localstatedir}/proxy
59234c
 </Layout>
59234c
@@ -78,6 +80,7 @@
59234c
     includedir:    /System/Library/Frameworks/Apache.framework/Versions/2.0/Headers
59234c
     localstatedir: /var
59234c
     runtimedir:    ${prefix}/Logs
59234c
+    statedir:      ${prefix}/State
59234c
     logfiledir:    ${prefix}/Logs
59234c
     proxycachedir: ${prefix}/ProxyCache
59234c
 </Layout>
59234c
@@ -102,6 +105,7 @@
59234c
     includedir:    ${prefix}/include+
59234c
     localstatedir: /var
59234c
     runtimedir:    ${localstatedir}/run
59234c
+    statedir:      ${localstatedir}/state
59234c
     logfiledir:    ${localstatedir}/log+
59234c
     proxycachedir: ${runtimedir}/proxy
59234c
 </Layout>
59234c
@@ -126,6 +130,7 @@
59234c
     includedir:    ${prefix}/include/apache
59234c
     localstatedir: /var
59234c
     runtimedir:    ${localstatedir}/run
59234c
+    statedir:      ${localstatedir}/lib/httpd
59234c
     logfiledir:    ${localstatedir}/log/httpd
59234c
     proxycachedir: ${localstatedir}/cache/httpd
59234c
 </Layout>     
59234c
@@ -151,6 +156,7 @@
59234c
     includedir:    ${prefix}/include/httpd
59234c
     runtimedir:    /run/httpd
59234c
     logfiledir:    ${localstatedir}/log/httpd
59234c
+    statedir:      ${localstatedir}/lib/httpd
59234c
     proxycachedir: ${localstatedir}/cache/httpd/proxy
59234c
 </Layout>     
59234c
 
59234c
@@ -175,6 +181,7 @@
59234c
     localstatedir: /var${prefix}
59234c
     runtimedir:    ${localstatedir}/run
59234c
     logfiledir:    ${localstatedir}/logs
59234c
+    statedir:      ${localstatedir}/state
59234c
     proxycachedir: ${localstatedir}/proxy
59234c
 </Layout>
59234c
 
59234c
@@ -197,6 +204,7 @@
59234c
     cgidir:        ${datadir}/cgi-bin
59234c
     includedir:    ${prefix}/include/apache
59234c
     localstatedir: /var/lib/httpd
59234c
+    statedir:      ${localstatedir}
59234c
     runtimedir:    /var/run
59234c
     logfiledir:    /var/log/httpd
59234c
     proxycachedir: /var/cache/httpd
59234c
@@ -223,6 +231,7 @@
59234c
     localstatedir: /var
59234c
     runtimedir:    ${localstatedir}/run
59234c
     logfiledir:    ${localstatedir}/log/httpd
59234c
+    statedir:      ${prefix}/state
59234c
     proxycachedir: ${localstatedir}/proxy
59234c
 </Layout>
59234c
 
59234c
@@ -246,6 +255,7 @@
59234c
     includedir:    ${exec_prefix}/include
59234c
     localstatedir: ${prefix}
59234c
     runtimedir:    /var/run
59234c
+    statedir:      ${datadir}/state
59234c
     logfiledir:    ${datadir}/logs
59234c
     proxycachedir: ${datadir}/proxy
59234c
 </Layout>
59234c
@@ -271,6 +281,7 @@
59234c
     localstatedir: ${prefix}
59234c
     runtimedir:    ${prefix}/logs
59234c
     logfiledir:    ${prefix}/logs
59234c
+    statedir:      ${prefix}/state
59234c
     proxycachedir: ${prefix}/proxy
59234c
 </Layout>
59234c
 
59234c
@@ -315,6 +326,7 @@
59234c
     cgidir:        ${prefix}/usr/lib/cgi-bin
59234c
     includedir:    ${exec_prefix}/include/apache2
59234c
     localstatedir: ${prefix}/var/lock/apache2
59234c
+    statedir:      ${prefix}/var/lib/apache2
59234c
     runtimedir:    ${prefix}/var/run/apache2
59234c
     logfiledir:    ${prefix}/var/log/apache2
59234c
     proxycachedir: ${prefix}/var/cache/apache2/proxy
59234c
@@ -343,6 +355,7 @@
59234c
     manualdir:     ${datadir}/manual
59234c
     cgidir:        ${datadir}/cgi-bin
59234c
     runtimedir:    ${localstatedir}/run
59234c
+    runtimedir:    ${localstatedir}/lib/httpd
59234c
     logfiledir:    ${localstatedir}/log/httpd
59234c
     proxycachedir: ${localstatedir}/cache/httpd/cache-root
59234c
 </Layout>
59234c
@@ -366,6 +379,7 @@
59234c
     manualdir:     ${prefix}/manual
59234c
     includedir:    ${prefix}/include
59234c
     localstatedir: /var/httpd
59234c
+    statedir:      ${localstatedir}/state
59234c
     runtimedir:    ${localstatedir}/run
59234c
     logfiledir:    ${localstatedir}/logs
59234c
     proxycachedir: ${localstatedir}/proxy
59234c
@@ -391,6 +405,7 @@
59234c
     includedir:      ${prefix}/include/httpd
59234c
     localstatedir:   /var
59234c
     runtimedir:      ${localstatedir}/run/httpd
59234c
+    statedir:        ${localstatedir}/lib/httpd
59234c
     logfiledir:      ${localstatedir}/log/httpd
59234c
     proxycachedir:   ${localstatedir}/cache/httpd
59234c
 </Layout>
59234c
--- httpd-2.4.37/configure.in.r1842929+
59234c
+++ httpd-2.4.37/configure.in
59234c
@@ -41,7 +41,7 @@
59234c
 AC_PREFIX_DEFAULT(/usr/local/apache2)
59234c
 
59234c
 dnl Get the layout here, so we can pass the required variables to apr
59234c
-APR_ENABLE_LAYOUT(Apache, [errordir iconsdir htdocsdir cgidir])
59234c
+APR_ENABLE_LAYOUT(Apache, [errordir iconsdir htdocsdir cgidir statedir])
59234c
 
59234c
 dnl reparse the configure arguments.
59234c
 APR_PARSE_ARGUMENTS
59234c
--- httpd-2.4.37/include/ap_config_layout.h.in.r1842929+
59234c
+++ httpd-2.4.37/include/ap_config_layout.h.in
59234c
@@ -60,5 +60,7 @@
59234c
 #define DEFAULT_REL_LOGFILEDIR "@rel_logfiledir@"
59234c
 #define DEFAULT_EXP_PROXYCACHEDIR "@exp_proxycachedir@"
59234c
 #define DEFAULT_REL_PROXYCACHEDIR "@rel_proxycachedir@"
59234c
+#define DEFAULT_EXP_STATEDIR "@exp_statedir@"
59234c
+#define DEFAULT_REL_STATEDIR "@rel_statedir@"
59234c
 
59234c
 #endif /* AP_CONFIG_LAYOUT_H */
59234c
--- httpd-2.4.37/include/http_config.h.r1842929+
59234c
+++ httpd-2.4.37/include/http_config.h
59234c
@@ -757,6 +757,14 @@
59234c
  */
59234c
 AP_DECLARE(char *) ap_runtime_dir_relative(apr_pool_t *p, const char *fname);
59234c
 
59234c
+/**
59234c
+ * Compute the name of a persistent state file (e.g. a database or
59234c
+ * long-lived cache) relative to the appropriate state directory.
59234c
+ * Absolute paths are returned as-is.  The state directory is
59234c
+ * configured via the DefaultStateDir directive or at build time.
59234c
+ */
59234c
+AP_DECLARE(char *) ap_state_dir_relative(apr_pool_t *p, const char *fname);
59234c
+
59234c
 /* Finally, the hook for dynamically loading modules in... */
59234c
 
59234c
 /**
59234c
--- httpd-2.4.37/Makefile.in.r1842929+
59234c
+++ httpd-2.4.37/Makefile.in
59234c
@@ -213,6 +213,7 @@
59234c
 install-other:
59234c
 	@test -d $(DESTDIR)$(logfiledir) || $(MKINSTALLDIRS) $(DESTDIR)$(logfiledir)
59234c
 	@test -d $(DESTDIR)$(runtimedir) || $(MKINSTALLDIRS) $(DESTDIR)$(runtimedir)
59234c
+	@test -d $(DESTDIR)$(statedir) || $(MKINSTALLDIRS) $(DESTDIR)$(statedir)
59234c
 	@for ext in dll x; do \
59234c
 		file=apachecore.$$ext; \
59234c
 		if test -f $$file; then \
59234c
--- httpd-2.4.37/modules/dav/fs/mod_dav_fs.c.r1842929+
59234c
+++ httpd-2.4.37/modules/dav/fs/mod_dav_fs.c
59234c
@@ -29,6 +29,10 @@
59234c
 
59234c
 extern module AP_MODULE_DECLARE_DATA dav_fs_module;
59234c
 
59234c
+#ifndef DEFAULT_DAV_LOCKDB
59234c
+#define DEFAULT_DAV_LOCKDB "davlockdb"
59234c
+#endif
59234c
+
59234c
 const char *dav_get_lockdb_path(const request_rec *r)
59234c
 {
59234c
     dav_fs_server_conf *conf;
59234c
@@ -39,7 +43,11 @@
59234c
 
59234c
 static void *dav_fs_create_server_config(apr_pool_t *p, server_rec *s)
59234c
 {
59234c
-    return apr_pcalloc(p, sizeof(dav_fs_server_conf));
59234c
+    dav_fs_server_conf *conf = apr_pcalloc(p, sizeof(dav_fs_server_conf));
59234c
+
59234c
+    conf->lockdb_path = ap_state_dir_relative(p, DEFAULT_DAV_LOCKDB);
59234c
+
59234c
+    return conf;
59234c
 }
59234c
 
59234c
 static void *dav_fs_merge_server_config(apr_pool_t *p,
59234c
--- httpd-2.4.37/modules/md/mod_md_config.c.r1842929+
59234c
+++ httpd-2.4.37/modules/md/mod_md_config.c
59234c
@@ -54,10 +54,14 @@
59234c
 
59234c
 #define DEF_VAL     (-1)
59234c
 
59234c
+#ifndef MD_DEFAULT_BASE_DIR
59234c
+#define MD_DEFAULT_BASE_DIR "state/md"
59234c
+#endif
59234c
+
59234c
 /* Default settings for the global conf */
59234c
 static md_mod_conf_t defmc = {
59234c
     NULL,
59234c
-    "md",
59234c
+    NULL,
59234c
     NULL,
59234c
     NULL,
59234c
     80,
59234c
@@ -112,6 +116,7 @@
59234c
         memcpy(mod_md_config, &defmc, sizeof(*mod_md_config));
59234c
         mod_md_config->mds = apr_array_make(pool, 5, sizeof(const md_t *));
59234c
         mod_md_config->unused_names = apr_array_make(pool, 5, sizeof(const md_t *));
59234c
+        mod_md_config->base_dir = ap_state_dir_relative(pool, MD_DEFAULT_BASE_DIR);
59234c
         
59234c
         apr_pool_cleanup_register(pool, NULL, cleanup_mod_config, apr_pool_cleanup_null);
59234c
     }
59234c
--- httpd-2.4.37/server/core.c.r1842929+
59234c
+++ httpd-2.4.37/server/core.c
59234c
@@ -129,6 +129,8 @@
59234c
 AP_DECLARE_DATA int ap_run_mode = AP_SQ_RM_UNKNOWN;
59234c
 AP_DECLARE_DATA int ap_config_generation = 0;
59234c
 
59234c
+static const char *core_state_dir;
59234c
+
59234c
 static void *create_core_dir_config(apr_pool_t *a, char *dir)
59234c
 {
59234c
     core_dir_config *conf;
59234c
@@ -3104,6 +3106,24 @@
59234c
     return NULL;
59234c
 }
59234c
 
59234c
+static const char *set_state_dir(cmd_parms *cmd, void *dummy, const char *arg)
59234c
+{
59234c
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
59234c
+
59234c
+    if (err != NULL) {
59234c
+        return err;
59234c
+    }
59234c
+
59234c
+    if ((apr_filepath_merge((char**)&core_state_dir, NULL,
59234c
+                            ap_server_root_relative(cmd->temp_pool, arg),
59234c
+                            APR_FILEPATH_TRUENAME, cmd->pool) != APR_SUCCESS)
59234c
+        || !ap_is_directory(cmd->temp_pool, core_state_dir)) {
59234c
+        return "DefaultStateDir must be a valid directory, absolute or relative to ServerRoot";
59234c
+    }
59234c
+
59234c
+    return NULL;
59234c
+}
59234c
+
59234c
 static const char *set_timeout(cmd_parms *cmd, void *dummy, const char *arg)
59234c
 {
59234c
     const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_CONTEXT);
59234c
@@ -4398,6 +4418,8 @@
59234c
   "Common directory of server-related files (logs, confs, etc.)"),
59234c
 AP_INIT_TAKE1("DefaultRuntimeDir", set_runtime_dir, NULL, RSRC_CONF | EXEC_ON_READ,
59234c
   "Common directory for run-time files (shared memory, locks, etc.)"),
59234c
+AP_INIT_TAKE1("DefaultStateDir", set_state_dir, NULL, RSRC_CONF | EXEC_ON_READ,
59234c
+  "Common directory for persistent state (databases, long-lived caches, etc.)"),
59234c
 AP_INIT_TAKE1("ErrorLog", set_server_string_slot,
59234c
   (void *)APR_OFFSETOF(server_rec, error_fname), RSRC_CONF,
59234c
   "The filename of the error log"),
59234c
@@ -5150,6 +5172,27 @@
59234c
     }
59234c
 }
59234c
 
59234c
+AP_DECLARE(char *) ap_state_dir_relative(apr_pool_t *p, const char *file)
59234c
+{
59234c
+    char *newpath = NULL;
59234c
+    apr_status_t rv;
59234c
+    const char *state_dir;
59234c
+
59234c
+    state_dir = core_state_dir
59234c
+        ? core_state_dir
59234c
+        : ap_server_root_relative(p, DEFAULT_REL_STATEDIR);
59234c
+
59234c
+    rv = apr_filepath_merge(&newpath, state_dir, file, APR_FILEPATH_TRUENAME, p);
59234c
+    if (newpath && (rv == APR_SUCCESS || APR_STATUS_IS_EPATHWILD(rv)
59234c
+                                      || APR_STATUS_IS_ENOENT(rv)
59234c
+                                      || APR_STATUS_IS_ENOTDIR(rv))) {
59234c
+        return newpath;
59234c
+    }
59234c
+    else {
59234c
+        return NULL;
59234c
+    }
59234c
+}
59234c
+
59234c
 static apr_random_t *rng = NULL;
59234c
 #if APR_HAS_THREADS
59234c
 static apr_thread_mutex_t *rng_mutex = NULL;