dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0068-AD-Enumerate-users-from-GC-other-entities-from-LDAP.patch

2fc102
From 1a077f0af935497b972a763a7027924a65476b01 Mon Sep 17 00:00:00 2001
2fc102
From: Jakub Hrozek <jhrozek@redhat.com>
2fc102
Date: Tue, 28 Jan 2014 13:59:44 +0100
2fc102
Subject: [PATCH 68/71] AD: Enumerate users from GC, other entities from LDAP
2fc102
2fc102
---
2fc102
 src/providers/ad/ad_id.c | 20 +++++++++++++++++---
2fc102
 1 file changed, 17 insertions(+), 3 deletions(-)
2fc102
2fc102
diff --git a/src/providers/ad/ad_id.c b/src/providers/ad/ad_id.c
2fc102
index 99383c13bdadfe9eb2af9f9323ca19a9759d4620..a47aa4f75ab348b0f4597fea264d770b5abe3184 100644
2fc102
--- a/src/providers/ad/ad_id.c
2fc102
+++ b/src/providers/ad/ad_id.c
2fc102
@@ -526,6 +526,7 @@ ad_enumeration_master_done(struct tevent_req *subreq)
2fc102
     char *flat_name;
2fc102
     char *master_sid;
2fc102
     char *forest;
2fc102
+    struct sdap_id_conn_ctx *user_conn;
2fc102
 
2fc102
     ret = ad_master_domain_recv(subreq, state,
2fc102
                                 &flat_name, &master_sid, &forest);
2fc102
@@ -544,8 +545,21 @@ ad_enumeration_master_done(struct tevent_req *subreq)
2fc102
         return;
2fc102
     }
2fc102
 
2fc102
-    subreq = sdap_dom_enum_send(state, state->ev, state->id_ctx->sdap_id_ctx,
2fc102
-                                state->sdom, state->id_ctx->ldap_ctx);
2fc102
+    if (dp_opt_get_bool(state->id_ctx->ad_options->basic, AD_ENABLE_GC)) {
2fc102
+        user_conn = state->id_ctx->gc_ctx;
2fc102
+    } else {
2fc102
+        user_conn = state->id_ctx->ldap_ctx;
2fc102
+    }
2fc102
+
2fc102
+    /* Groups are searched for in LDAP, users in GC. Services (if present,
2fc102
+     * which is unlikely in AD) from LDAP as well
2fc102
+     */
2fc102
+    subreq = sdap_dom_enum_ex_send(state, state->ev,
2fc102
+                                   state->id_ctx->sdap_id_ctx,
2fc102
+                                   state->sdom,
2fc102
+                                   user_conn,                /* Users    */
2fc102
+                                   state->id_ctx->ldap_ctx,  /* Groups   */
2fc102
+                                   state->id_ctx->ldap_ctx); /* Services */
2fc102
     if (subreq == NULL) {
2fc102
         /* The ptask API will reschedule the enumeration on its own on
2fc102
          * failure */
2fc102
@@ -566,7 +580,7 @@ ad_enumeration_done(struct tevent_req *subreq)
2fc102
     struct ad_enumeration_state *state = tevent_req_data(req,
2fc102
                                                 struct ad_enumeration_state);
2fc102
 
2fc102
-    ret = sdap_dom_enum_recv(subreq);
2fc102
+    ret = sdap_dom_enum_ex_recv(subreq);
2fc102
     talloc_zfree(subreq);
2fc102
     if (ret != EOK) {
2fc102
         DEBUG(SSSDBG_OP_FAILURE,
2fc102
-- 
2fc102
1.8.4.2
2fc102