rse 98/03/04 05:17:01
Modified: src CHANGES
src/modules/standard mod_rewrite.c mod_rewrite.h
Log:
Reanimate the DBM support for RewriteMap in mod_rewrite by fixing two source
code errors and making sure it is disabled when DBM support is not available
on the used platform.
Revision Changes Path
1.684 +6 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.683
retrieving revision 1.684
diff -u -r1.683 -r1.684
--- CHANGES 1998/03/04 12:08:45 1.683
+++ CHANGES 1998/03/04 13:16:56 1.684
@@ -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]
+
*) Now all configuration files support Unix-style line-continuation via
the trailing backslash ("\") character. This enables us to write down
complex or just very long directives in a more readable way. The
1.80 +22 -7 apache-1.3/src/modules/standard/mod_rewrite.c
Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- mod_rewrite.c 1998/03/04 02:28:23 1.79
+++ mod_rewrite.c 1998/03/04 13:16:59 1.80
@@ -157,6 +157,21 @@
** or not!
*/
+ /* The section for the Configure script:
+ * MODULE-DEFINITION-START
+ * Name: rewrite_module
+ * ConfigStart
+ if ./helpers/TestCompile func dbm_open; then
+ echo " enabling DBM support for mod_rewrite"
+ else
+ echo " disabling DBM support for mod_rewrite"
+ echo " (perhaps you need to add -ldbm, -lndbm or -lgdbm to
EXTRA_LIBS)"
+ 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 +487,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 +2534,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 +2675,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;
1.43 +2 -2 apache-1.3/src/modules/standard/mod_rewrite.h
Index: mod_rewrite.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- mod_rewrite.h 1998/03/03 15:58:11 1.42
+++ mod_rewrite.h 1998/03/04 13:17:00 1.43
@@ -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"
@@ -379,7 +379,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,