Lines Matching full:db

39 #include <db.h>
41 #include <db5/db.h>
43 #include <db4/db.h>
45 #include <db3/db.h>
47 #include <db.h>
51 DB_close(krb5_context context, HDB *db) in DB_close() argument
53 DB *d = (DB*)db->hdb_db; in DB_close()
54 DBC *dbcp = (DBC*)db->hdb_dbc; in DB_close()
57 db->hdb_dbc = 0; in DB_close()
63 DB_destroy(krb5_context context, HDB *db) in DB_destroy() argument
67 ret = hdb_clear_master_key (context, db); in DB_destroy()
68 free(db->hdb_name); in DB_destroy()
69 free(db); in DB_destroy()
74 DB_lock(krb5_context context, HDB *db, int operation) in DB_lock() argument
76 DB *d = (DB*)db->hdb_db; in DB_lock()
84 DB_unlock(krb5_context context, HDB *db) in DB_unlock() argument
86 DB *d = (DB*)db->hdb_db; in DB_unlock()
95 DB_seq(krb5_context context, HDB *db, in DB_seq() argument
99 DBC *dbcp = db->hdb_dbc; in DB_seq()
105 if ((*db->hdb_lock)(context, db, HDB_RLOCK)) in DB_seq()
108 (*db->hdb_unlock)(context, db); /* XXX check value */ in DB_seq()
120 return DB_seq(context, db, flags, entry, DB_NEXT); in DB_seq()
121 if (db->hdb_master_key_set && (flags & HDB_F_DECRYPT)) { in DB_seq()
122 code = hdb_unseal_keys (context, db, &entry->entry); in DB_seq()
141 DB_firstkey(krb5_context context, HDB *db, unsigned flags, hdb_entry_ex *entry) in DB_firstkey() argument
143 return DB_seq(context, db, flags, entry, DB_FIRST); in DB_firstkey()
148 DB_nextkey(krb5_context context, HDB *db, unsigned flags, hdb_entry_ex *entry) in DB_nextkey() argument
150 return DB_seq(context, db, flags, entry, DB_NEXT); in DB_nextkey()
154 DB_rename(krb5_context context, HDB *db, const char *new_name) in DB_rename() argument
159 asprintf(&old, "%s.db", db->hdb_name); in DB_rename()
160 asprintf(&new, "%s.db", new_name); in DB_rename()
167 free(db->hdb_name); in DB_rename()
168 db->hdb_name = strdup(new_name); in DB_rename()
173 DB__get(krb5_context context, HDB *db, krb5_data key, krb5_data *reply) in DB__get() argument
175 DB *d = (DB*)db->hdb_db; in DB__get()
184 if ((code = (*db->hdb_lock)(context, db, HDB_RLOCK))) in DB__get()
187 (*db->hdb_unlock)(context, db); in DB__get()
198 DB__put(krb5_context context, HDB *db, int replace, in DB__put() argument
201 DB *d = (DB*)db->hdb_db; in DB__put()
213 if ((code = (*db->hdb_lock)(context, db, HDB_WLOCK))) in DB__put()
216 (*db->hdb_unlock)(context, db); in DB__put()
225 DB__del(krb5_context context, HDB *db, krb5_data key) in DB__del() argument
227 DB *d = (DB*)db->hdb_db; in DB__del()
234 code = (*db->hdb_lock)(context, db, HDB_WLOCK); in DB__del()
238 (*db->hdb_unlock)(context, db); in DB__del()
247 DB_open(krb5_context context, HDB *db, int flags, mode_t mode) in DB_open() argument
252 DB *d; in DB_open()
267 asprintf(&fn, "%s.db", db->hdb_name); in DB_open()
277 db->hdb_db = d; in DB_open()
280 ret = (*d->open)(db->hdb_db, NULL, fn, NULL, DB_BTREE, myflags, mode); in DB_open()
282 ret = (*d->open)(db->hdb_db, fn, NULL, DB_BTREE, myflags, mode); in DB_open()
286 /* try to open without .db extension */ in DB_open()
288 ret = (*d->open)(db->hdb_db, NULL, db->hdb_name, NULL, DB_BTREE, in DB_open()
291 ret = (*d->open)(db->hdb_db, db->hdb_name, NULL, DB_BTREE, in DB_open()
299 db->hdb_name, strerror(ret)); in DB_open()
309 db->hdb_dbc = dbc; in DB_open()
312 ret = hdb_check_db_format(context, db); in DB_open()
314 ret = hdb_init_db(context, db); in DB_open()
318 DB_close(context, db); in DB_open()
322 db->hdb_name); in DB_open()
329 hdb_db_create(krb5_context context, HDB **db, in hdb_db_create() argument
332 *db = calloc(1, sizeof(**db)); in hdb_db_create()
333 if (*db == NULL) { in hdb_db_create()
338 (*db)->hdb_db = NULL; in hdb_db_create()
339 (*db)->hdb_name = strdup(filename); in hdb_db_create()
340 if ((*db)->hdb_name == NULL) { in hdb_db_create()
341 free(*db); in hdb_db_create()
342 *db = NULL; in hdb_db_create()
346 (*db)->hdb_master_key_set = 0; in hdb_db_create()
347 (*db)->hdb_openp = 0; in hdb_db_create()
348 (*db)->hdb_capability_flags = HDB_CAP_F_HANDLE_ENTERPRISE_PRINCIPAL; in hdb_db_create()
349 (*db)->hdb_open = DB_open; in hdb_db_create()
350 (*db)->hdb_close = DB_close; in hdb_db_create()
351 (*db)->hdb_fetch_kvno = _hdb_fetch_kvno; in hdb_db_create()
352 (*db)->hdb_store = _hdb_store; in hdb_db_create()
353 (*db)->hdb_remove = _hdb_remove; in hdb_db_create()
354 (*db)->hdb_firstkey = DB_firstkey; in hdb_db_create()
355 (*db)->hdb_nextkey= DB_nextkey; in hdb_db_create()
356 (*db)->hdb_lock = DB_lock; in hdb_db_create()
357 (*db)->hdb_unlock = DB_unlock; in hdb_db_create()
358 (*db)->hdb_rename = DB_rename; in hdb_db_create()
359 (*db)->hdb__get = DB__get; in hdb_db_create()
360 (*db)->hdb__put = DB__put; in hdb_db_create()
361 (*db)->hdb__del = DB__del; in hdb_db_create()
362 (*db)->hdb_destroy = DB_destroy; in hdb_db_create()