krb5 commit: Add hints for -A flag to kdestroy
Greg Hudson
ghudson at mit.edu
Thu Jul 7 10:42:30 EDT 2016
https://github.com/krb5/krb5/commit/d4cc39674b407a0d9698097b27788b3ffdbc6fca
commit d4cc39674b407a0d9698097b27788b3ffdbc6fca
Author: Matt Rogers <mrogers at redhat.com>
Date: Tue Jan 26 14:59:43 2016 -0500
Add hints for -A flag to kdestroy
When using a collection ccache, a user accustomed to the FILE ccache
behavior may not be aware of all active caches, and the default
kdestroy command could make it seem like there is no active cache
left. Print a warning to use -A after kdestroy if there are other
caches.
ticket: 8451 (new)
src/clients/kdestroy/kdestroy.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/src/clients/kdestroy/kdestroy.c b/src/clients/kdestroy/kdestroy.c
index 410d6cf..214643b 100644
--- a/src/clients/kdestroy/kdestroy.c
+++ b/src/clients/kdestroy/kdestroy.c
@@ -60,6 +60,30 @@ static void usage()
exit(2);
}
+/* Print a warning if there are still un-destroyed caches in the collection. */
+static void
+print_remaining_cc_warning(krb5_context context)
+{
+ krb5_error_code retval;
+ krb5_ccache cache;
+ krb5_cccol_cursor cursor;
+
+ retval = krb5_cccol_cursor_new(context, &cursor);
+ if (retval) {
+ com_err(progname, retval, _("while listing credential caches"));
+ exit(1);
+ }
+
+ retval = krb5_cccol_cursor_next(context, cursor, &cache);
+ if (retval == 0 && cache != NULL) {
+ fprintf(stderr,
+ _("Other credential caches present, use -A to destroy all\n"));
+ krb5_cc_close(context, cache);
+ }
+
+ krb5_cccol_cursor_free(context, &cursor);
+}
+
int
main(argc, argv)
int argc;
@@ -172,5 +196,9 @@ main(argc, argv)
errflg = 1;
}
}
+
+ if (!quiet && !errflg)
+ print_remaining_cc_warning(kcontext);
+
return errflg;
}
More information about the cvs-krb5
mailing list