diff --git a/lib/hdb/db3.c b/lib/hdb/db3.c index 7d62181c6..db2c4157a 100644 --- a/lib/hdb/db3.c +++ b/lib/hdb/db3.c @@ -87,7 +87,6 @@ static krb5_error_code DB_seq(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry, int flag) { - DB *d = (DB*)db->db; DBT key, value; DBC *dbcp = db->dbc; krb5_data key_data, data; @@ -262,10 +261,18 @@ DB_open(krb5_context context, HDB *db, int flags, mode_t mode) } db_create(&d, NULL, 0); db->db = d; +#if (DB_VERSION_MAJOR > 3) && (DB_VERSION_MINOR > 0) + if ((ret = d->open(db->db, NULL, fn, NULL, DB_BTREE, myflags, mode))) { +#else if ((ret = d->open(db->db, fn, NULL, DB_BTREE, myflags, mode))) { +#endif if(ret == ENOENT) /* try to open without .db extension */ +#if (DB_VERSION_MAJOR > 3) && (DB_VERSION_MINOR > 0) + if (d->open(db->db, NULL, db->name, NULL, DB_BTREE, myflags, mode)) { +#else if (d->open(db->db, db->name, NULL, DB_BTREE, myflags, mode)) { +#endif free(fn); krb5_set_error_string(context, "opening %s: %s", db->name, strerror(ret)); diff --git a/lib/roken/ndbm_wrap.c b/lib/roken/ndbm_wrap.c index 4fec089e4..7c7d6c37a 100644 --- a/lib/roken/ndbm_wrap.c +++ b/lib/roken/ndbm_wrap.c @@ -165,7 +165,12 @@ dbm_open (const char *file, int flags, mode_t mode) free(fn); return NULL; } + +#if (DB_VERSION_MAJOR > 3) && (DB_VERSION_MINOR > 0) + if(db->open(db, NULL, fn, NULL, DB_BTREE, myflags, mode) != 0) { +#else if(db->open(db, fn, NULL, DB_BTREE, myflags, mode) != 0) { +#endif free(fn); db->close(db, 0); return NULL;