From: Paul J. Reder Date: Thu, 5 Feb 2004 18:41:59 +0000 (+0000) Subject: *) mod_setenvif: Fix the regex optimizer, which under circumstances X-Git-Tag: 2.0.49~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=009ddedf4bca1438ca68615a8046e56ca15f6b5a;p=thirdparty%2Fapache%2Fhttpd.git *) mod_setenvif: Fix the regex optimizer, which under circumstances treated the supplied regex as literal string. PR 24219. Submitted by: Andr�� Malo Reviewed by: jerenkrantz, trawick, rederpj git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@102516 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 4752f548b2c..056721ee2ae 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.49 + *) mod_setenvif: Fix the regex optimizer, which under circumstances + treated the supplied regex as literal string. PR 24219. + [André Malo] + *) ap_mpm.h: Fix include guard of ap_mpm.h to reference mpm instead of mmn. [André Malo] diff --git a/STATUS b/STATUS index 0386bb49ba0..cdd4e6b76aa 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2004/02/05 15:55:39 $] +Last modified at [$Date: 2004/02/05 18:41:58 $] Release: @@ -230,11 +230,6 @@ PATCHES TO BACKPORT FROM 2.1 nd replies: But if it can't be 0 the alternatives thereafter make no sense anymore, right? - * mod_setenvif: Fix optimizer to treat regexps as such even if they - only contain anchors like \b. PR 24219. - modules/metadata/mod_setenvif.c: r1.44, r1.46 - +1: nd, jerenkrantz, trawick - * LDAP cache fixes from Matthieu Estrade; see PR 18756 include/util_ldap.h r1.12 modules/experimental/util_ldap.c r1.15, r1.16 diff --git a/modules/metadata/mod_setenvif.c b/modules/metadata/mod_setenvif.c index 30435eccb22..259f9b6adf4 100644 --- a/modules/metadata/mod_setenvif.c +++ b/modules/metadata/mod_setenvif.c @@ -239,29 +239,39 @@ static const char *non_regex_pattern(apr_pool_t *p, const char *s) int in_escape = 0; while (*src) { - if (in_escape) { - in_escape = 0; - } - else { - switch (*src) { - case '^': - case '.': - case '$': - case '|': - case '(': - case ')': - case '[': - case ']': - case '*': - case '+': - case '?': - case '{': - case '}': + switch (*src) { + case '^': + case '.': + case '$': + case '|': + case '(': + case ')': + case '[': + case ']': + case '*': + case '+': + case '?': + case '{': + case '}': + if (!in_escape) { return NULL; - case '\\': + } + in_escape = 0; + break; + case '\\': + if (!in_escape) { in_escape = 1; escapes_found = 1; } + else { + in_escape = 0; + } + break; + default: + if (in_escape) { + return NULL; + } + break; } src++; }