Blame SOURCES/0080-ad-use-already-discovered-forest-name.patch

5a92ae
From f60a6fc682646a8c16fa8875456300c61cf3e979 Mon Sep 17 00:00:00 2001
5a92ae
From: Sumit Bose <sbose@redhat.com>
5a92ae
Date: Fri, 8 Oct 2021 13:49:01 +0200
5a92ae
Subject: [PATCH 80/83] ad: use already discovered forest name
5a92ae
MIME-Version: 1.0
5a92ae
Content-Type: text/plain; charset=UTF-8
5a92ae
Content-Transfer-Encoding: 8bit
5a92ae
5a92ae
If the cldap-ping on the current connection does not return a reply with
5a92ae
the name of the forest root and the site of the client the stored values
5a92ae
from the DNS discovery step are used.
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 99c4161910e542dd40c740032196d268c4163d07)
5a92ae
5a92ae
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
5a92ae
---
5a92ae
 src/providers/ad/ad_subdomains.c | 17 +++++++++++++++++
5a92ae
 1 file changed, 17 insertions(+)
5a92ae
5a92ae
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
5a92ae
index 8a331c503..562047a02 100644
5a92ae
--- a/src/providers/ad/ad_subdomains.c
5a92ae
+++ b/src/providers/ad/ad_subdomains.c
5a92ae
@@ -2095,6 +2095,23 @@ static void ad_subdomains_refresh_master_done(struct tevent_req *subreq)
5a92ae
         return;
5a92ae
     }
5a92ae
 
5a92ae
+    if (state->forest == NULL) {
5a92ae
+        DEBUG(SSSDBG_MINOR_FAILURE, "Forest name was not found, using the one "
5a92ae
+                                    "which was already discovered [%s].\n",
5a92ae
+                                    state->ad_options->current_forest != NULL ?
5a92ae
+                                        state->ad_options->current_forest :
5a92ae
+                                        "- not available-");
5a92ae
+        if (state->ad_options->current_forest != NULL) {
5a92ae
+            state->forest = talloc_strdup(state,
5a92ae
+                                          state->ad_options->current_forest);
5a92ae
+            if (state->forest == NULL) {
5a92ae
+                DEBUG(SSSDBG_OP_FAILURE, "Failed to copy forest name.\n");
5a92ae
+                tevent_req_error(req, ENOMEM);
5a92ae
+                return;
5a92ae
+            }
5a92ae
+        }
5a92ae
+    }
5a92ae
+
5a92ae
     realm = dp_opt_get_cstring(state->ad_options->basic, AD_KRB5_REALM);
5a92ae
     if (realm == NULL) {
5a92ae
         DEBUG(SSSDBG_CONF_SETTINGS, "Missing realm.\n");
5a92ae
-- 
5a92ae
2.26.3
5a92ae