From: Jim Jagielski Date: Mon, 13 Nov 2017 13:33:14 +0000 (+0000) Subject: Merge r1813643 from trunk: X-Git-Tag: 2.4.30~262 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=943ee35e5a7454575568079d7a1e62f36ea28a5e;p=apache Merge r1813643 from trunk: mod_macro: fix usability of globally defined macros in .htaccess files. PR 57525. Reverts pre_config hook from r1656669 (happens too late for EXEC_ON_READ), and ensures ap_macros is reset on restart with a pconf cleanup. Proposed by: Jose Kahan Reviewed by: ylavic Submitted by: ylavic Reviewed by: ylavic, icing, jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1815101 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 4ce6d1126f..ca258f043c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.30 + *) mod_macro: fix usability of globally defined macros in .htaccess files. + PR 57525. [Jose Kahan , Yann Ylavic] + *) mod_rewrite, core: add the Vary header when a condition evaluates to true and the related RewriteRule is used in a Directory context (triggering an internal redirect). [Luca Toscano] diff --git a/STATUS b/STATUS index 13cb344c1c..989939c258 100644 --- a/STATUS +++ b/STATUS @@ -118,12 +118,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) mod_macro: fix usability of globally defined macros in .htaccess files. - PR 57525. - trunk patch: http://svn.apache.org/r1813643 - 2.4.x patch: trunk works (modulo CHANGES) - svn merge -c 1813643 ^/httpd/httpd/trunk . - +1: ylavic, icing, jim PATCHES PROPOSED TO BACKPORT FROM TRUNK: diff --git a/modules/core/mod_macro.c b/modules/core/mod_macro.c index dae4fcd297..04af43b392 100644 --- a/modules/core/mod_macro.c +++ b/modules/core/mod_macro.c @@ -693,11 +693,17 @@ static const char *macro_section(cmd_parms * cmd, debug(fprintf(stderr, "macro_section: arg='%s'\n", arg)); /* lazy initialization */ - if (ap_macros == NULL) - ap_macros = apr_hash_make(cmd->temp_pool); - ap_assert(ap_macros != NULL); - - pool = apr_hash_pool_get(ap_macros); + if (ap_macros == NULL) { + pool = cmd->pool; + ap_macros = apr_hash_make(pool); + ap_assert(ap_macros != NULL); + apr_pool_cleanup_register(pool, &ap_macros, + ap_pool_cleanup_set_null, + apr_pool_cleanup_null); + } + else { + pool = apr_hash_pool_get(ap_macros); + } endp = (char *) ap_strrchr_c(arg, '>'); @@ -905,12 +911,6 @@ static const char *undef_macro(cmd_parms * cmd, void *dummy, const char *arg) return NULL; } -static int macro_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) -{ - ap_macros = NULL; - return OK; -} - /************************************************************* EXPORT MODULE */ /* @@ -929,11 +929,6 @@ static const command_rec macro_cmds[] = { {NULL} }; -static void macro_hooks(apr_pool_t *p) -{ - ap_hook_pre_config(macro_pre_config, NULL, NULL, APR_HOOK_MIDDLE); -} - /* Module hooks are request-oriented thus it does not suit configuration file utils a lot. I haven't found any clean hook to apply something @@ -951,5 +946,5 @@ AP_DECLARE_MODULE(macro) = { NULL, /* create per-server config structure */ NULL, /* merge per-server config structures */ macro_cmds, /* configuration commands */ - macro_hooks /* register hooks */ + NULL /* register hooks */ };