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

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