rse 99/11/28 04:59:52
Modified: src CHANGES
src/modules/standard mod_auth_db.c
Log:
Added support for Berkeley-DB/3.x to mod_auth_db.
Submitted by: Steve Atkins <[EMAIL PROTECTED]>
Cleaned up and reviewed by: Ralf S. Engelschall
PR: 5382
Revision Changes Path
1.1456 +3 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1455
retrieving revision 1.1456
diff -u -r1.1455 -r1.1456
--- CHANGES 1999/11/28 12:41:54 1.1455
+++ CHANGES 1999/11/28 12:59:49 1.1456
@@ -1,4 +1,7 @@
Changes with Apache 1.3.10
+
+ *) Added support for Berkeley-DB/3.x to mod_auth_db.
+ [Steve Atkins <[EMAIL PROTECTED]>, Ralf S. Engelschall] PR#5382
*) Fixed mod_auth_digest.c: result of an open() call was being
checked against the wrong failure value.
1.43 +12 -4 apache-1.3/src/modules/standard/mod_auth_db.c
Index: mod_auth_db.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_auth_db.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- mod_auth_db.c 1999/08/02 20:50:22 1.42
+++ mod_auth_db.c 1999/11/28 12:59:51 1.43
@@ -97,9 +97,14 @@
#include "http_protocol.h"
#include <db.h>
-#if defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 2)
+#if defined(DB_VERSION_MAJOR)
+#if (DB_VERSION_MAJOR == 2)
#define DB2
#endif
+#if (DB_VERSION_MAJOR == 3)
+#define DB3
+#endif
+#endif
typedef struct {
@@ -161,7 +166,10 @@
q.data = user;
q.size = strlen(q.data);
-#ifdef DB2
+#if defined(DB3)
+ if ( db_create(&f, NULL, 0) != 0
+ || f->open(f, auth_dbpwfile, NULL, DB_HASH, DB_RDONLY, 0664) != 0) {
+#elif defined(DB2)
if (db_open(auth_dbpwfile, DB_HASH, DB_RDONLY, 0664, NULL, NULL, &f) !=
0) {
#else
if (!(f = dbopen(auth_dbpwfile, O_RDONLY, 0664, DB_HASH, NULL))) {
@@ -171,7 +179,7 @@
return NULL;
}
-#ifdef DB2
+#if defined(DB2) || defined(DB3)
if (!((f->get) (f, NULL, &q, &d, 0))) {
#else
if (!((f->get) (f, &q, &d, 0))) {
@@ -181,7 +189,7 @@
pw[d.size] = '\0'; /* Terminate the string */
}
-#ifdef DB2
+#if defined(DB2) || defined(DB3)
(f->close) (f, 0);
#else
(f->close) (f);