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