In the list caches view, rename the Status field to Expires.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16245 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -60,7 +60,6 @@ printable_time_long(time_t t)
|
|||||||
#define COL_PRINCIPAL " Principal"
|
#define COL_PRINCIPAL " Principal"
|
||||||
#define COL_PRINCIPAL_KVNO " Principal (kvno)"
|
#define COL_PRINCIPAL_KVNO " Principal (kvno)"
|
||||||
#define COL_CACHENAME " Cache name"
|
#define COL_CACHENAME " Cache name"
|
||||||
#define COL_STATUS " Status"
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_cred(krb5_context context, krb5_creds *cred, rtbl_t ct, int do_flags)
|
print_cred(krb5_context context, krb5_creds *cred, rtbl_t ct, int do_flags)
|
||||||
@@ -305,7 +304,8 @@ print_tickets (krb5_context context,
|
|||||||
static int
|
static int
|
||||||
check_for_tgt (krb5_context context,
|
check_for_tgt (krb5_context context,
|
||||||
krb5_ccache ccache,
|
krb5_ccache ccache,
|
||||||
krb5_principal principal)
|
krb5_principal principal,
|
||||||
|
time_t *expiration)
|
||||||
{
|
{
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
krb5_creds pattern;
|
krb5_creds pattern;
|
||||||
@@ -331,7 +331,12 @@ check_for_tgt (krb5_context context,
|
|||||||
return 1;
|
return 1;
|
||||||
krb5_err (context, 1, ret, "krb5_cc_retrieve_cred");
|
krb5_err (context, 1, ret, "krb5_cc_retrieve_cred");
|
||||||
}
|
}
|
||||||
|
|
||||||
expired = time(NULL) > creds.times.endtime;
|
expired = time(NULL) > creds.times.endtime;
|
||||||
|
|
||||||
|
if (expiration)
|
||||||
|
*expiration = creds.times.endtime;
|
||||||
|
|
||||||
krb5_free_cred_contents (context, &creds);
|
krb5_free_cred_contents (context, &creds);
|
||||||
|
|
||||||
return expired;
|
return expired;
|
||||||
@@ -585,7 +590,7 @@ display_v5_ccache (const char *cred_cache, int do_test, int do_verbose,
|
|||||||
krb5_err (context, 1, ret, "krb5_cc_get_principal");
|
krb5_err (context, 1, ret, "krb5_cc_get_principal");
|
||||||
}
|
}
|
||||||
if (do_test)
|
if (do_test)
|
||||||
exit_status = check_for_tgt (context, ccache, principal);
|
exit_status = check_for_tgt (context, ccache, principal, NULL);
|
||||||
else
|
else
|
||||||
print_tickets (context, ccache, principal, do_verbose, do_flags);
|
print_tickets (context, ccache, principal, do_verbose, do_flags);
|
||||||
|
|
||||||
@@ -624,7 +629,7 @@ list_caches(void)
|
|||||||
ct = rtbl_create();
|
ct = rtbl_create();
|
||||||
rtbl_add_column(ct, COL_PRINCIPAL, 0);
|
rtbl_add_column(ct, COL_PRINCIPAL, 0);
|
||||||
rtbl_add_column(ct, COL_CACHENAME, 0);
|
rtbl_add_column(ct, COL_CACHENAME, 0);
|
||||||
rtbl_add_column(ct, COL_STATUS, 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_PRINCIPAL, "");
|
||||||
|
|
||||||
@@ -634,15 +639,17 @@ list_caches(void)
|
|||||||
|
|
||||||
ret = krb5_cc_get_principal(context, id, &principal);
|
ret = krb5_cc_get_principal(context, id, &principal);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
int expired = check_for_tgt (context, id, principal);
|
time_t t;
|
||||||
|
int expired = check_for_tgt (context, id, principal, &t);
|
||||||
|
|
||||||
ret = krb5_unparse_name(context, principal, &name);
|
ret = krb5_unparse_name(context, principal, &name);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
rtbl_add_column_entry(ct, COL_PRINCIPAL, name);
|
rtbl_add_column_entry(ct, COL_PRINCIPAL, 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_STATUS,
|
rtbl_add_column_entry(ct, COL_EXPIRES,
|
||||||
expired ? "Expired" : "Valid");
|
expired ? ">>> Expired <<<" :
|
||||||
|
printable_time(t));
|
||||||
free(name);
|
free(name);
|
||||||
krb5_free_principal(context, principal);
|
krb5_free_principal(context, principal);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user