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] to mod_rewrite to close PR#991 (take 2)
Date Mon, 08 Sep 1997 02:13:11 GMT
    Okey, this slightly revised version includes a check for the
    condition Ralf suggested (though I armoured the routine called, not
    the call itself).

    For 1.3b1.. 'cuz it fixes a bug :->

    #ken    P-)}

Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.50
diff -u -r1.50 mod_rewrite.c
--- mod_rewrite.c	1997/09/01 02:39:03	1.50
+++ mod_rewrite.c	1997/09/08 02:09:02
@@ -455,9 +455,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 +2192,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) {
+		    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");
@@ -2213,7 +2220,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) {
+		    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");
@@ -2535,6 +2549,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;

Mime
View raw message