From: John Kohl Date: Wed, 2 May 1990 18:27:22 +0000 (+0000) Subject: convert to macro-ized function style X-Git-Tag: krb5-1.0-alpha2~716 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=37d1aac44f55f09421bbc8c6fb98cb3844bdf2a8;p=krb5.git convert to macro-ized function style print better error msgs when no cache git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@680 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/clients/klist/klist.c b/src/clients/klist/klist.c index fdbc7879f..6b3ab3a0e 100644 --- a/src/clients/klist/klist.c +++ b/src/clients/klist/klist.c @@ -23,6 +23,7 @@ static char rcsid_klist_c [] = #include #include #include +#include extern int optind; extern char *optarg; @@ -84,11 +85,17 @@ main(argc, argv) cache = krb5_cc_default(); flags = 0; /* turns off OPENCLOSE mode */ - if (code = (*cache->ops->set_flags)(cache, flags)) { - com_err(argv[0], code, "while setting cache flags"); + if (code = krb5_cc_set_flags(cache, flags)) { + if (code == ENOENT) { + com_err(argv[0], code, "(ticket cache %s)", + krb5_cc_get_name(cache)); + } else + com_err(argv[0], code, + "while setting cache flags (ticket cache %s)", + krb5_cc_get_name(cache)); exit(1); } - if (code = (*cache->ops->get_princ)(cache, &princ)) { + if (code = krb5_cc_get_principal(cache, &princ)) { com_err(argv[0], code, "while retrieving principal name"); exit(1); } @@ -99,11 +106,11 @@ main(argc, argv) printf("Ticket cache: %s\nDefault principal: %s\n", (*cache->ops->get_name)(cache), name); free(name); - if (code = (*cache->ops->get_first)(cache, &cur)) { + if (code = krb5_cc_start_seq_get(cache, &cur)) { com_err(argv[0], code, "while starting to retrieve tickets"); exit(1); } - while (!(code = (*cache->ops->get_next)(cache, &cur, &creds))) { + while (!(code = krb5_cc_next_cred(cache, &cur, &creds))) { code = krb5_unparse_name(creds.client, &name); if (code) { com_err(argv[0], code, "while unparsing client name"); @@ -118,7 +125,7 @@ main(argc, argv) printf("C: %s\tS:%s\n", name, sname); } if (code == KRB5_CC_END) { - if (code = (*cache->ops->end_get)(cache, &cur)) { + if (code = krb5_cc_end_seq_get(cache, &cur)) { com_err(argv[0], code, "while finishing ticket retrieval"); exit(1); }