httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@decus.org (Rodent of Unusual Size)
Subject [PATCH] PR#991 (RewriteMap fails even if RewriteEngine off)
Date Thu, 21 Aug 1997 10:55:16 GMT
    I think the attached patch will address PR#991.  It does config-time
    checking for the RewriteMap file IFF the engine has already been
    turned on.  It also checks the stat() at run-time, rather than
    blindly assuming it's valid.

    Ralf, would you double-check this?

    #ken    :-)}

Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.48
diff -u -c -r1.48 mod_rewrite.c
/usr/bin/diff: conflicting specifications of output style
*** mod_rewrite.c	1997/08/18 13:12:17	1.48
--- mod_rewrite.c	1997/08/21 11:59:45
***************
*** 451,459 ****
      new->fpin  = 0;
      new->fpout = 0;
  
!     if (new->checkfile)
!         if (stat(new->checkfile, &st) == -1)
!             return pstrcat(cmd->pool, "RewriteMap: map file or program not found:", new->checkfile,
NULL);
  
      return NULL;
  }
--- 451,459 ----
      new->fpin  = 0;
      new->fpout = 0;
  
!     if (new->checkfile && (sconf->state == ENGINE_ENABLED)
!         && (stat(new->checkfile, &st) == -1))
! 	return pstrcat(cmd->pool, "RewriteMap: map file or program not found:", new->checkfile,
NULL);
  
      return NULL;
  }
***************
*** 2181,2187 ****
          s = &entries[i];
          if (strcmp(s->name, name) == 0) {
              if (s->type == MAPTYPE_TXT) {
!                 stat(s->checkfile, &st); /* existence was checked at startup! */
                  value = get_cache_string(cachep, s->name, CACHEMODE_TS, st.st_mtime,
key);
                  if (value == NULL) {
                      rewritelog(r, 6, "cache lookup FAILED, forcing new map lookup");
--- 2181,2194 ----
          s = &entries[i];
          if (strcmp(s->name, name) == 0) {
              if (s->type == MAPTYPE_TXT) {
!                 if (stat(s->checkfile, &st) == -1) {
! 		    log_printf(r->server,
! 			       "mod_rewrite: can't access text RewriteMap file %s: %s",
! 			       s->checkfile, strerror(errno));
! 		    rewritelog(r, 1,
! 			       "can't open RewriteMap file, see error log");
! 		    return NULL;
! 		}
                  value = get_cache_string(cachep, s->name, CACHEMODE_TS, st.st_mtime,
key);
                  if (value == NULL) {
                      rewritelog(r, 6, "cache lookup FAILED, forcing new map lookup");
***************
*** 2202,2208 ****
              }
              else if (s->type == MAPTYPE_DBM) {
  #if HAS_NDBM_LIB
!                 stat(s->checkfile, &st); /* existence was checked at startup! */
                  value = get_cache_string(cachep, s->name, CACHEMODE_TS, st.st_mtime,
key);
                  if (value == NULL) {
                      rewritelog(r, 6, "cache lookup FAILED, forcing new map lookup");
--- 2209,2222 ----
              }
              else if (s->type == MAPTYPE_DBM) {
  #if HAS_NDBM_LIB
!                 if (stat(s->checkfile, &st) == -1) {
! 		    log_printf(r->server,
! 			       "mod_rewrite: can't access dbm RewriteMap file %s: %s",
! 			       s->checkfile, strerror(errno));
! 		    rewritelog(r, 1,
! 			       "can't open RewriteMap file, see error log");
! 		    return NULL;
! 		}
                  value = get_cache_string(cachep, s->name, CACHEMODE_TS, st.st_mtime,
key);
                  if (value == NULL) {
                      rewritelog(r, 6, "cache lookup FAILED, forcing new map lookup");

Mime
View raw message