]> granicus.if.org Git - apache/commitdiff
Merge r1585609 from trunk:
authorJim Jagielski <jim@apache.org>
Thu, 7 May 2015 16:28:38 +0000 (16:28 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 7 May 2015 16:28:38 +0000 (16:28 +0000)
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

STATUS
modules/aaa/mod_authz_core.c

diff --git a/STATUS b/STATUS
index 92f823527f7582aef258d9f7d54ad656098c2872..050511324614a7056009d3f9a85591de25ebb2b5 100644 (file)
--- 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:
index c68b56bd3169b9617659678696dd80f9bd7aa8df..d70e6965cff0d0399cad0f631a2f1da665586fdb 100644 (file)
@@ -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,