From: Rainer Jung Date: Mon, 23 Jul 2012 16:43:56 +0000 (+0000) Subject: Honor DefaultRuntimeDir for mutexes, socache and CGID socket. X-Git-Tag: 2.4.3~196 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ccb604fc81df17e159016b4363e9a0d8f94b8b51;p=apache Honor DefaultRuntimeDir for mutexes, socache and CGID socket. Move away from DEFAULT_REL_RUNTIMEDIR and use ap_runtime_dir_relative() API. Backport of r1299718 from trunk. Submitted by: jim Reviwed by: rjung, trawick Backported by: rjung git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1364709 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index b375d746ec..f8a696e859 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,9 @@ Changes with Apache 2.4.3 possible XSS for a site where untrusted users can upload files to a location with MultiViews enabled. [Niels Heinen ] + *) Honor DefaultRuntimeDir for mutexes, socache and CGID socket. + [Jim Jagielski] + *) ab: Fix bind() errors. [Joe Orton] *) mpm_event: Don't do a blocking write when starting a lingering close diff --git a/STATUS b/STATUS index 2b2c7c4487..a7deec0906 100644 --- a/STATUS +++ b/STATUS @@ -88,11 +88,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * various: Move away from DEFAULT_REL_RUNTIMEDIR and use - ap_runtime_dir_relative() API. - trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1299718 - 2.4.x patch: trunk patch works - +1: rjung, jim, trawick PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/cache/mod_socache_dbm.c b/modules/cache/mod_socache_dbm.c index 70fe28bf25..0d7c302baf 100644 --- a/modules/cache/mod_socache_dbm.c +++ b/modules/cache/mod_socache_dbm.c @@ -53,7 +53,7 @@ struct ap_socache_instance_t { */ #define DBM_FILE_MODE ( APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD ) -#define DEFAULT_DBM_PREFIX DEFAULT_REL_RUNTIMEDIR "/socache-dbm-" +#define DEFAULT_DBM_PREFIX "socache-dbm-" /* ### this should use apr_dbm_usednames. */ #if !defined(DBM_FILE_SUFFIX_DIR) && !defined(DBM_FILE_SUFFIX_PAG) @@ -127,7 +127,7 @@ static apr_status_t socache_dbm_init(ap_socache_instance_t *ctx, const char *path = apr_pstrcat(p, DEFAULT_DBM_PREFIX, namespace, NULL); - ctx->data_file = ap_server_root_relative(p, path); + ctx->data_file = ap_runtime_dir_relative(p, path); if (ctx->data_file == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00803) diff --git a/modules/cache/mod_socache_shmcb.c b/modules/cache/mod_socache_shmcb.c index ff4defd338..4c892d07ce 100644 --- a/modules/cache/mod_socache_shmcb.c +++ b/modules/cache/mod_socache_shmcb.c @@ -32,7 +32,7 @@ #define SHMCB_MAX_SIZE (64 * 1024 * 1024) -#define DEFAULT_SHMCB_PREFIX DEFAULT_REL_RUNTIMEDIR "/socache-shmcb-" +#define DEFAULT_SHMCB_PREFIX "socache-shmcb-" #define DEFAULT_SHMCB_SUFFIX ".cache" @@ -341,7 +341,7 @@ static apr_status_t socache_shmcb_init(ap_socache_instance_t *ctx, const char *path = apr_pstrcat(p, DEFAULT_SHMCB_PREFIX, namespace, DEFAULT_SHMCB_SUFFIX, NULL); - ctx->data_file = ap_server_root_relative(p, path); + ctx->data_file = ap_runtime_dir_relative(p, path); } /* Use anonymous shm by default, fall back on name-based. */ diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index 2c2e627211..1155bd7501 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -135,7 +135,7 @@ static int is_scriptaliased(request_rec *r) #define DEFAULT_LOGBYTES 10385760 #define DEFAULT_BUFBYTES 1024 -#define DEFAULT_SOCKET DEFAULT_REL_RUNTIMEDIR "/cgisock" +#define DEFAULT_SOCKET "cgisock" #define CGI_REQ 1 #define SSI_REQ 2 @@ -910,6 +910,7 @@ static int cgid_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, procnew->err = procnew->in = procnew->out = NULL; apr_pool_userdata_set((const void *)procnew, userdata_key, apr_pool_cleanup_null, main_server->process->pool); + return ret; } else { procnew = data; @@ -922,7 +923,7 @@ static int cgid_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, total_modules++; parent_pid = getpid(); - tmp_sockname = ap_server_root_relative(p, sockname); + tmp_sockname = ap_runtime_dir_relative(p, sockname); if (strlen(tmp_sockname) > sizeof(server_addr->sun_path) - 1) { tmp_sockname[sizeof(server_addr->sun_path)] = '\0'; ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server, APLOGNO(01254) @@ -1016,7 +1017,7 @@ static const char *set_script_socket(cmd_parms *cmd, void *dummy, const char *ar /* Make sure the pid is appended to the sockname */ sockname = ap_append_pid(cmd->pool, arg, "."); - sockname = ap_server_root_relative(cmd->pool, sockname); + sockname = ap_runtime_dir_relative(cmd->pool, sockname); if (!sockname) { return apr_pstrcat(cmd->pool, "Invalid ScriptSock path", diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 2b4f97bd8f..d0cf59b4cb 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -180,7 +180,7 @@ static void chdir_for_gprof(void) } } else { - use_dir = ap_server_root_relative(pconf, DEFAULT_REL_RUNTIMEDIR); + use_dir = ap_runtime_dir_relative(pconf, ""); } chdir(use_dir); diff --git a/server/util_mutex.c b/server/util_mutex.c index 0ff9483d21..e49cca5570 100644 --- a/server/util_mutex.c +++ b/server/util_mutex.c @@ -157,7 +157,7 @@ AP_DECLARE_NONSTD(void) ap_mutex_init(apr_pool_t *p) /* initialize default mutex configuration */ def = apr_pcalloc(p, sizeof *def); def->mech = APR_LOCK_DEFAULT; - def->dir = DEFAULT_REL_RUNTIMEDIR; + def->dir = ap_runtime_dir_relative(p, ""); apr_hash_set(mxcfg_by_type, "default", APR_HASH_KEY_STRING, def); }