From: Ben Reser Date: Mon, 7 Apr 2014 22:38:53 +0000 (+0000) Subject: Allow Require expr to work when the expression is quoted. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bbed719b6b52b35cc03c364792f391a7259fbba;p=thirdparty%2Fapache%2Fhttpd.git 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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1585609 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/aaa/mod_authz_core.c b/modules/aaa/mod_authz_core.c index c9ed22ff1cf..e2fad4cd880 100644 --- a/modules/aaa/mod_authz_core.c +++ b/modules/aaa/mod_authz_core.c @@ -1062,6 +1062,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,