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

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