/* No plugins! */
status = KRB5_KDB_DBTYPE_NOTFOUND;
krb5_set_error_message (kcontext, status,
- _("Unable to find requested database module '%s': plugin symbol 'kdb_function_table' not found"),
+ _("Unable to load requested database module '%s': plugin symbol 'kdb_function_table' not found"),
lib_name);
goto clean_n_exit;
}
return status;
}
+static void
+get_errmsg (krb5_context kcontext, krb5_error_code err_code)
+{
+ kdb5_dal_handle *dal_handle;
+ const char *e;
+ if (err_code == 0)
+ return;
+ assert(kcontext != NULL);
+ /* Must be called with dal_handle->lib_handle locked! */
+ assert(kcontext->db_context != NULL);
+ dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ e = dal_handle->lib_handle->vftabl.errcode_2_string(kcontext, err_code);
+ assert (e != NULL);
+ krb5_set_error_message(kcontext, err_code, "%s", e);
+ dal_handle->lib_handle->vftabl.release_errcode_string(kcontext, e);
+}
+
/*
* External functions... DAL API
*/
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);
return status;
}
-const char *
-krb5_db_errcode2string(krb5_context kcontext, long err_code)
-{
- const char *err_str = NULL;
- krb5_error_code status = 0;
- kdb5_dal_handle *dal_handle;
-
- if (kcontext->db_context == NULL) {
- status = kdb_setup_lib_handle(kcontext);
- if (status) {
- goto clean_n_exit;
- }
- }
-
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
- status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
- if (status) {
- goto clean_n_exit;
- }
-
- err_str =
- dal_handle->lib_handle->vftabl.errcode_2_string(kcontext, err_code);
- kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
-
- clean_n_exit:
- return err_str;
-}
-
krb5_error_code
krb5_db_inited(krb5_context kcontext)
{
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);
}
status = dal_handle->lib_handle->vftabl.fini_module(kcontext);
+ get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
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:
}
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:
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:
}
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);
}
status = dal_handle->lib_handle->vftabl.db_unlock(kcontext);
+ get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, TRUE);
dal_handle->lib_handle->vftabl.db_get_principal(kcontext, search_for,
entries, nentries,
more);
+ get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
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:
status = dal_handle->lib_handle->vftabl.db_put_principal(kcontext, entries,
nentries,
db_args);
+ get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
dal_handle->lib_handle->vftabl.db_delete_principal(kcontext,
search_for,
nentries);
+ get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
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:
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:
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:
}
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);
/* Lets 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:
db_arg,
mname,
key, master_pwd);
+ get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
&tmp_key,
&kvno,
db_args);
+ get_errmsg(context, retval);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
if (retval) {
status = dal_handle->lib_handle->vftabl.verify_master_key(kcontext,
mprinc, mkey);
+ get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
ktype,
stype,
kvno, kdatap);
+ get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
clean_n_exit:
passwd,
new_kvno,
keepold, db_entry);
+ get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
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:
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:
}
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:
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:
}
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:
}
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:
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: