static int display_v5_ccache (krb5_context context, krb5_ccache ccache, int do_test, int do_verbose, int do_flags, int do_hidden) { krb5_error_code ret; krb5_principal principal; int exit_status = 0; ret = krb5_cc_get_principal (context, ccache, &principal); if (ret) { if(ret == ENOENT) { if (!do_test) krb5_warnx(context, N_("No ticket file: %s", ""), krb5_cc_get_name(context, ccache)); return 1; } else krb5_err (context, 1, ret, "krb5_cc_get_principal"); } if (do_test) exit_status = check_for_tgt (context, ccache, principal, NULL); else print_tickets (context, ccache, principal, do_verbose, do_flags, do_hidden); ret = krb5_cc_close (context, ccache); if (ret) krb5_err (context, 1, ret, "krb5_cc_close"); krb5_free_principal (context, principal); return exit_status; }
static int klist5(void) { krb5_error_code ret; krb5_context context; krb5_ccache ccache; krb5_principal principal; int exit_status = 200; ret = krb5_init_context (&context); if (ret) { lreply(500, "krb5_init_context failed: %d", ret); return 500; } if (k5ccname) ret = krb5_cc_resolve(context, k5ccname, &ccache); else ret = krb5_cc_default (context, &ccache); if (ret) { lreply(500, "krb5_cc_default: %d", ret); return 500; } ret = krb5_cc_get_principal (context, ccache, &principal); if (ret) { if(ret == ENOENT) lreply(500, "No ticket file: %s", krb5_cc_get_name(context, ccache)); else lreply(500, "krb5_cc_get_principal: %d", ret); return 500; } exit_status = print_tickets (context, ccache, principal); ret = krb5_cc_close (context, ccache); if (ret) { lreply(500, "krb5_cc_close: %d", ret); exit_status = 500; } krb5_free_principal (context, principal); krb5_free_context (context); return exit_status; }