--- /dev/null
+diff -ur inn-2.3.3/storage/ovdb/ovdb.c inn-2.3.3.db4/storage/ovdb/ovdb.c
+--- inn-2.3.3/storage/ovdb/ovdb.c Mon May 6 08:02:07 2002
++++ inn-2.3.3.db4/storage/ovdb/ovdb.c Fri Nov 8 23:24:50 2002
+@@ -99,7 +99,7 @@
+ #error Need BerkeleyDB 2.6.x, 2.7.x, or 3.x
+ #endif
+ #else
+-#if DB_VERSION_MAJOR != 3
++#if DB_VERSION_MAJOR != 3 && DB_VERSION_MAJOR != 4
+ #error Need BerkeleyDB 2.6.x, 2.7.x, or 3.x
+ #endif
+ #endif
+@@ -401,8 +404,13 @@
+ if(ovdb_conf.pagesize > 0)
+ (dbs[which])->set_pagesize(dbs[which], ovdb_conf.pagesize);
+
++#if DB_VERSION_MAJOR == 4
++ if(ret = (dbs[which])->open(dbs[which], NULL, _dbnames[which], NULL, DB_BTREE,
++ _db_flags, 0666)) {
++#else
+ if(ret = (dbs[which])->open(dbs[which], _dbnames[which], NULL, DB_BTREE,
+ _db_flags, 0666)) {
++#endif
+ (dbs[which])->close(dbs[which], 0);
+ dbs[which] = NULL;
+ return ret;
+@@ -590,7 +598,7 @@
+ return TRUE;
+ }
+
+-#if DB_VERSION_MAJOR == 3
++#if DB_VERSION_MAJOR >= 3
+ static int upgrade_database(char *name)
+ {
+ int ret;
+@@ -659,7 +667,7 @@
+ if(flags & OVDB_RECOVER)
+ ai_flags |= DB_RECOVER;
+
+-#if DB_VERSION_MAJOR == 2 || DB_VERSION_MINOR < 2
++#if DB_VERSION_MAJOR == 2 || (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR < 2)
+ if(ovdb_conf.txn_nosync)
+ ai_flags |= DB_TXN_NOSYNC;
+ #endif
+@@ -697,12 +705,12 @@
+ OVDBenv->set_errcall(OVDBenv, OVDBerror);
+ OVDBenv->set_cachesize(OVDBenv, 0, ovdb_conf.cachesize, 1);
+
+-#if DB_VERSION_MINOR >= 2
++#if (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR >= 2) || DB_VERSION_MAJOR == 4
+ if(ovdb_conf.txn_nosync)
+ OVDBenv->set_flags(OVDBenv, DB_TXN_NOSYNC, 1);
+ #endif
+
+-#if DB_VERSION_MINOR == 0
++#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 0
+ if(ret = OVDBenv->open(OVDBenv, ovdb_conf.home, NULL, ai_flags, 0666)) {
+ #else
+ if(ret = OVDBenv->open(OVDBenv, ovdb_conf.home, ai_flags, 0666)) {
+@@ -726,8 +734,13 @@
+ syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
+ return ret;
+ }
++#if DB_VERSION_MAJOR == 4
++ if(ret = vdb->open(vdb, NULL, "version", NULL, DB_BTREE,
++ _db_flags, 0666)) {
++#else
+ if(ret = vdb->open(vdb, "version", NULL, DB_BTREE,
+ _db_flags, 0666)) {
++#endif
+ vdb->close(vdb, 0);
+ syslog(L_FATAL, "OVDB: open: version->open: %s", db_strerror(ret));
+ return ret;
+@@ -841,8 +854,13 @@
+ syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
+ return FALSE;
+ }
++#if DB_VERSION_MAJOR == 4
++ if(ret = groupstats->open(groupstats, NULL, "groupstats", NULL, DB_BTREE,
++ _db_flags, 0666)) {
++#else
+ if(ret = groupstats->open(groupstats, "groupstats", NULL, DB_BTREE,
+ _db_flags, 0666)) {
++#endif
+ groupstats->close(groupstats, 0);
+ syslog(L_FATAL, "OVDB: open: groupstats->open: %s", db_strerror(ret));
+ return FALSE;
+@@ -851,8 +869,13 @@
+ syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
+ return FALSE;
+ }
++#if DB_VERSION_MAJOR == 4
++ if(ret = groupsbyname->open(groupsbyname, NULL, "groupsbyname", NULL, DB_HASH,
++ _db_flags, 0666)) {
++#else
+ if(ret = groupsbyname->open(groupsbyname, "groupsbyname", NULL, DB_HASH,
+ _db_flags, 0666)) {
++#endif
+ groupsbyname->close(groupsbyname, 0);
+ syslog(L_FATAL, "OVDB: open: groupsbyname->open: %s", db_strerror(ret));
+ return FALSE;
+@@ -861,8 +884,13 @@
+ syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
+ return FALSE;
+ }
++#if DB_VERSION_MAJOR == 4
++ if(ret = groupaliases->open(groupaliases, NULL, "groupaliases", NULL, DB_HASH,
++ _db_flags, 0666)) {
++#else
+ if(ret = groupaliases->open(groupaliases, "groupaliases", NULL, DB_HASH,
+ _db_flags, 0666)) {
++#endif
+ groupaliases->close(groupaliases, 0);
+ syslog(L_FATAL, "OVDB: open: groupaliases->open: %s", db_strerror(ret));
+ return FALSE;