httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@engelschall.com (Ralf S. Engelschall)
Subject [PATCH] Reanimate DBM support for mod_rewrite
Date Tue, 03 Mar 1998 14:53:01 GMT

This patch fixes the DBM support for RewriteMap's in mod_rewrite
which was broken for a long time (especially because of source code errors).  

I've tested it and it seems to work fine but because I'm not sure if 
the `ConfigStart...ConfigEnd' is really used as it was intended to
be used, I post it here first.

Greetings,
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com
Index: CHANGES
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/CHANGES,v
retrieving revision 1.678
diff -u -r1.678 CHANGES
--- CHANGES	1998/03/03 01:22:03	1.678
+++ CHANGES	1998/03/03 14:42:48
@@ -1,5 +1,11 @@
 Changes with Apache 1.3b6
 
+  *) Fixed the DBM RewriteMap support for mod_rewrite: First the support now
+     is automatically disabled under configure time when the dbm_xxx functions
+     are not available. Second, two heavy source code errors in the DBM
+     support code were fixed.  This makes DBM RewriteMap's useable again after
+     a long time of brokeness. [Ralf S. Engelschall]
+
   *) USE_PTHREAD_SERIALIZED_ACCEPT has proven unreliable depending on
      the rev of Solaris and what mixture of modules are in use.  So
      it has been disabled, and Solaris is back to using
Index: modules/standard/mod_rewrite.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.78
diff -u -r1.78 mod_rewrite.c
--- mod_rewrite.c	1998/03/02 06:51:19	1.78
+++ mod_rewrite.c	1998/03/03 14:47:51
@@ -157,6 +157,20 @@
 **         or not!
 */
 
+    /* The section for the Configure script:
+     * MODULE-DEFINITION-START
+     * Name: mod_rewrite
+     * ConfigStart
+    if ./helpers/TestCompile func dbm_open; then
+        echo "      enabling DBM support for mod_rewrite"
+    else
+        echo "      disabling DBM support for mod_rewrite"
+        CFLAGS="$CFLAGS -DNO_DBM_REWRITEMAP"
+    fi
+     * ConfigEnd
+     * MODULE-DEFINITION-END
+     */
+
     /* the table of commands we provide */
 static command_rec command_table[] = {
     { "RewriteEngine",   cmd_rewriteengine,   NULL, OR_FILEINFO, FLAG,
@@ -472,7 +486,7 @@
         new->checkfile = a2+4;
     }
     else if (strncmp(a2, "dbm:", 4) == 0) {
-#ifdef HAS_NDBM_LIB
+#ifndef NO_DBM_REWRITEMAP
         new->type      = MAPTYPE_DBM;
         new->datafile  = a2+4;
         new->checkfile = pstrcat(cmd->pool, a2+4, NDBM_FILE_SUFFIX, NULL);
@@ -2519,13 +2533,13 @@
                 }
             }
             else if (s->type == MAPTYPE_DBM) {
-#if HAS_NDBM_LIB
+#ifndef NO_DBM_REWRITEMAP
                 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);
+                    aplog_error(APLOG_MARK, APLOG_ERR, r->server,
+                                "mod_rewrite: can't access DBM RewriteMap "
+                                "file %s", s->checkfile);
                     rewritelog(r, 1,
-                               "can't open RewriteMap file, see error log");
+                               "can't open DBM RewriteMap file, see error log");
                     return NULL;
                 }
                 value = get_cache_string(cachep, s->name, CACHEMODE_TS,
@@ -2660,7 +2674,7 @@
     return value;
 }
 
-#if HAS_NDBM_LIB
+#ifndef NO_DBM_REWRITEMAP
 static char *lookup_map_dbmfile(request_rec *r, char *file, char *key)
 {
     DBM *dbmfp = NULL;
Index: modules/standard/mod_rewrite.h
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/modules/standard/mod_rewrite.h,v
retrieving revision 1.40
diff -u -r1.40 mod_rewrite.h
--- mod_rewrite.h	1998/03/02 06:51:20	1.40
+++ mod_rewrite.h	1998/03/03 14:34:28
@@ -95,7 +95,7 @@
      * But we have to stat the file for the mtime,
      * so we also need to know the file extension
      */
-#if HAS_NDBM_LIB
+#ifndef NO_DBM_REWRITEMAP
 #include <ndbm.h>
 #if (__FreeBSD__)
 #define NDBM_FILE_SUFFIX ".db"
@@ -378,7 +378,7 @@
     /* rewrite map support functions */
 static char *lookup_map(request_rec *r, char *name, char *key);
 static char *lookup_map_txtfile(request_rec *r, char *file, char *key);
-#if HAS_NDBM_LIB
+#ifndef NO_DBM_REWRITEMAP
 static char *lookup_map_dbmfile(request_rec *r, char *file, char *key);
 #endif
 static char *lookup_map_program(request_rec *r, int fpin,

Mime
View raw message