Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Bugs
[Bug 53023] New: mod_rewrite RewriteCond parser error and documentation inconsistency
 

Index | Next | Previous | View Flat


bugzilla at apache

Apr 2, 2012, 1:18 AM


Views: 80
Permalink
[Bug 53023] New: mod_rewrite RewriteCond parser error and documentation inconsistency

https://issues.apache.org/bugzilla/show_bug.cgi?id=53023

Bug #: 53023
Summary: mod_rewrite RewriteCond parser error and documentation
inconsistency
Product: Apache httpd-2
Version: 2.4.1
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: mod_rewrite
AssignedTo: bugs [at] httpd
ReportedBy: apache [at] freakout
Classification: Unclassified


mod_rewrite additional syntax to perform other useful tests against
Teststring variant 3 (->"You can perform integer comparisons") is
completely broken because the parser never recognizes the options
-eq, -ge, ... because the 2nd argument is tested to have only two
characters (-f, -L, ...) so these other options are never seen by
the code below which checks for these options - see my comments
in the code below.

In contrast to variant 2 (->"You can perform lexicographical
string comparisons") where the CondPattern is explicitely mentioned
in the syntax description, the documentation of variant 3 does not
describe how to apply the CondPattern.

It is unclear how the CondPattern is going into the RewriteCond command,
there is also nowhere an example for variant 3.

else if (*a2 && a2[1]) {
if (!a2[2] && *a2 == '-') { /* !!! test string to only two chars */
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;
/* !!! these cases can never be reached due to the two-char test
above */
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;
}
}

for me the following patch fixes the defect for me:

--- modules/mappers/mod_rewrite.c Thu Jan 26 20:15:41 2012
+++ modules/mappers/mod_rewrite.c Mon Apr 2 09:04:12 2012
@@ -3243,7 +3243,7 @@
newcond->ptype = CONDPAT_AP_EXPR;
}
else if (*a2 && a2[1]) {
- if (!a2[2] && *a2 == '-') {
+ if (*a2 == '-') {
switch (a2[1]) {
case 'f': newcond->ptype = CONDPAT_FILE_EXISTS; break;
case 's': newcond->ptype = CONDPAT_FILE_SIZE; break;

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd

Subject User Time
[Bug 53023] New: mod_rewrite RewriteCond parser error and documentation inconsistency bugzilla at apache Apr 2, 2012, 1:18 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.