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

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