diff options
author | Bill Sommerfeld <wesommer@mit.edu> | 1990-02-03 10:40:28 +0000 |
---|---|---|
committer | Bill Sommerfeld <wesommer@mit.edu> | 1990-02-03 10:40:28 +0000 |
commit | 4771917b69129c0225feea34165ca0071346d348 (patch) | |
tree | 630c5decbd87f9dbda8e8f06a12960ce0d9561b7 /src/clients/kdestroy | |
parent | 85448fb04aa22411ce6276ca3b2cbe7795bf91be (diff) | |
download | krb5-4771917b69129c0225feea34165ca0071346d348.tar.gz krb5-4771917b69129c0225feea34165ca0071346d348.tar.xz krb5-4771917b69129c0225feea34165ca0071346d348.zip |
Initial revision
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@245 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/clients/kdestroy')
-rw-r--r-- | src/clients/kdestroy/kdestroy.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/clients/kdestroy/kdestroy.c b/src/clients/kdestroy/kdestroy.c new file mode 100644 index 000000000..3e9e801c2 --- /dev/null +++ b/src/clients/kdestroy/kdestroy.c @@ -0,0 +1,79 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * <krb5/mit-copyright.h>. + * + * Destroy the contents of your credential cache. + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_klist_c [] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include <stdio.h> + +#include <krb5/copyright.h> +#include <krb5/krb5.h> + +extern int optind; +extern char *optarg; + +main(argc, argv) + int argc; + char **argv; +{ + int c; + krb5_ccache cache = NULL; + char *cache_name = NULL; + int code; + int errflg=0; + + initialize_krb5_error_table(); + + while ((c = getopt(argc, argv, "c:")) != EOF) { + switch (c) { + case 'c': + if (cache == NULL) { + cache_name = optarg; + + code = krb5_cc_resolve (cache_name, &cache); + if (code != 0) { + com_err (argv[0], code, "while resolving %s", cache_name); + errflg++; + } + } else { + fprintf(stderr, "Only one -c option allowed\n"); + errflg++; + } + break; + case '?': + default: + errflg++; + break; + } + } + + if (optind != argc) + errflg++; + + if (errflg) { + fprintf(stderr, "Usage: %s [ -c cache-name ]\n", argv[0]); + exit(2); + } + + if (cache == NULL) + cache = krb5_cc_default (); + + code = krb5_cc_destroy (cache); + if (code != 0) { + com_err (argv[0], code, "while destroying cache"); + fprintf(stderr, "Ticket cache \007NOT\007 destroyed!\n"); + exit (1); + } + exit (0); +} |