Blame SOURCES/0002-KCM-Fall-back-to-using-the-first-ccache-if-the-defau.patch

841ac7
From 6c568c9126e950d56cee734934e455eb2f5a3659 Mon Sep 17 00:00:00 2001
841ac7
From: Jakub Hrozek <jhrozek@redhat.com>
841ac7
Date: Fri, 28 Sep 2018 17:29:10 +0200
841ac7
Subject: [PATCH] KCM: Fall back to using the first ccache if the default does
841ac7
 not exist
841ac7
MIME-Version: 1.0
841ac7
Content-Type: text/plain; charset=UTF-8
841ac7
Content-Transfer-Encoding: 8bit
841ac7
841ac7
Resolves:
841ac7
https://pagure.io/SSSD/sssd/issue/3838
841ac7
841ac7
KCM stores the default ccache in a separate DB entry. If the DB entry
841ac7
contains a UUID that cannot be found in the DB for whatever reason, we
841ac7
should just use the first ccache as the default. (This is what we
841ac7
already do if there is no default)
841ac7
841ac7
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
841ac7
(cherry picked from commit 6bf5bcad6b9c5fb5fd867cbb094fef2a02ebf22d)
841ac7
---
841ac7
 src/responder/kcm/kcmsrv_ops.c | 12 +++++++++++-
841ac7
 1 file changed, 11 insertions(+), 1 deletion(-)
841ac7
841ac7
diff --git a/src/responder/kcm/kcmsrv_ops.c b/src/responder/kcm/kcmsrv_ops.c
841ac7
index 1e229adc4..5c4ece79e 100644
841ac7
--- a/src/responder/kcm/kcmsrv_ops.c
841ac7
+++ b/src/responder/kcm/kcmsrv_ops.c
841ac7
@@ -1509,7 +1509,17 @@ static void kcm_op_get_default_ccache_byuuid_done(struct tevent_req *subreq)
841ac7
         DEBUG(SSSDBG_OP_FAILURE,
841ac7
               "Cannot get ccahe by UUID [%d]: %s\n",
841ac7
               ret, sss_strerror(ret));
841ac7
-        tevent_req_error(req, ret);
841ac7
+        /* Instead of failing the whole operation, return the first
841ac7
+         * ccache as a fallback
841ac7
+         */
841ac7
+        subreq = kcm_ccdb_list_send(state, state->ev,
841ac7
+                                    state->op_ctx->kcm_data->db,
841ac7
+                                    state->op_ctx->client);
841ac7
+        if (subreq == NULL) {
841ac7
+            tevent_req_error(req, ENOMEM);
841ac7
+            return;
841ac7
+        }
841ac7
+        tevent_req_set_callback(subreq, kcm_op_get_default_ccache_list_done, req);
841ac7
         return;
841ac7
     }
841ac7
 
841ac7
-- 
841ac7
2.19.1
841ac7