From 55e27a423d4065aa419e1bd80db1826eb8264c4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20L=C3=B3pez?= <allopez@redhat.com>
Date: Mon, 20 Mar 2023 15:24:03 +0100
Subject: [PATCH] KCM: Switch default caches only when there is no current
 default.

Only when there was a current default cache
(uuid_is_null(old_dfl_uuid) == false), the default cache was switched.
This condition should be negated so that the cache is switched when
there is no current default.

Resolves: https://github.com/SSSD/sssd/issues/6357

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>

Reference:https://github.com/SSSD/sssd/commit/55e27a423d4065aa419e1bd80db1826eb8264c4a
Conflict:NA

---
 src/responder/kcm/kcmsrv_ops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/responder/kcm/kcmsrv_ops.c b/src/responder/kcm/kcmsrv_ops.c
index f7f80d850..33d7cd506 100644
--- a/src/responder/kcm/kcmsrv_ops.c
+++ b/src/responder/kcm/kcmsrv_ops.c
@@ -668,8 +668,8 @@ static void kcm_op_initialize_got_default(struct tevent_req *subreq)
         return;
     }
 
-    if (uuid_is_null(old_dfl_uuid) == false) {
-        /* If there was a previous default ccache, switch to the initialized
+    if (uuid_is_null(old_dfl_uuid)) {
+        /* If there was no previous default ccache, switch to the initialized
          * one by default
          */
         /* `dfl_uuid` is output arg and isn't read in kcm_cc_get_uuid() but
-- 
2.33.0

