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

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