summaryrefslogtreecommitdiffstats
path: root/src/admin
diff options
context:
space:
mode:
authorRichard Basch <probe@mit.edu>1995-10-30 15:59:04 +0000
committerRichard Basch <probe@mit.edu>1995-10-30 15:59:04 +0000
commit9f4a4c5938a3cb89c7e0693ca5a195e9678569cf (patch)
tree318711c1c7576058b05f4e0f48445c41b3816c90 /src/admin
parentfa4e342bbbf52e060191a9e250354569cb769bd2 (diff)
downloadkrb5-9f4a4c5938a3cb89c7e0693ca5a195e9678569cf.tar.gz
krb5-9f4a4c5938a3cb89c7e0693ca5a195e9678569cf.tar.xz
krb5-9f4a4c5938a3cb89c7e0693ca5a195e9678569cf.zip
When showing a principal with the "show" command, iterate through the
keys, displaying the version number and type. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7004 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/admin')
-rw-r--r--src/admin/edit/kdb5_edit.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/admin/edit/kdb5_edit.c b/src/admin/edit/kdb5_edit.c
index 9c7c202d0..b2d8dba0a 100644
--- a/src/admin/edit/kdb5_edit.c
+++ b/src/admin/edit/kdb5_edit.c
@@ -1045,6 +1045,7 @@ void show_principal(argc, argv)
krb5_error_code retval;
char *pr_name = 0;
char buffer[256];
+ int i;
if (argc < 2) {
com_err(argv[0], 0, "Too few arguments");
@@ -1089,7 +1090,6 @@ void show_principal(argc, argv)
}
printf("Name: %s\n", pr_name);
- printf("Key version: %d\n", entry.key_data[0].key_data_kvno);
printf("Maximum life: %s\n", strdur(entry.max_life));
printf("Maximum renewable life: %s\n", strdur(entry.max_renewable_life));
printf("Master key version: %d\n", entry.mkvno);
@@ -1113,13 +1113,32 @@ void show_principal(argc, argv)
(void) krb5_flags_to_string(entry.attributes, ", ",
buffer, sizeof(buffer));
printf("Attributes: %s\n", buffer);
- /* printf("Salt: %d\n", entry.salt_type);
- printf("Alt salt: %d\n", entry.salt_type); */
-
- if (!nprincs) {
- com_err(argv[0], 0, "Principal '%s' does not exist", argv[1]);
- exit_status++;
- goto errout;
+
+ printf("Number of keys: %d\n", entry.n_key_data);
+ for (i = 0; i < entry.n_key_data; i++) {
+ char enctype[64], salttype[32];
+ krb5_keyblock key;
+ krb5_keysalt salt;
+
+ if ((retval = krb5_dbekd_decrypt_key_data(edit_context,
+ &master_encblock,
+ &entry.key_data[i],
+ &key, &salt))) {
+ com_err(argv[0], retval, "while reading key information");
+ continue;
+ }
+
+ /* Paranoia... */
+ memset((char *)key.contents, 0, key.length);
+ krb5_xfree(key.contents);
+
+ if (krb5_enctype_to_string(key.enctype, enctype, sizeof(enctype)))
+ sprintf(enctype, "<Encryption type 0x%x>", key.enctype);
+ if (krb5_salttype_to_string(salt.type, salttype, sizeof(salttype)))
+ sprintf(salttype, "<Salt type 0x%x>", salt.type);
+
+ printf("Key: Version %d, Type %s/%s\n",
+ entry.key_data[i].key_data_kvno, enctype, salttype);
}
errout: