diff options
Diffstat (limited to 'src/clients/klist/klist.c')
-rw-r--r-- | src/clients/klist/klist.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/clients/klist/klist.c b/src/clients/klist/klist.c index de435c4..2d77f7f 100644 --- a/src/clients/klist/klist.c +++ b/src/clients/klist/klist.c @@ -1,7 +1,7 @@ /* * clients/klist/klist.c * - * Copyright 1990 by the Massachusetts Institute of Technology. + * Copyright 1990,2001 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -53,6 +53,8 @@ #include <netdb.h> #endif +extern int optind; + int show_flags = 0, show_time = 0, status_only = 0, show_keys = 0; int show_etype = 0, show_addresses = 0, no_resolve = 0; char *defname; @@ -130,6 +132,7 @@ main(argc, argv) int argc; char **argv; { + int c; char *name; int mode; int use_k5 = 0, use_k4 = 0; @@ -141,14 +144,10 @@ main(argc, argv) progname = GET_PROGNAME(argv[0]); - argv++; name = NULL; mode = DEFAULT; - while (*argv) { - if ((*argv)[0] != '-') { - if (name) usage(); - name = *argv; - } else switch ((*argv)[1]) { + while ((c = getopt(argc, argv, "fetKsnack45")) != -1) { + switch (c) { case 'f': show_flags = 1; break; @@ -202,7 +201,6 @@ main(argc, argv) usage(); break; } - argv++; } if (no_resolve && !show_addresses) { @@ -217,6 +215,14 @@ main(argc, argv) usage(); } + if (argc - optind > 1) { + fprintf(stderr, "Extra arguments (starting with \"%s\").\n", + argv[optind+1]); + usage(); + } + + name = (optind == argc-1) ? argv[optind] : 0; + if (!use_k5 && !use_k4) { use_k5 = default_k5; @@ -514,6 +520,12 @@ flags_string(cred) buf[i++] = 'H'; if (cred->ticket_flags & TKT_FLG_PRE_AUTH) buf[i++] = 'A'; + if (cred->ticket_flags & TKT_FLG_TRANSIT_POLICY_CHECKED) + buf[i++] = 'T'; + if (cred->ticket_flags & TKT_FLG_OK_AS_DELEGATE) + buf[i++] = 'O'; /* D/d are taken. Use short strings? */ + if (cred->ticket_flags & TKT_FLG_ANONYMOUS) + buf[i++] = 'a'; buf[i] = '\0'; return(buf); } |