patch for working with DB4 on heimdal-discuss
From: Luke Howard <lukeh@PADL.COM> git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12697 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -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)); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Love Hörnquist Åstrand
					Love Hörnquist Åstrand