Blame SOURCES/0078-ad-require-name-when-looking-up-root-domain.patch

5a92ae
From 4b59b0af3d97b2a6b0acc08fa80377a5f59e5bfe Mon Sep 17 00:00:00 2001
5a92ae
From: Sumit Bose <sbose@redhat.com>
5a92ae
Date: Fri, 8 Oct 2021 12:44:37 +0200
5a92ae
Subject: [PATCH 78/83] ad: require name when looking up root domain
5a92ae
MIME-Version: 1.0
5a92ae
Content-Type: text/plain; charset=UTF-8
5a92ae
Content-Transfer-Encoding: 8bit
5a92ae
5a92ae
To properly identify the forest root domain the name of this domain is
5a92ae
needed. It is discovered with a cldap-ping requesting the netlogon
5a92ae
attribute. If the name is missing it does not make sense to proceed
5a92ae
further because there is currently no other way to determine the forest
5a92ae
root domain.
5a92ae
5a92ae
Resolves: https://github.com/SSSD/sssd/issues/5820
5a92ae
5a92ae
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
5a92ae
(cherry picked from commit b37e2713a9b86936f5b82a17e47757562900b911)
5a92ae
5a92ae
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
5a92ae
---
5a92ae
 src/providers/ad/ad_subdomains.c | 7 ++++++-
5a92ae
 1 file changed, 6 insertions(+), 1 deletion(-)
5a92ae
5a92ae
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
5a92ae
index 6b98cdf1d..5be7c2003 100644
5a92ae
--- a/src/providers/ad/ad_subdomains.c
5a92ae
+++ b/src/providers/ad/ad_subdomains.c
5a92ae
@@ -1431,7 +1431,12 @@ ad_get_root_domain_send(TALLOC_CTX *mem_ctx,
5a92ae
         return NULL;
5a92ae
     }
5a92ae
 
5a92ae
-    if (forest != NULL && strcasecmp(domain, forest) == 0) {
5a92ae
+    if (forest == NULL) {
5a92ae
+        DEBUG(SSSDBG_OP_FAILURE, "Name of forest root domain not available, l"
5a92ae
+                                 "using cached data, if available.\n");
5a92ae
+        ret = EINVAL;
5a92ae
+        goto immediately;
5a92ae
+    } else if (strcasecmp(domain, forest) == 0) {
5a92ae
         state->root_id_ctx = sd_ctx->ad_id_ctx;
5a92ae
         state->root_domain_attrs = NULL;
5a92ae
         ret = EOK;
5a92ae
-- 
5a92ae
2.26.3
5a92ae