]> git.sur5r.net Git - openldap/blobdiff - libraries/libldbm/ldbm.c
Added support for BDB 4.1.17
[openldap] / libraries / libldbm / ldbm.c
index 6799070029ca8d1f403c97bd061e20bbc5397bee..31c845416f9702ee40d58d901d4b3fc088c5ad82 100644 (file)
@@ -1,7 +1,7 @@
 /* ldbm.c - ldap dbm compatibility routines */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -304,6 +304,9 @@ LDBM
 ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize )
 {
        LDBM            ret = NULL;
+#ifdef HAVE_EBCDIC
+       char n2[2048];
+#endif
 
 #if DB_VERSION_MAJOR >= 3
        int err;
@@ -326,7 +329,17 @@ ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize )
 
        /* likely should use ber_mem* routines */
 
+#ifdef HAVE_EBCDIC
+       strncpy(n2, name, sizeof(n2)-1);
+       n2[sizeof(n2)-1] = '\0';
+       __atoe(n2);
+       name = n2;
+#endif
+#if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR > 0 && DB_VERSION_PATCH >= 17
+       err = ret->open( ret, NULL, name, NULL, DB_TYPE, rw, mode);
+#else
        err = ret->open( ret, name, NULL, DB_TYPE, rw, mode);
+#endif
 
        if ( err != 0 ) {
                int tmp = errno;
@@ -604,6 +617,14 @@ ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize )
 #ifdef HAVE_ST_BLKSIZE
                struct stat     st;
 #endif
+#ifdef HAVE_EBCDIC
+       char n2[2048];
+
+       strncpy(n2, name, sizeof(n2)-1);
+       n2[sizeof(n2)-1] = '\0';
+       __atoe(n2);
+       name = n2;
+#endif
 
        LDBM_WLOCK;