summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2013-10-24 13:16:54 -0400
committerGreg Hudson <ghudson@mit.edu>2013-10-25 11:36:12 -0400
commit0db3c9a631feaf32420d03b76e1d720d64a707a9 (patch)
treeb6f384bc25ec0b2fabc258db0fee01e5481931bf
parent89081ef62b0add869501f98ed3c49638b5327876 (diff)
downloadkrb5-0db3c9a631feaf32420d03b76e1d720d64a707a9.tar.gz
krb5-0db3c9a631feaf32420d03b76e1d720d64a707a9.tar.xz
krb5-0db3c9a631feaf32420d03b76e1d720d64a707a9.zip
Simplify kdb5_list_mkeys actkvno list retrieval
After recent changes, krb5_dbe_lookup_actkvno cannot yield an empty list and cannot return KRB5_KDB_NOACTMASTERKEY.
-rw-r--r--src/kadmin/dbutil/kdb5_mkey.c46
1 files changed, 12 insertions, 34 deletions
diff --git a/src/kadmin/dbutil/kdb5_mkey.c b/src/kadmin/dbutil/kdb5_mkey.c
index 87a1dc319..59bce3cb0 100644
--- a/src/kadmin/dbutil/kdb5_mkey.c
+++ b/src/kadmin/dbutil/kdb5_mkey.c
@@ -610,22 +610,12 @@ kdb5_list_mkeys(int argc, char *argv[])
goto cleanup_return;
}
- if (actkvno_list == NULL) {
- act_kvno = master_entry->key_data[0].key_data_kvno;
- } else {
- retval = krb5_dbe_find_act_mkey(util_context, actkvno_list, &act_kvno,
- &act_mkey);
- if (retval == KRB5_KDB_NOACTMASTERKEY) {
- /* Maybe we went through a time warp, and the only keys
- with activation dates have them set in the future? */
- com_err(progname, retval, "");
- /* Keep going. */
- act_kvno = -1;
- } else if (retval != 0) {
- com_err(progname, retval, _("while looking up active master key"));
- exit_status++;
- goto cleanup_return;
- }
+ retval = krb5_dbe_find_act_mkey(util_context, actkvno_list, &act_kvno,
+ &act_mkey);
+ if (retval != 0) {
+ com_err(progname, retval, _("while looking up active master key"));
+ exit_status++;
+ goto cleanup_return;
}
printf("Master keys for Principal: %s\n", mkey_fullname);
@@ -640,24 +630,12 @@ kdb5_list_mkeys(int argc, char *argv[])
goto cleanup_return;
}
- if (actkvno_list != NULL) {
- act_time = -1; /* assume actkvno entry not found */
- for (cur_actkvno = actkvno_list; cur_actkvno != NULL;
- cur_actkvno = cur_actkvno->next) {
- if (cur_actkvno->act_kvno == cur_kb_node->kvno) {
- act_time = cur_actkvno->act_time;
- break;
- }
- }
- } else {
- /*
- * mkey princ doesn't have an active knvo list so assume the current
- * key is active now
- */
- if ((retval = krb5_timeofday(util_context, &act_time))) {
- com_err(progname, retval, _("while getting current time"));
- exit_status++;
- goto cleanup_return;
+ act_time = -1; /* assume actkvno entry not found */
+ for (cur_actkvno = actkvno_list; cur_actkvno != NULL;
+ cur_actkvno = cur_actkvno->next) {
+ if (cur_actkvno->act_kvno == cur_kb_node->kvno) {
+ act_time = cur_actkvno->act_time;
+ break;
}
}