Blame SOURCES/0105-AD_PROVIDER-ad_enabled_domains-only-master.patch

b2d430
From a0009ecf7cfaaa14eb5b041b9e1d8247d18c61cb Mon Sep 17 00:00:00 2001
b2d430
From: Petr Cech <pcech@redhat.com>
b2d430
Date: Tue, 21 Jun 2016 09:48:52 +0200
b2d430
Subject: [PATCH 105/108] AD_PROVIDER: ad_enabled_domains - only master
b2d430
MIME-Version: 1.0
b2d430
Content-Type: text/plain; charset=UTF-8
b2d430
Content-Transfer-Encoding: 8bit
b2d430
b2d430
We can skip looking up other domains if option ad_enabled_domains
b2d430
contains only master domain.
b2d430
b2d430
Resolves:
b2d430
https://fedorahosted.org/sssd/ticket/2828
b2d430
b2d430
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
b2d430
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
b2d430
---
b2d430
 src/providers/ad/ad_subdomains.c | 16 ++++++++++++++++
b2d430
 1 file changed, 16 insertions(+)
b2d430
b2d430
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
b2d430
index 6e44760330275f7e4262e6863f180747f659edb5..5fdfc63886457db02ea4edc430341b31c3e545ce 100644
b2d430
--- a/src/providers/ad/ad_subdomains.c
b2d430
+++ b/src/providers/ad/ad_subdomains.c
b2d430
@@ -1170,6 +1170,7 @@ static void ad_subdomains_refresh_connect_done(struct tevent_req *subreq)
b2d430
         return;
b2d430
     }
b2d430
 
b2d430
+    /* connect to the DC we are a member of */
b2d430
     subreq = ad_master_domain_send(state, state->ev, state->id_ctx->conn,
b2d430
                                    state->sdap_op, state->sd_ctx->domain_name);
b2d430
     if (subreq == NULL) {
b2d430
@@ -1218,6 +1219,21 @@ static void ad_subdomains_refresh_master_done(struct tevent_req *subreq)
b2d430
         goto done;
b2d430
     }
b2d430
 
b2d430
+    /*
b2d430
+     * If ad_enabled_domains contains only master domain
b2d430
+     * we shouldn't lookup other domains.
b2d430
+     */
b2d430
+    if (state->sd_ctx->ad_enabled_domains != NULL) {
b2d430
+        if (talloc_array_length(state->sd_ctx->ad_enabled_domains) == 2) {
b2d430
+            if (strcasecmp(state->sd_ctx->ad_enabled_domains[0],
b2d430
+                           state->be_ctx->domain->name) == 0) {
b2d430
+                DEBUG(SSSDBG_TRACE_FUNC,
b2d430
+                      "No other enabled domain than master.\n");
b2d430
+                goto done;
b2d430
+            }
b2d430
+        }
b2d430
+    }
b2d430
+
b2d430
     subreq = ad_get_root_domain_send(state, state->ev, forest,
b2d430
                                      sdap_id_op_handle(state->sdap_op),
b2d430
                                      state->sd_ctx);
b2d430
-- 
b2d430
2.4.11
b2d430