print friendly name

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24182 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-12-15 04:29:13 +00:00
parent 0aef0e3e46
commit bf2976562a

View File

@@ -58,6 +58,7 @@ printable_time_long(time_t t)
#define COL_ISSUED NP_(" Issued","") #define COL_ISSUED NP_(" Issued","")
#define COL_EXPIRES NP_(" Expires", "") #define COL_EXPIRES NP_(" Expires", "")
#define COL_FLAGS NP_("Flags", "") #define COL_FLAGS NP_("Flags", "")
#define COL_NAME NP_(" Name", "")
#define COL_PRINCIPAL NP_(" Principal", "") #define COL_PRINCIPAL NP_(" Principal", "")
#define COL_PRINCIPAL_KVNO NP_(" Principal (kvno)", "") #define COL_PRINCIPAL_KVNO NP_(" Principal (kvno)", "")
#define COL_CACHENAME NP_(" Cache name", "") #define COL_CACHENAME NP_(" Cache name", "")
@@ -495,34 +496,35 @@ list_caches(void)
krb5_err (context, 1, ret, "krb5_cc_cache_get_first"); krb5_err (context, 1, ret, "krb5_cc_cache_get_first");
ct = rtbl_create(); ct = rtbl_create();
rtbl_add_column(ct, COL_PRINCIPAL, 0); rtbl_add_column(ct, COL_NAME, 0);
rtbl_add_column(ct, COL_CACHENAME, 0); rtbl_add_column(ct, COL_CACHENAME, 0);
rtbl_add_column(ct, COL_EXPIRES, 0); rtbl_add_column(ct, COL_EXPIRES, 0);
rtbl_set_prefix(ct, " "); rtbl_set_prefix(ct, " ");
rtbl_set_column_prefix(ct, COL_PRINCIPAL, ""); rtbl_set_column_prefix(ct, COL_NAME, "");
while ((ret = krb5_cc_cache_next (context, cursor, &id)) == 0) { while ((ret = krb5_cc_cache_next (context, cursor, &id)) == 0) {
krb5_principal principal; krb5_principal principal = NULL;
int expired = 0;
char *name; char *name;
time_t t;
ret = krb5_cc_get_principal(context, id, &principal); ret = krb5_cc_get_principal(context, id, &principal);
if (ret == 0) { if (ret == 0)
time_t t; expired = check_for_tgt (context, id, principal, &t);
int expired = check_for_tgt (context, id, principal, &t);
ret = krb5_unparse_name(context, principal, &name); ret = krb5_cc_get_friendly_name(context, id, &name);
if (ret == 0) { if (ret == 0) {
rtbl_add_column_entry(ct, COL_PRINCIPAL, name); rtbl_add_column_entry(ct, COL_NAME, name);
rtbl_add_column_entry(ct, COL_CACHENAME, rtbl_add_column_entry(ct, COL_CACHENAME,
krb5_cc_get_name(context, id)); krb5_cc_get_name(context, id));
rtbl_add_column_entry(ct, COL_EXPIRES, rtbl_add_column_entry(ct, COL_EXPIRES,
expired ? N_(">>> Expired <<<", "") : expired ? N_(">>> Expired <<<", "") :
printable_time(t)); printable_time(t));
free(name); free(name);
krb5_free_principal(context, principal);
}
} }
krb5_cc_close(context, id); krb5_cc_close(context, id);
if (principal)
krb5_free_principal(context, principal);
} }
krb5_cc_cache_end_seq_get(context, cursor); krb5_cc_cache_end_seq_get(context, cursor);