From: André Malo Date: Wed, 4 Apr 2012 21:20:37 +0000 (+0000) Subject: mod_rewrite: Fix RewriteCond integer checks to be parsed correctly. X-Git-Tag: 2.5.0-alpha~7250 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a6b17d7562ccb097ce76433c166788b15419e79e;p=thirdparty%2Fapache%2Fhttpd.git mod_rewrite: Fix RewriteCond integer checks to be parsed correctly. PR: 53023 Submitted by: Axel Reinhold Reviewed/Updated by: nd git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1309602 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 67d80e0b674..9172a1668af 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_rewrite: Fix RewriteCond integer checks to be parsed correctly. + PR 53023. [Axel Reinhold , André Malo] + *) mod_proxy: Add the forcerecovery balancer parameter that determines if recovery for balancer workers is enforced. [Ruediger Pluem] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index a7fb0666d3b..1d6951343e6 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -3243,37 +3243,59 @@ static const char *cmd_rewritecond(cmd_parms *cmd, void *in_dconf, newcond->ptype = CONDPAT_AP_EXPR; } else if (*a2 && a2[1]) { - if (!a2[2] && *a2 == '-') { - switch (a2[1]) { - case 'f': newcond->ptype = CONDPAT_FILE_EXISTS; break; - case 's': newcond->ptype = CONDPAT_FILE_SIZE; break; - case 'd': newcond->ptype = CONDPAT_FILE_DIR; break; - case 'x': newcond->ptype = CONDPAT_FILE_XBIT; break; - case 'h': newcond->ptype = CONDPAT_FILE_LINK; break; - case 'L': newcond->ptype = CONDPAT_FILE_LINK; break; - case 'U': newcond->ptype = CONDPAT_LU_URL; break; - case 'F': newcond->ptype = CONDPAT_LU_FILE; break; - case 'l': if (a2[2] == 't') - a2 += 3, newcond->ptype = CONDPAT_INT_LT; - else if (a2[2] == 'e') - a2 += 3, newcond->ptype = CONDPAT_INT_LE; - else /* Historical; prefer -L or -h instead */ - newcond->ptype = CONDPAT_FILE_LINK; - break; - case 'g': if (a2[2] == 't') - a2 += 3, newcond->ptype = CONDPAT_INT_GT; - else if (a2[2] == 'e') - a2 += 3, newcond->ptype = CONDPAT_INT_GE; - break; - case 'e': if (a2[2] == 'q') - a2 += 3, newcond->ptype = CONDPAT_INT_EQ; - break; - case 'n': if (a2[2] == 'e') { - /* Inversion, ensure !-ne == -eq */ - a2 += 3, newcond->ptype = CONDPAT_INT_EQ; - newcond->flags ^= CONDFLAG_NOTMATCH; - } - break; + if (*a2 == '-') { + if (!a2[2]) { + switch (a2[1]) { + case 'f': newcond->ptype = CONDPAT_FILE_EXISTS; break; + case 's': newcond->ptype = CONDPAT_FILE_SIZE; break; + case 'd': newcond->ptype = CONDPAT_FILE_DIR; break; + case 'x': newcond->ptype = CONDPAT_FILE_XBIT; break; + case 'h': newcond->ptype = CONDPAT_FILE_LINK; break; + case 'L': newcond->ptype = CONDPAT_FILE_LINK; break; + case 'l': newcond->ptype = CONDPAT_FILE_LINK; break; + case 'U': newcond->ptype = CONDPAT_LU_URL; break; + case 'F': newcond->ptype = CONDPAT_LU_FILE; break; + } + } + else if (a2[3]) { + switch (a2[1]) { + case 'l': + if (a2[2] == 't') { + a2 += 3; + newcond->ptype = CONDPAT_INT_LT; + } + else if (a2[2] == 'e') { + a2 += 3; + newcond->ptype = CONDPAT_INT_LE; + } + break; + + case 'g': + if (a2[2] == 't') { + a2 += 3; newcond->ptype = CONDPAT_INT_GT; + } + else if (a2[2] == 'e') { + a2 += 3; + newcond->ptype = CONDPAT_INT_GE; + } + break; + + case 'e': + if (a2[2] == 'q') { + a2 += 3; + newcond->ptype = CONDPAT_INT_EQ; + } + break; + + case 'n': + if (a2[2] == 'e') { + /* Inversion, ensure !-ne == -eq */ + a2 += 3; + newcond->ptype = CONDPAT_INT_EQ; + newcond->flags ^= CONDFLAG_NOTMATCH; + } + break; + } } } else {