Blob Blame History Raw
From 9812095cc83c7258584235528d355c301c492b92 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Tue, 12 Jul 2016 17:09:00 +0200
Subject: [PATCH 45/62] IPA: make ipa_resolve_user_list_{send|recv} public and
 allow AD users

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
(cherry picked from commit f2e8a7c3230fac11175c0bd17c14c66a8e9b25ad)
---
 src/providers/ipa/ipa_id.c | 20 ++++++++++++++++----
 src/providers/ipa/ipa_id.h |  8 ++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/providers/ipa/ipa_id.c b/src/providers/ipa/ipa_id.c
index e092cd2f80d3c102f88a9bc48a352e1a140b14e8..7cc79f92b5dcd481706353d403125c46d587e7f6 100644
--- a/src/providers/ipa/ipa_id.c
+++ b/src/providers/ipa/ipa_id.c
@@ -71,7 +71,7 @@ struct ipa_resolve_user_list_state {
 static errno_t ipa_resolve_user_list_get_user_step(struct tevent_req *req);
 static void ipa_resolve_user_list_get_user_done(struct tevent_req *subreq);
 
-static struct tevent_req *
+struct tevent_req *
 ipa_resolve_user_list_send(TALLOC_CTX *memctx, struct tevent_context *ev,
                            struct ipa_id_ctx *ipa_ctx,
                            const char *domain_name,
@@ -132,7 +132,14 @@ static errno_t ipa_resolve_user_list_get_user_step(struct tevent_req *req)
 
     DEBUG(SSSDBG_TRACE_ALL, "Trying to resolve user [%s].\n", ar->filter_value);
 
-    subreq = ipa_id_get_account_info_send(state, state->ev, state->ipa_ctx, ar);
+    if (strcasecmp(state->domain_name,
+                   state->ipa_ctx->sdap_id_ctx->be->domain->name) != 0) {
+        subreq = ipa_subdomain_account_send(state, state->ev, state->ipa_ctx,
+                                            ar);
+    } else {
+        subreq = ipa_id_get_account_info_send(state, state->ev, state->ipa_ctx,
+                                              ar);
+    }
     if (subreq == NULL) {
         DEBUG(SSSDBG_OP_FAILURE, "sdap_handle_acct_req_send failed.\n");
         return ENOMEM;
@@ -151,7 +158,12 @@ static void ipa_resolve_user_list_get_user_done(struct tevent_req *subreq)
                                             struct ipa_resolve_user_list_state);
     int ret;
 
-    ret = ipa_id_get_account_info_recv(subreq, &state->dp_error);
+    if (strcasecmp(state->domain_name,
+                   state->ipa_ctx->sdap_id_ctx->be->domain->name) != 0) {
+        ret = ipa_subdomain_account_recv(subreq, &state->dp_error);
+    } else {
+        ret = ipa_id_get_account_info_recv(subreq, &state->dp_error);
+    }
     talloc_zfree(subreq);
     if (ret != EOK) {
         DEBUG(SSSDBG_OP_FAILURE, "sdap_handle_acct request failed: %d\n", ret);
@@ -182,7 +194,7 @@ done:
     return;
 }
 
-static int ipa_resolve_user_list_recv(struct tevent_req *req, int *dp_error)
+int ipa_resolve_user_list_recv(struct tevent_req *req, int *dp_error)
 {
     struct ipa_resolve_user_list_state *state = tevent_req_data(req,
                                             struct ipa_resolve_user_list_state);
diff --git a/src/providers/ipa/ipa_id.h b/src/providers/ipa/ipa_id.h
index 17db5226a29a54485f7b26eb9853ef2380426bdf..485fa3f8e6af48ddcf1178c3486456753035c948 100644
--- a/src/providers/ipa/ipa_id.h
+++ b/src/providers/ipa/ipa_id.h
@@ -135,4 +135,12 @@ struct tevent_req *ipa_get_subdom_acct_process_pac_send(TALLOC_CTX *mem_ctx,
                                                    struct ldb_message *user_msg);
 
 errno_t ipa_get_subdom_acct_process_pac_recv(struct tevent_req *req);
+
+struct tevent_req *
+ipa_resolve_user_list_send(TALLOC_CTX *memctx, struct tevent_context *ev,
+                           struct ipa_id_ctx *ipa_ctx,
+                           const char *domain_name,
+                           struct ldb_message_element *users);
+int ipa_resolve_user_list_recv(struct tevent_req *req, int *dp_error);
+
 #endif
-- 
2.4.11