You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Bob Finch <bo...@nas.com> on 1999/04/13 21:12:15 UTC

mod_rewrite/4240: -s pattern in RewriteCond does not work

>Number:         4240
>Category:       mod_rewrite
>Synopsis:       -s pattern in RewriteCond does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Tue Apr 13 12:20:01 PDT 1999
>Last-Modified:
>Originator:     bob@nas.com
>Organization:
apache
>Release:        1.3.6
>Environment:
BSD/OS jones.nas.com 2.1 BSDI BSD/OS 2.1 Kernel #0: Wed Mar 12 13:15:28 PST 1997     root@jones.nas.com:/usr/src/sys/compile/JONES  i386
gcc version 2.7.2
>Description:
The -s pattern in RewriteCond always returns not-matched, even if the file
named by the TestString exists, is readable, and has non-zero size.
>How-To-Repeat:
Set up a RewriteCond using -s as a pattern that should match. For example,
RewriteCond /bin/sh -s
should always match (assuming /bin/sh exists), but never does.
>Fix:
It appears that apply_rewrite_cond in mod_rewrite.c looks for "-s " (with a
trailing blank) instead of "-s".  The following context diff fixes the problem:

*** apache_1.3.6/src/modules/standard/mod_rewrite.c~    Sun Mar  7 10:03:34 1999
--- apache_1.3.6/src/modules/standard/mod_rewrite.c     Tue Apr 13 11:46:18 1999
***************
*** 2172,2178 ****
              }
          }
      }
!     else if (strcmp(p->pattern, "-s ") == 0) {
          if (stat(input, &sb) == 0) {
              if (S_ISREG(sb.st_mode) && sb.st_size > 0) {
                  rc = 1;
--- 2172,2178 ----
              }
          }
      }
!     else if (strcmp(p->pattern, "-s") == 0) {
          if (stat(input, &sb) == 0) {
              if (S_ISREG(sb.st_mode) && sb.st_size > 0) {
                  rc = 1;
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]