}
}
-#define kdb_init_lib_lock(a) 0
-#define kdb_destroy_lib_lock(a) (void)0
-#define kdb_lock_lib_lock(a, b) 0
-#define kdb_unlock_lib_lock(a, b) (void)0
-
/* Caller must free result*/
static char *
if (lib == NULL)
return ENOMEM;
- status = kdb_init_lib_lock(*lib);
- if (status)
- goto cleanup;
-
strlcpy(lib->name, lib_name, sizeof(lib->name));
memcpy(&lib->vftabl, vftabl_addr, sizeof(kdb_vftabl));
kdb_setup_opt_functions(lib);
goto clean_n_exit;
}
- status = kdb_init_lib_lock(*lib);
- if (status) {
- goto clean_n_exit;
- }
-
strlcpy((*lib)->name, lib_name, sizeof((*lib)->name));
/* Fetch the list of directories specified in the config
free(path);
if (status) {
if (*lib) {
- kdb_destroy_lib_lock(*lib);
if (PLUGIN_DIR_OPEN((&(*lib)->dl_dir_handle))) {
krb5int_close_plugin_dirs (&(*lib)->dl_dir_handle);
}
krb5int_close_plugin_dirs (&lib->dl_dir_handle);
}
- kdb_destroy_lib_lock(lib);
-
if (lib->prev == NULL) {
/* first element in the list */
lib_list = lib->next;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
status =
dal_handle->lib_handle->vftabl.init_module(kcontext, section, db_args,
mode);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
-
clean_n_exit:
if (section)
free(section);
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_create(kcontext, section, db_args);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
-
clean_n_exit:
if (section)
free(section);
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.fini_module(kcontext);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
-
if (status) {
goto clean_n_exit;
}
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_destroy(kcontext, section, db_args);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
if (section)
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.db_get_age(kcontext, db_name, t);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_set_option(kcontext, option, value);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- /* acquire an exclusive lock, ensures no other thread uses this context */
- status = kdb_lock_lib_lock(dal_handle->lib_handle, TRUE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.db_lock(kcontext, lock_mode);
get_errmsg(kcontext, status);
- /* exclusive lock is still held, so no other thread could use this context */
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
-
clean_n_exit:
return status;
}
}
dal_handle = kcontext->dal_handle;
- /* normal lock acquired and exclusive lock released */
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.db_unlock(kcontext);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, TRUE);
-
clean_n_exit:
return status;
}
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_get_principal(kcontext, search_for, 0,
entries, nentries,
more);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_get_principal(kcontext, search_for,
flags,
entries, nentries,
more);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_free_principal(kcontext, entry,
count);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
goto clean_n_exit;
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
- /*
- * We need the lock since ulog_conv_2logentry() does a get
- */
if (log_ctx && (log_ctx->iproprole == IPROP_MASTER)) {
if (!(upd = (kdb_incr_update_t *)
malloc(sizeof (kdb_incr_update_t)* *nentries))) {
ulog_locked = 1;
for (i = 0; i < *nentries; i++) {
- /*
- * We'll be sharing the same locks as db for logging
- */
if (fupd) {
if ((status = krb5_unparse_name(kcontext, entries->princ,
&princ_name)))
if (ulog_locked)
ulog_lock(kcontext, KRB5_LOCKMODE_UNLOCK);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
-
clean_n_exit:
free_db_args(kcontext, db_args);
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = ulog_lock(kcontext, KRB5_LOCKMODE_EXCLUSIVE);
- if (status) {
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
+ if (status)
return status;
- }
/*
* We'll be sharing the same locks as db for logging
if (log_ctx && (log_ctx->iproprole == IPROP_MASTER)) {
if ((status = krb5_unparse_name(kcontext, search_for, &princ_name))) {
ulog_lock(kcontext, KRB5_LOCKMODE_UNLOCK);
- (void) kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
return status;
}
if ((status = ulog_delete_update(kcontext, &upd)) != 0) {
ulog_lock(kcontext, KRB5_LOCKMODE_UNLOCK);
free(princ_name);
- (void) kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
return status;
}
(void) ulog_finish_update(kcontext, &upd);
ulog_lock(kcontext, KRB5_LOCKMODE_UNLOCK);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.db_iterate(kcontext,
match_entry,
func, func_arg);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_supported_realms(kcontext, realms);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_free_supported_realms(kcontext,
realms);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.set_master_key(kcontext, pwd, key);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
-
clean_n_exit:
return status;
}
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.set_master_key_list(kcontext, keylist);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
-
clean_n_exit:
return status;
}
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
/* Let's use temp key and copy it later to avoid memory problems
when freed by the caller. */
status = dal_handle->lib_handle->vftabl.get_master_key(kcontext, key);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
/* Let's use temp key and copy it later to avoid memory problems
when freed by the caller. */
status = dal_handle->lib_handle->vftabl.get_master_key_list(kcontext, keylist);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = context->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.fetch_master_key_list(context,
mname,
mkey,
mkvno,
mkey_list);
get_errmsg(context, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.store_master_key(kcontext,
keyfile,
mname,
kvno,
key, master_pwd);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.store_master_key_list(kcontext,
keyfile,
mname,
keylist,
master_pwd);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = context->dal_handle;
- retval = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (retval) {
- goto clean_n_exit;
- }
/* get the enctype from the stash */
tmp_key.enctype = ENCTYPE_UNKNOWN;
kvno,
db_args);
get_errmsg(context, retval);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
if (retval) {
goto clean_n_exit;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.verify_master_key(kcontext,
mprinc,
kvno,
mkey);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.dbe_search_enctype(kcontext,
dbentp,
start,
stype,
kvno, kdatap);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.db_change_pwd(kcontext,
master_key,
ks_tuple,
new_kvno,
keepold, db_entry);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.db_create_policy(kcontext, policy);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_get_policy(kcontext, name, policy,
cnt);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.db_put_policy(kcontext, policy);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_iter_policy(kcontext, match_entry,
func, data);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status = dal_handle->lib_handle->vftabl.db_delete_policy(kcontext, policy);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
dal_handle->lib_handle->vftabl.db_free_policy(kcontext, policy);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.promote_db(kcontext, section, db_args);
get_errmsg(kcontext, status);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
if (section)
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.dbekd_decrypt_key_data(kcontext,
mkey, key_data, dbkey, keysalt);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
}
dal_handle = kcontext->dal_handle;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.dbekd_encrypt_key_data(kcontext,
mkey, dbkey, keysalt, keyver, key_data);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;
goto clean_n_exit;
}
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
status =
dal_handle->lib_handle->vftabl.db_invoke(kcontext,
method,
req,
rep);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
return status;