Blame SOURCES/0040-ad-set-enabled-false-attribute-for-subdomains-that-n.patch

8d3578
From 800d24dccbf655b2c65521727256c4e6c4a540d5 Mon Sep 17 00:00:00 2001
8d3578
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
8d3578
Date: Thu, 30 May 2019 12:51:47 +0200
8d3578
Subject: [PATCH 40/44] ad: set enabled=false attribute for subdomains that no
8d3578
 longer exists
8d3578
8d3578
Only forest root domain needs to be disabled because it has to be available
8d3578
for other tasks. All other non-root domains are removed from cache completely
8d3578
so it does not make sense for them.
8d3578
8d3578
Resolves:
8d3578
https://pagure.io/SSSD/sssd/issue/4009
8d3578
8d3578
Reviewed-by: Sumit Bose <sbose@redhat.com>
8d3578
(cherry picked from commit 6882bc5f5c8805abff3511d55c0ed60cad84faab)
8d3578
---
8d3578
 src/providers/ad/ad_subdomains.c | 13 +++++++++++++
8d3578
 1 file changed, 13 insertions(+)
8d3578
8d3578
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
8d3578
index a3906e994..57438fdd5 100644
8d3578
--- a/src/providers/ad/ad_subdomains.c
8d3578
+++ b/src/providers/ad/ad_subdomains.c
8d3578
@@ -696,6 +696,13 @@ static errno_t ad_subdomains_refresh(struct be_ctx *be_ctx,
8d3578
             if (sss_domain_is_forest_root(dom)) {
8d3578
                 DEBUG(SSSDBG_TRACE_ALL,
8d3578
                       "Skipping removal of forest root sdap data.\n");
8d3578
+
8d3578
+                ret = sysdb_domain_set_enabled(dom->sysdb, dom->name, false);
8d3578
+                if (ret != EOK && ret != ENOENT) {
8d3578
+                    DEBUG(SSSDBG_OP_FAILURE, "Unable to disable domain %s "
8d3578
+                          "[%d]: %s\n", dom->name, ret, sss_strerror(ret));
8d3578
+                    goto done;
8d3578
+                }
8d3578
                 continue;
8d3578
             }
8d3578
 
8d3578
@@ -864,6 +871,12 @@ static errno_t ad_subdomains_process(TALLOC_CTX *mem_ctx,
8d3578
         } else {
8d3578
             DEBUG(SSSDBG_TRACE_FUNC, "Disabling forest root domain %s\n",
8d3578
                                      root_name);
8d3578
+            ret = sysdb_domain_set_enabled(domain->sysdb, root_name, false);
8d3578
+            if (ret != EOK && ret != ENOENT) {
8d3578
+                DEBUG(SSSDBG_OP_FAILURE, "Unable to disable domain %s "
8d3578
+                      "[%d]: %s\n", root_name, ret, sss_strerror(ret));
8d3578
+                goto fail;
8d3578
+            }
8d3578
         }
8d3578
     }
8d3578
 
8d3578
-- 
8d3578
2.20.1
8d3578