summaryrefslogtreecommitdiffstats
path: root/src/lib/kdb/kdb5.c
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2010-09-15 17:30:17 +0000
committerGreg Hudson <ghudson@mit.edu>2010-09-15 17:30:17 +0000
commit42406580b65efdcc2d92bd853c430263036f87c9 (patch)
treedd9dc4574470995641e1dc87a4def7decd402a1b /src/lib/kdb/kdb5.c
parent3cfb431097418e2b6d8069a5cd63cfd9794f87b1 (diff)
downloadkrb5-42406580b65efdcc2d92bd853c430263036f87c9.tar.gz
krb5-42406580b65efdcc2d92bd853c430263036f87c9.tar.xz
krb5-42406580b65efdcc2d92bd853c430263036f87c9.zip
Whitespace
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24318 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/kdb/kdb5.c')
-rw-r--r--src/lib/kdb/kdb5.c55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c
index c549689870..e756cfc11d 100644
--- a/src/lib/kdb/kdb5.c
+++ b/src/lib/kdb/kdb5.c
@@ -554,9 +554,9 @@ kdb_free_lib_handle(krb5_context kcontext)
status = kdb_free_library(kcontext->dal_handle->lib_handle);
if (status)
return status;
- /* The dal_handle holds an alias to the most recent mkey_list*/
+ /* The dal_handle holds an alias to the most recent mkey_list. */
if (kcontext->dal_handle->free_keylist) {
- kcontext->dal_handle->master_keylist = NULL; /*force freeing*/
+ kcontext->dal_handle->master_keylist = NULL; /* Force freeing. */
krb5_db_free_mkey_list(kcontext, old_keylist);
}
krb5_free_principal(kcontext, kcontext->dal_handle->master_princ);
@@ -565,7 +565,7 @@ kdb_free_lib_handle(krb5_context kcontext)
return 0;
}
-static krb5_error_code
+static krb5_error_code
get_vftabl(krb5_context kcontext, kdb_vftabl **vftabl_ptr)
{
krb5_error_code status;
@@ -1009,15 +1009,16 @@ krb5_db_fetch_mkey_list(krb5_context context,
if (status)
return status;
if (!context->dal_handle->master_princ) {
- status = krb5_copy_principal(context, mname, &context->dal_handle->master_princ);
+ status = krb5_copy_principal(context, mname,
+ &context->dal_handle->master_princ);
if (status)
return status;
}
if (mkey_list == NULL)
mkey_list = &local_keylist;
- status = v->fetch_master_key_list(context, mname, mkey, mkvno, mkey_list);
+ status = v->fetch_master_key_list(context, mname, mkey, mkvno, mkey_list);
if (status == 0) {
- /* The dal_handle holds an alias to the most recent master_keylist*/
+ /* The dal_handle holds an alias to the most recent master_keylist. */
krb5_keylist_node *old_keylist = context->dal_handle->master_keylist;
context->dal_handle->master_keylist = *mkey_list;
if (context->dal_handle->free_keylist)
@@ -1034,15 +1035,15 @@ krb5_db_free_mkey_list(krb5_context context,
krb5_keylist_node *cur, *prev;
/*
- * The dal_handle holds onto the most recent master
- * keylist that has been fetched throughout the lifetime of the context; if
- * this function is called on that keylist, then the dal_handle is updated to
- * indicate that the keylist should be freed on next call to
- * krb5_db_fetch_mkey_list() or when the database is closed. Otherwise, the
- * master_keylist is freed. Either way, the caller must not access this master
- * keylist after calling this function.
+ * The dal_handle holds onto the most recent master keylist that has been
+ * fetched throughout the lifetime of the context; if this function is
+ * called on that keylist, then the dal_handle is updated to indicate that
+ * the keylist should be freed on next call to krb5_db_fetch_mkey_list() or
+ * when the database is closed. Otherwise, the master_keylist is freed.
+ * Either way, the caller must not access this master keylist after calling
+ * this function.
*/
- if (context&& context->dal_handle->master_keylist == mkey_list) {
+ if (context && context->dal_handle->master_keylist == mkey_list) {
context->dal_handle->free_keylist = 1;
return;
}
@@ -2185,20 +2186,20 @@ krb5_db_promote(krb5_context kcontext, char **db_args)
}
static krb5_error_code
-decrypt_iterator(krb5_context kcontext,
- const krb5_key_data * key_data,
- krb5_keyblock * dbkey,
- krb5_keysalt * keysalt)
+decrypt_iterator(krb5_context kcontext, const krb5_key_data * key_data,
+ krb5_keyblock *dbkey, krb5_keysalt *keysalt)
{
krb5_error_code status = 0;
kdb_vftabl *v;
krb5_keylist_node *n = kcontext->dal_handle->master_keylist;
+
status = get_vftabl(kcontext, &v);
if (status)
return status;
- for (;n; n = n->next) {
+ for (; n; n = n->next) {
krb5_clear_error_message(kcontext);
- status= v->decrypt_key_data(kcontext, &n->keyblock, key_data, dbkey, keysalt);
+ status = v->decrypt_key_data(kcontext, &n->keyblock, key_data, dbkey,
+ keysalt);
if (status == 0)
return 0;
}
@@ -2215,21 +2216,23 @@ krb5_dbe_decrypt_key_data( krb5_context kcontext,
krb5_error_code status = 0;
kdb_vftabl *v;
krb5_keylist_node *n = kcontext->dal_handle->master_keylist;
+ krb5_keyblock *cur_mkey;
+
status = get_vftabl(kcontext, &v);
if (status)
return status;
- if (mkey ||!n)
+ if (mkey || !n)
return v->decrypt_key_data(kcontext, mkey, key_data, dbkey, keysalt);
status = decrypt_iterator(kcontext, key_data, dbkey, keysalt);
if (status == 0)
return 0;
if (kcontext->dal_handle->master_keylist) {
- /* Try reloading master keys*/
- krb5_keyblock *cur_mkey = &kcontext->dal_handle->master_keylist->keyblock;
- if (krb5_db_fetch_mkey_list(kcontext, kcontext->dal_handle->master_princ,
- cur_mkey, -1, NULL) == 0) {
+ /* Try reloading master keys. */
+ cur_mkey = &kcontext->dal_handle->master_keylist->keyblock;
+ if (krb5_db_fetch_mkey_list(kcontext,
+ kcontext->dal_handle->master_princ,
+ cur_mkey, -1, NULL) == 0)
return decrypt_iterator(kcontext, key_data, dbkey, keysalt);
- }
}
return status;
}