Lines Matching full:db
41 #include <db.h>
45 DB_close(krb5_context context, HDB *db) in DB_close() argument
47 DB *d = (DB*)db->hdb_db; in DB_close()
53 DB_destroy(krb5_context context, HDB *db) in DB_destroy() argument
57 ret = hdb_clear_master_key (context, db); in DB_destroy()
58 free(db->hdb_name); in DB_destroy()
59 free(db); in DB_destroy()
64 DB_lock(krb5_context context, HDB *db, int operation) in DB_lock() argument
66 DB *d = (DB*)db->hdb_db; in DB_lock()
70 "Can't lock database: %s", db->hdb_name); in DB_lock()
77 DB_unlock(krb5_context context, HDB *db) in DB_unlock() argument
79 DB *d = (DB*)db->hdb_db; in DB_unlock()
83 "Can't unlock database: %s", db->hdb_name); in DB_unlock()
91 DB_seq(krb5_context context, HDB *db, in DB_seq() argument
94 DB *d = (DB*)db->hdb_db; in DB_seq()
99 code = db->hdb_lock(context, db, HDB_RLOCK); in DB_seq()
101 krb5_set_error_message(context, HDB_ERR_DB_INUSE, "Database %s in use", db->hdb_name); in DB_seq()
105 db->hdb_unlock(context, db); /* XXX check value */ in DB_seq()
109 db->hdb_name, strerror(code)); in DB_seq()
123 return DB_seq(context, db, flags, entry, R_NEXT); in DB_seq()
124 if (db->hdb_master_key_set && (flags & HDB_F_DECRYPT)) { in DB_seq()
125 code = hdb_unseal_keys (context, db, &entry->entry); in DB_seq()
144 DB_firstkey(krb5_context context, HDB *db, unsigned flags, hdb_entry_ex *entry) in DB_firstkey() argument
146 return DB_seq(context, db, flags, entry, R_FIRST); in DB_firstkey()
151 DB_nextkey(krb5_context context, HDB *db, unsigned flags, hdb_entry_ex *entry) in DB_nextkey() argument
153 return DB_seq(context, db, flags, entry, R_NEXT); in DB_nextkey()
157 DB_rename(krb5_context context, HDB *db, const char *new_name) in DB_rename() argument
162 asprintf(&old, "%s.db", db->hdb_name); in DB_rename()
163 asprintf(&new, "%s.db", new_name); in DB_rename()
170 free(db->hdb_name); in DB_rename()
171 db->hdb_name = strdup(new_name); in DB_rename()
176 DB__get(krb5_context context, HDB *db, krb5_data key, krb5_data *reply) in DB__get() argument
178 DB *d = (DB*)db->hdb_db; in DB__get()
184 code = db->hdb_lock(context, db, HDB_RLOCK); in DB__get()
188 db->hdb_unlock(context, db); in DB__get()
192 db->hdb_name, strerror(code)); in DB__get()
205 DB__put(krb5_context context, HDB *db, int replace, in DB__put() argument
208 DB *d = (DB*)db->hdb_db; in DB__put()
216 code = db->hdb_lock(context, db, HDB_WLOCK); in DB__put()
220 db->hdb_unlock(context, db); in DB__put()
224 db->hdb_name, strerror(code)); in DB__put()
235 DB__del(krb5_context context, HDB *db, krb5_data key) in DB__del() argument
237 DB *d = (DB*)db->hdb_db; in DB__del()
242 code = db->hdb_lock(context, db, HDB_WLOCK); in DB__del()
246 db->hdb_unlock(context, db); in DB__del()
250 db->hdb_name, strerror(code)); in DB__del()
259 DB_open(krb5_context context, HDB *db, int flags, mode_t mode) in DB_open() argument
264 asprintf(&fn, "%s.db", db->hdb_name); in DB_open()
269 db->hdb_db = dbopen(fn, flags, mode, DB_BTREE, NULL); in DB_open()
271 /* try to open without .db extension */ in DB_open()
272 if(db->hdb_db == NULL && errno == ENOENT) in DB_open()
273 db->hdb_db = dbopen(db->hdb_name, flags, mode, DB_BTREE, NULL); in DB_open()
274 if(db->hdb_db == NULL) { in DB_open()
277 db->hdb_name, strerror(ret)); in DB_open()
281 ret = hdb_check_db_format(context, db); in DB_open()
283 ret = hdb_init_db(context, db); in DB_open()
289 DB_close(context, db); in DB_open()
293 db->hdb_name); in DB_open()
299 hdb_db_create(krb5_context context, HDB **db, in hdb_db_create() argument
302 *db = calloc(1, sizeof(**db)); in hdb_db_create()
303 if (*db == NULL) { in hdb_db_create()
308 (*db)->hdb_db = NULL; in hdb_db_create()
309 (*db)->hdb_name = strdup(filename); in hdb_db_create()
310 if ((*db)->hdb_name == NULL) { in hdb_db_create()
311 free(*db); in hdb_db_create()
312 *db = NULL; in hdb_db_create()
316 (*db)->hdb_master_key_set = 0; in hdb_db_create()
317 (*db)->hdb_openp = 0; in hdb_db_create()
318 (*db)->hdb_capability_flags = HDB_CAP_F_HANDLE_ENTERPRISE_PRINCIPAL; in hdb_db_create()
319 (*db)->hdb_open = DB_open; in hdb_db_create()
320 (*db)->hdb_close = DB_close; in hdb_db_create()
321 (*db)->hdb_fetch_kvno = _hdb_fetch_kvno; in hdb_db_create()
322 (*db)->hdb_store = _hdb_store; in hdb_db_create()
323 (*db)->hdb_remove = _hdb_remove; in hdb_db_create()
324 (*db)->hdb_firstkey = DB_firstkey; in hdb_db_create()
325 (*db)->hdb_nextkey= DB_nextkey; in hdb_db_create()
326 (*db)->hdb_lock = DB_lock; in hdb_db_create()
327 (*db)->hdb_unlock = DB_unlock; in hdb_db_create()
328 (*db)->hdb_rename = DB_rename; in hdb_db_create()
329 (*db)->hdb__get = DB__get; in hdb_db_create()
330 (*db)->hdb__put = DB__put; in hdb_db_create()
331 (*db)->hdb__del = DB__del; in hdb_db_create()
332 (*db)->hdb_destroy = DB_destroy; in hdb_db_create()