klist: Better recognize cc collection default
This commit is contained in:
@@ -522,16 +522,16 @@ static int
|
|||||||
list_caches(krb5_context context, struct klist_options *opt)
|
list_caches(krb5_context context, struct klist_options *opt)
|
||||||
{
|
{
|
||||||
krb5_cccol_cursor cursor;
|
krb5_cccol_cursor cursor;
|
||||||
const char *cdef_name;
|
const char *cdef_name = krb5_cc_default_name(context);
|
||||||
char *def_name;
|
char *def_name;
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
krb5_ccache id;
|
krb5_ccache id;
|
||||||
rtbl_t ct;
|
rtbl_t ct;
|
||||||
|
|
||||||
cdef_name = krb5_cc_default_name(context);
|
if ((def_name = krb5_cccol_get_default_ccname(context)) == NULL)
|
||||||
if (cdef_name == NULL)
|
cdef_name = krb5_cc_default_name(context);
|
||||||
krb5_errx(context, 1, "krb5_cc_default_name");
|
if (!def_name && cdef_name && (def_name = strdup(cdef_name)) == NULL)
|
||||||
def_name = strdup(cdef_name);
|
krb5_err(context, 1, ENOMEM, "Out of memory");
|
||||||
|
|
||||||
ret = krb5_cccol_cursor_new(context, &cursor);
|
ret = krb5_cccol_cursor_new(context, &cursor);
|
||||||
if (ret == KRB5_CC_NOSUPP) {
|
if (ret == KRB5_CC_NOSUPP) {
|
||||||
@@ -581,7 +581,7 @@ list_caches(krb5_context context, struct klist_options *opt)
|
|||||||
rtbl_add_column_entry(ct, COL_CACHENAME, fname);
|
rtbl_add_column_entry(ct, COL_CACHENAME, fname);
|
||||||
if (opt->json_flag)
|
if (opt->json_flag)
|
||||||
;
|
;
|
||||||
else if (strcmp(fname, def_name) == 0)
|
else if (def_name && strcmp(fname, def_name) == 0)
|
||||||
rtbl_add_column_entry(ct, COL_DEFCACHE, "*");
|
rtbl_add_column_entry(ct, COL_DEFCACHE, "*");
|
||||||
else
|
else
|
||||||
rtbl_add_column_entry(ct, COL_DEFCACHE, "");
|
rtbl_add_column_entry(ct, COL_DEFCACHE, "");
|
||||||
|
Reference in New Issue
Block a user