You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Rein Tollevik <re...@sys.sol.no> on 1998/03/27 18:12:53 UTC

mod_rewrite/2010: stat() used instead of lstat() to check for symbolic link in mod_rewrite.c

>Number:         2010
>Category:       mod_rewrite
>Synopsis:       stat() used instead of lstat() to check for symbolic link in mod_rewrite.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Mar 27 09:20:00 PST 1998
>Last-Modified:
>Originator:     reint@sys.sol.no
>Organization:
apache
>Release:        1.3beta5
>Environment:
SunOS www-test1.sol.no 5.5.1 Generic_103640-12 sun4m sparc SUNW,SPARCstation-4
>Description:
mod_rewrite.c uses stat() and not lstat() when it checks for symbolic links.
Also, the symbol APLOG_ERR is misspelled APLOG_ERROR.  The patch below fixes
these two problems.
>How-To-Repeat:

>Fix:
diff -c apache/src/modules/standard/mod_rewrite.c:1.1.1.7 apache/src/modules/standard/mod_rewrite.c:1.7
*** apache/src/modules/standard/mod_rewrite.c:1.1.1.7	Wed Mar 11 10:58:46 1998
--- apache/src/modules/standard/mod_rewrite.c	Wed Mar 11 14:55:59 1998
***************
*** 1921,1927 ****
      else if (strcmp(p->pattern, "-l") == 0) {
  #if !defined(__EMX__) && !defined(WIN32)
  /* OS/2 dosen't support links. */
!         if (stat(input, &sb) == 0)
              if (S_ISLNK(sb.st_mode))
                  rc = 1;
  #endif
--- 1921,1927 ----
      else if (strcmp(p->pattern, "-l") == 0) {
  #if !defined(__EMX__) && !defined(WIN32)
  /* OS/2 dosen't support links. */
!         if (lstat(input, &sb) == 0)
              if (S_ISLNK(sb.st_mode))
                  rc = 1;
  #endif
***************
*** 2452,2458 ****
              else if (s->type == MAPTYPE_DBM) {
  #if HAS_NDBM_LIB
                  if (stat(s->checkfile, &st) == -1) {
!                     aplog_error(APLOG_MARK, APLOG_ERROR, r->server,
                                  "mod_rewrite: can't access dbm RewriteMap "
                                  "file %s: %s", s->checkfile);
                      rewritelog(r, 1,
--- 2452,2458 ----
              else if (s->type == MAPTYPE_DBM) {
  #if HAS_NDBM_LIB
                  if (stat(s->checkfile, &st) == -1) {
!                     aplog_error(APLOG_MARK, APLOG_ERR, r->server,
                                  "mod_rewrite: can't access dbm RewriteMap "
                                  "file %s: %s", s->checkfile);
                      rewritelog(r, 1,
%0
>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. ]