summaryrefslogtreecommitdiffstats
path: root/src/lib/kdb/kdb5.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2006-06-30 03:51:48 +0000
committerKen Raeburn <raeburn@mit.edu>2006-06-30 03:51:48 +0000
commit2316e1c4159552a897ac267e04ae0b84f08fa8b5 (patch)
tree7a527c1b0988ce582f4a4ef7f42040394f232564 /src/lib/kdb/kdb5.c
parent3f2442bbf3cc7625484da7aaaa57d5d3c7cf6db6 (diff)
downloadkrb5-2316e1c4159552a897ac267e04ae0b84f08fa8b5.tar.gz
krb5-2316e1c4159552a897ac267e04ae0b84f08fa8b5.tar.xz
krb5-2316e1c4159552a897ac267e04ae0b84f08fa8b5.zip
New kdb backend operation promote_db, makes a temporary database become the
live database. New function krb5_db_promote invokes it. ticket: 3964 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18282 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/kdb/kdb5.c')
-rw-r--r--src/lib/kdb/kdb5.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c
index 852fc85b76..46f0eeb8f8 100644
--- a/src/lib/kdb/kdb5.c
+++ b/src/lib/kdb/kdb5.c
@@ -1890,3 +1890,43 @@ krb5_db_free_policy(krb5_context kcontext, osa_policy_ent_t policy)
clean_n_exit:
return;
}
+
+krb5_error_code
+krb5_db_promote(krb5_context kcontext, char **db_args)
+{
+ krb5_error_code status = 0;
+ char *section = NULL;
+ kdb5_dal_handle *dal_handle;
+
+ section = kdb_get_conf_section(kcontext);
+ if (section == NULL) {
+ status = KRB5_KDB_SERVER_INTERNAL_ERR;
+ krb5_set_error_message (kcontext, status,
+ "unable to determine configuration section for realm %s\n",
+ kcontext->default_realm);
+ goto clean_n_exit;
+ }
+
+ 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;
+ }
+
+ status =
+ dal_handle->lib_handle->vftabl.promote_db(kcontext, section, db_args);
+ kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
+
+ clean_n_exit:
+ if (section)
+ free(section);
+ return status;
+}
+