From: Jim Jagielski Date: Thu, 7 May 2015 16:28:38 +0000 (+0000) Subject: Merge r1585609 from trunk: X-Git-Tag: 2.4.13~120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af0dcd59d7992e0dd963577bf9f016cab7dd093c;p=apache Merge r1585609 from trunk: Allow Require expr to work when the expression is quoted. For example as appears in our documentation: Require expr "%{TIME_HOUR} -ge 9 && %{TIME_HOUR} -le 17" PR: 56235 Submitted by: breser Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1678236 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 92f823527f..0505113246 100644 --- a/STATUS +++ b/STATUS @@ -105,11 +105,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) mod_authz_core: Allow "Require expr" to work when the expression is quoted, - as in an example in the doc. PR 56235 - trunk patch: http://svn.apache.org/r1585609 - 2.4.x patch: trunk works (modulo CHANGES) - +1: druggeri, breser, ylavic PATCHES PROPOSED TO BACKPORT FROM TRUNK: diff --git a/modules/aaa/mod_authz_core.c b/modules/aaa/mod_authz_core.c index c68b56bd31..d70e6965cf 100644 --- a/modules/aaa/mod_authz_core.c +++ b/modules/aaa/mod_authz_core.c @@ -1069,6 +1069,16 @@ static const char *expr_parse_config(cmd_parms *cmd, const char *require_line, const char *expr_err = NULL; struct require_expr_info *info = apr_pcalloc(cmd->pool, sizeof(*info)); + /* if the expression happens to be surrounded by quotes, skip them */ + if (require_line[0] == '"') { + apr_size_t len = strlen(require_line); + + if (require_line[len-1] == '"') + require_line = apr_pstrndup(cmd->temp_pool, + require_line + 1, + len - 2); + } + apr_pool_userdata_setn(info, REQUIRE_EXPR_NOTE, apr_pool_cleanup_null, cmd->temp_pool); info->expr = ap_expr_parse_cmd(cmd, require_line, 0, &expr_err,