]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_rewrite: Fix RewriteCond integer checks to be parsed correctly.
authorAndré Malo <nd@apache.org>
Wed, 4 Apr 2012 21:20:37 +0000 (21:20 +0000)
committerAndré Malo <nd@apache.org>
Wed, 4 Apr 2012 21:20:37 +0000 (21:20 +0000)
PR: 53023
Submitted by: Axel Reinhold <apache freakout.de>
Reviewed/Updated by: nd

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1309602 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/mappers/mod_rewrite.c

diff --git a/CHANGES b/CHANGES
index 67d80e0b674a16b8e3784820e38a91a542f168d6..9172a1668af3bee82e9ff860752b879050b06c43 100644 (file)
--- 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 <apache freakout.de>, André Malo]
+
   *) mod_proxy: Add the forcerecovery balancer parameter that determines if
      recovery for balancer workers is enforced. [Ruediger Pluem]
 
index a7fb0666d3b1db313f20eec7978e77d128ea5d53..1d6951343e69d714503e9f91a1e03fb947bfe1c2 100644 (file)
@@ -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 {