You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by James Ponder <ja...@squish.net> on 2003/05/25 02:37:16 UTC

mod_auth_db with db 4 (patch)

Berkeley db version 4 has a different prototype for the open() call than
version 3:

  int
  DB->open(DB *db, DB_TXN *txnid, const char *file,
      const char *database, DBTYPE type, u_int32_t flags, int mode);

Although mod_auth_db.c looks like it supports db version 4, it uses the
old version 3 open call.  Enclosed is a patch to fix:

--- src/modules/standard/mod_auth_db.c.dist     Wed Nov  6 13:50:48 2002
+++ src/modules/standard/mod_auth_db.c  Wed Nov  6 13:55:00 2002
@@ -170,8 +170,12 @@
     q.data = user;
     q.size = strlen(q.data);

-#if defined(DB3) || defined(DB4)
-    if (   db_create(&f, NULL, 0) != 0
+#if defined(DB4)
+    if (db_create(&f, NULL, 0) != 0
+        || f->open(f, NULL, auth_dbpwfile, NULL, DB_HASH, DB_RDONLY,
+                   0664) != 0) {
+#elif 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)


Best wishes, James
--
James Ponder; www.squish.net; London, UK