Received: (from majordom@localhost) by hyperreal.org (8.8.5/8.8.5) id EAA18271; Tue, 9 Sep 1997 04:07:03 -0700 (PDT) Received: (from coar@localhost) by hyperreal.org (8.8.5/8.8.5) id EAA18263 for apache-cvs; Tue, 9 Sep 1997 04:07:01 -0700 (PDT) Date: Tue, 9 Sep 1997 04:07:01 -0700 (PDT) From: Rodent of Unusual Size Message-Id: <199709091107.EAA18263@hyperreal.org> To: apache-cvs@hyperreal.org Subject: cvs commit: apachen/src/modules/standard mod_rewrite.c Sender: apache-cvs-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org coar 97/09/09 04:06:59 Modified: src CHANGES src/modules/standard mod_rewrite.c Log: Don't take *any* actions if the RewriteEngine is off.. PR: 991 Reviewed by: Ralf S. Engelschall Revision Changes Path 1.430 +5 -1 apachen/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.429 retrieving revision 1.430 diff -u -r1.429 -r1.430 --- CHANGES 1997/09/09 01:24:31 1.429 +++ CHANGES 1997/09/09 11:06:55 1.430 @@ -1,4 +1,8 @@ -Changes with Apache 1.3a2 +Changes with Apache 1.3b1 + + *) *Really* disable all mod_rewrite operations if the engine is off. + Some things (like RewriteMaps) were checked/performed even if they + weren't supposed to be. [Ken Coar, PR #991] *) Implement a new timer scheme which eliminates the need to call alarm() all the time. Instead a counter in the scoreboard for each child is used to 1.51 +26 -6 apachen/src/modules/standard/mod_rewrite.c Index: mod_rewrite.c =================================================================== RCS file: /export/home/cvs/apachen/src/modules/standard/mod_rewrite.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- mod_rewrite.c 1997/09/01 02:39:03 1.50 +++ mod_rewrite.c 1997/09/09 11:06:58 1.51 @@ -1,4 +1,3 @@ - /* ==================================================================== * Copyright (c) 1996,1997 The Apache Group. All rights reserved. * @@ -455,9 +454,9 @@ 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); + 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; } @@ -2192,7 +2191,14 @@ s = &entries[i]; if (strcmp(s->name, name) == 0) { if (s->type == MAPTYPE_TXT) { - stat(s->checkfile, &st); /* existence was checked at startup! */ + if (stat(s->checkfile, &st) == -1) { + aplog_error(APLOG_MARK, APLOG_ERR, 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"); @@ -2213,7 +2219,14 @@ } else if (s->type == MAPTYPE_DBM) { #if HAS_NDBM_LIB - stat(s->checkfile, &st); /* existence was checked at startup! */ + 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, 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"); @@ -2535,6 +2548,13 @@ int rc; conf = get_module_config(s->module_config, &rewrite_module); + /* + * If the engine isn't turned on, don't even try to do anything. + */ + if (conf->state == ENGINE_DISABLED) { + return; + } + rewritemaps = conf->rewritemaps; entries = (rewritemap_entry *)rewritemaps->elts;