From 4f27b6b22943b034095781072cc0a59c08e3a87f Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Wed, 24 Mar 1999 04:53:30 +0000 Subject: [PATCH] add support for destroying v4 tickets and AFS tokens. based on code by Love git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5735 ec53bebd-3082-4978-b11e-865c3cabbd6b --- kuser/kdestroy.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/kuser/kdestroy.c b/kuser/kdestroy.c index 58fc5f514..f11fe5f70 100644 --- a/kuser/kdestroy.c +++ b/kuser/kdestroy.c @@ -39,12 +39,18 @@ #include "kuser_locl.h" RCSID("$Id$"); -char *cache; -int help_flag; -int version_flag; +static char *cache; +static int help_flag; +static int version_flag; +static int unlog_flag = 1; +static int dest_tkt_flag = 1; struct getargs args[] = { { "cache", 'c', arg_string, &cache, "cache to destroy", "cache" }, + { "unlog", 0, arg_negative_flag, &unlog_flag, + "do not destroy tokens", NULL }, + { "delete-v4", 0, arg_negative_flag, &dest_tkt_flag, + "do not destroy v4 tickets", NULL }, { "version", 0, arg_flag, &version_flag, NULL, NULL }, { "help", 'h', arg_flag, &help_flag, NULL, NULL} }; @@ -65,6 +71,7 @@ main (int argc, char **argv) krb5_context context; krb5_ccache ccache; int optind = 0; + int exit_val = 0; set_progname (argv[0]); @@ -97,11 +104,22 @@ main (int argc, char **argv) &ccache); if (ret) - errx (1, "krb5_cc_resolve(%s): %s", cache, krb5_get_err_text(context, ret)); + errx (1, "krb5_cc_resolve(%s): %s", cache, + krb5_get_err_text(context, ret)); ret = krb5_cc_destroy (context, ccache); if (ret) errx (1, "krb5_cc_destroy: %s", krb5_get_err_text(context, ret)); krb5_free_context (context); - return 0; + +#if KRB4 + if(dest_tkt_flag && dest_tkt ()) + exit_val = 1; +#endif + if (unlog_flag && k_hasafs ()) { + if (k_unlog ()) + exit_val = 1; + } + + return exit_val; }