[29484] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Add hints for -A flag to kdestroy

daemon@ATHENA.MIT.EDU (Greg Hudson)
Thu Jul 7 10:42:33 2016

Date: Thu, 7 Jul 2016 10:42:30 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201607071442.u67EgUYC001889@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/d4cc39674b407a0d9698097b27788b3ffdbc6fca
commit d4cc39674b407a0d9698097b27788b3ffdbc6fca
Author: Matt Rogers <mrogers@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;
 }
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post