Blame SOURCES/Continue-after-KRB5_CC_END-in-KCM-cache-iteration.patch

665228
From 0890a832accffe4ddfb882528346b3d9c65b351c Mon Sep 17 00:00:00 2001
665228
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
665228
Date: Wed, 28 Mar 2018 18:27:06 +0200
665228
Subject: [PATCH] Continue after KRB5_CC_END in KCM cache iteration
665228
665228
The KCM server returns KRB5_CC_END in response to a GET_CACHE_BY_UUID
665228
request to indicate that the specified ccache uuid no longer exists.
665228
In krb5_ptcursor_next(), ignore this error and continue the iteration,
665228
as the Heimdal KCM client code does.
665228
665228
In addition to addressing the case where a third party deletes a cache
665228
between the GET_CACHE_UUID_LIST request and when we reach that uuid in
665228
the iteration, this change also fixes a bug in kdestroy -A where the
665228
caller deletes the primary cache and we later request it by uuid when
665228
iterating over the list.
665228
665228
[ghudson@mit.edu: rewrote commit message; edited comment]
665228
665228
(cherry picked from commit 49087f5e6309f298f8898c35af6f4ade418ced60)
665228
665228
ticket: 8658
665228
version_fixed: 1.16.1
665228
665228
(cherry picked from commit 576d4294ea789c3d25c50a43fe9246cfe499585f)
665228
---
665228
 src/lib/krb5/ccache/cc_kcm.c | 3 +++
665228
 1 file changed, 3 insertions(+)
665228
665228
diff --git a/src/lib/krb5/ccache/cc_kcm.c b/src/lib/krb5/ccache/cc_kcm.c
665228
index a889e67b4..a3afd7056 100644
665228
--- a/src/lib/krb5/ccache/cc_kcm.c
665228
+++ b/src/lib/krb5/ccache/cc_kcm.c
665228
@@ -966,6 +966,9 @@ kcm_ptcursor_next(krb5_context context, krb5_cc_ptcursor cursor,
665228
         kcmreq_init(&req, KCM_OP_GET_CACHE_BY_UUID, NULL);
665228
         k5_buf_add_len(&req.reqbuf, id, KCM_UUID_LEN);
665228
         ret = kcmio_call(context, data->io, &req;;
665228
+        /* Continue if the cache has been deleted. */
665228
+        if (ret == KRB5_CC_END)
665228
+            continue;
665228
         if (ret)
665228
             goto cleanup;
665228
         ret = kcmreq_get_name(&req, &name);