Lines Matching refs:db
49 DBM *db; member
54 NDBM_destroy(krb5_context context, HDB *db) in NDBM_destroy() argument
56 hdb_clear_master_key (context, db); in NDBM_destroy()
57 free(db->hdb_name); in NDBM_destroy()
58 free(db); in NDBM_destroy()
63 NDBM_lock(krb5_context context, HDB *db, int operation) in NDBM_lock() argument
65 struct ndbm_db *d = db->hdb_db; in NDBM_lock()
70 NDBM_unlock(krb5_context context, HDB *db) in NDBM_unlock() argument
72 struct ndbm_db *d = db->hdb_db; in NDBM_unlock()
77 NDBM_seq(krb5_context context, HDB *db, in NDBM_seq() argument
81 struct ndbm_db *d = (struct ndbm_db *)db->hdb_db; in NDBM_seq()
87 key = dbm_firstkey(d->db); in NDBM_seq()
89 key = dbm_nextkey(d->db); in NDBM_seq()
94 ret = db->hdb_lock(context, db, HDB_RLOCK); in NDBM_seq()
96 value = dbm_fetch(d->db, key); in NDBM_seq()
97 db->hdb_unlock(context, db); in NDBM_seq()
102 return NDBM_seq(context, db, flags, entry, 0); in NDBM_seq()
103 if (db->hdb_master_key_set && (flags & HDB_F_DECRYPT)) { in NDBM_seq()
104 ret = hdb_unseal_keys (context, db, &entry->entry); in NDBM_seq()
123 NDBM_firstkey(krb5_context context, HDB *db,unsigned flags,hdb_entry_ex *entry) in NDBM_firstkey() argument
125 return NDBM_seq(context, db, flags, entry, 1); in NDBM_firstkey()
130 NDBM_nextkey(krb5_context context, HDB *db, unsigned flags,hdb_entry_ex *entry) in NDBM_nextkey() argument
132 return NDBM_seq(context, db, flags, entry, 0); in NDBM_nextkey()
160 NDBM_rename(krb5_context context, HDB *db, const char *new_name) in NDBM_rename() argument
167 ret = open_lock_file(context, db->hdb_name, &old_lock_fd); in NDBM_rename()
192 asprintf(&old_dir, "%s.dir", db->hdb_name); in NDBM_rename()
193 asprintf(&old_pag, "%s.pag", db->hdb_name); in NDBM_rename()
218 free(db->hdb_name); in NDBM_rename()
219 db->hdb_name = strdup(new_name); in NDBM_rename()
224 NDBM__get(krb5_context context, HDB *db, krb5_data key, krb5_data *reply) in NDBM__get() argument
226 struct ndbm_db *d = (struct ndbm_db *)db->hdb_db; in NDBM__get()
232 code = db->hdb_lock(context, db, HDB_RLOCK); in NDBM__get()
235 v = dbm_fetch(d->db, k); in NDBM__get()
236 db->hdb_unlock(context, db); in NDBM__get()
245 NDBM__put(krb5_context context, HDB *db, int replace, in NDBM__put() argument
249 struct ndbm_db *d = (struct ndbm_db *)db->hdb_db; in NDBM__put()
258 code = db->hdb_lock(context, db, HDB_WLOCK); in NDBM__put()
261 code = dbm_store(d->db, k, v, replace ? DBM_REPLACE : DBM_INSERT); in NDBM__put()
262 db->hdb_unlock(context, db); in NDBM__put()
274 NDBM__del(krb5_context context, HDB *db, krb5_data key) in NDBM__del() argument
276 struct ndbm_db *d = (struct ndbm_db *)db->hdb_db; in NDBM__del()
283 ret = db->hdb_lock(context, db, HDB_WLOCK); in NDBM__del()
285 code = dbm_delete(d->db, k); in NDBM__del()
286 db->hdb_unlock(context, db); in NDBM__del()
294 NDBM_close(krb5_context context, HDB *db) in NDBM_close() argument
296 struct ndbm_db *d = db->hdb_db; in NDBM_close()
297 dbm_close(d->db); in NDBM_close()
304 NDBM_open(krb5_context context, HDB *db, int flags, mode_t mode) in NDBM_open() argument
314 d->db = dbm_open((char*)db->hdb_name, flags, mode); in NDBM_open()
315 if(d->db == NULL){ in NDBM_open()
318 krb5_set_error_message(context, ret, "dbm_open(%s): %s", db->hdb_name, in NDBM_open()
323 ret = open_lock_file(context, db->hdb_name, &d->lock_fd); in NDBM_open()
326 dbm_close(d->db); in NDBM_open()
333 db->hdb_db = d; in NDBM_open()
335 ret = hdb_check_db_format(context, db); in NDBM_open()
337 ret = hdb_init_db(context, db); in NDBM_open()
341 NDBM_close(context, db); in NDBM_open()
345 db->hdb_name); in NDBM_open()
351 hdb_ndbm_create(krb5_context context, HDB **db, in hdb_ndbm_create() argument
354 *db = calloc(1, sizeof(**db)); in hdb_ndbm_create()
355 if (*db == NULL) { in hdb_ndbm_create()
360 (*db)->hdb_db = NULL; in hdb_ndbm_create()
361 (*db)->hdb_name = strdup(filename); in hdb_ndbm_create()
362 if ((*db)->hdb_name == NULL) { in hdb_ndbm_create()
363 free(*db); in hdb_ndbm_create()
364 *db = NULL; in hdb_ndbm_create()
368 (*db)->hdb_master_key_set = 0; in hdb_ndbm_create()
369 (*db)->hdb_openp = 0; in hdb_ndbm_create()
370 (*db)->hdb_capability_flags = HDB_CAP_F_HANDLE_ENTERPRISE_PRINCIPAL; in hdb_ndbm_create()
371 (*db)->hdb_open = NDBM_open; in hdb_ndbm_create()
372 (*db)->hdb_close = NDBM_close; in hdb_ndbm_create()
373 (*db)->hdb_fetch_kvno = _hdb_fetch_kvno; in hdb_ndbm_create()
374 (*db)->hdb_store = _hdb_store; in hdb_ndbm_create()
375 (*db)->hdb_remove = _hdb_remove; in hdb_ndbm_create()
376 (*db)->hdb_firstkey = NDBM_firstkey; in hdb_ndbm_create()
377 (*db)->hdb_nextkey= NDBM_nextkey; in hdb_ndbm_create()
378 (*db)->hdb_lock = NDBM_lock; in hdb_ndbm_create()
379 (*db)->hdb_unlock = NDBM_unlock; in hdb_ndbm_create()
380 (*db)->hdb_rename = NDBM_rename; in hdb_ndbm_create()
381 (*db)->hdb__get = NDBM__get; in hdb_ndbm_create()
382 (*db)->hdb__put = NDBM__put; in hdb_ndbm_create()
383 (*db)->hdb__del = NDBM__del; in hdb_ndbm_create()
384 (*db)->hdb_destroy = NDBM_destroy; in hdb_ndbm_create()