|
|
2fc102 |
From 431198674303beea2a6a25af6d3fa4e852995b26 Mon Sep 17 00:00:00 2001
|
|
|
2fc102 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
2fc102 |
Date: Mon, 16 Dec 2013 02:41:53 +0100
|
|
|
2fc102 |
Subject: [PATCH 67/71] LDAP: Add enum request with custom connection
|
|
|
2fc102 |
|
|
|
2fc102 |
This commit changes the enumerate-sdap-domain request to accept a
|
|
|
2fc102 |
connection context per object that can be enumerated. Internally in the
|
|
|
2fc102 |
request, an sdap_id_op is also created per enumerated object type.
|
|
|
2fc102 |
|
|
|
2fc102 |
This change will allow i.e. users to be enumerated using GC connection,
|
|
|
2fc102 |
while keeping the LDAP connection for groups and services.
|
|
|
2fc102 |
---
|
|
|
2fc102 |
src/providers/ldap/sdap_async_enum.c | 309 +++++++++++++++++++++--------------
|
|
|
2fc102 |
src/providers/ldap/sdap_async_enum.h | 11 ++
|
|
|
2fc102 |
2 files changed, 193 insertions(+), 127 deletions(-)
|
|
|
2fc102 |
|
|
|
2fc102 |
diff --git a/src/providers/ldap/sdap_async_enum.c b/src/providers/ldap/sdap_async_enum.c
|
|
|
2fc102 |
index 8487f9a13b279bc71f633590bbab163945fc8f7c..cbc56be20526e6c2323f9fd1b49038dd4bf13fe5 100644
|
|
|
2fc102 |
--- a/src/providers/ldap/sdap_async_enum.c
|
|
|
2fc102 |
+++ b/src/providers/ldap/sdap_async_enum.c
|
|
|
2fc102 |
@@ -47,49 +47,56 @@ static struct tevent_req *enum_groups_send(TALLOC_CTX *memctx,
|
|
|
2fc102 |
bool purge);
|
|
|
2fc102 |
static errno_t enum_groups_recv(struct tevent_req *req);
|
|
|
2fc102 |
|
|
|
2fc102 |
-/* ==Enumeration-Request==================================================== */
|
|
|
2fc102 |
-struct sdap_dom_enum_state {
|
|
|
2fc102 |
+/* ==Enumeration-Request-with-connections=================================== */
|
|
|
2fc102 |
+struct sdap_dom_enum_ex_state {
|
|
|
2fc102 |
struct tevent_context *ev;
|
|
|
2fc102 |
struct sdap_id_ctx *ctx;
|
|
|
2fc102 |
struct sdap_domain *sdom;
|
|
|
2fc102 |
- struct sdap_id_conn_ctx *conn;
|
|
|
2fc102 |
- struct sdap_id_op *op;
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *user_conn;
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *group_conn;
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *svc_conn;
|
|
|
2fc102 |
+ struct sdap_id_op *user_op;
|
|
|
2fc102 |
+ struct sdap_id_op *group_op;
|
|
|
2fc102 |
+ struct sdap_id_op *svc_op;
|
|
|
2fc102 |
|
|
|
2fc102 |
bool purge;
|
|
|
2fc102 |
};
|
|
|
2fc102 |
|
|
|
2fc102 |
-static errno_t sdap_dom_enum_retry(struct tevent_req *req);
|
|
|
2fc102 |
-static void sdap_dom_enum_conn_done(struct tevent_req *subreq);
|
|
|
2fc102 |
-static void sdap_dom_enum_users_done(struct tevent_req *subreq);
|
|
|
2fc102 |
-static void sdap_dom_enum_groups_done(struct tevent_req *subreq);
|
|
|
2fc102 |
-static void sdap_dom_enum_services_done(struct tevent_req *subreq);
|
|
|
2fc102 |
+static errno_t sdap_dom_enum_ex_retry(struct tevent_req *req,
|
|
|
2fc102 |
+ struct sdap_id_op *op,
|
|
|
2fc102 |
+ tevent_req_fn tcb);
|
|
|
2fc102 |
+static bool sdap_dom_enum_ex_connected(struct tevent_req *subreq);
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_get_users(struct tevent_req *subreq);
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_users_done(struct tevent_req *subreq);
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_get_groups(struct tevent_req *subreq);
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_groups_done(struct tevent_req *subreq);
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_get_svcs(struct tevent_req *subreq);
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_svcs_done(struct tevent_req *subreq);
|
|
|
2fc102 |
|
|
|
2fc102 |
struct tevent_req *
|
|
|
2fc102 |
-sdap_dom_enum_send(TALLOC_CTX *memctx,
|
|
|
2fc102 |
- struct tevent_context *ev,
|
|
|
2fc102 |
- struct sdap_id_ctx *ctx,
|
|
|
2fc102 |
- struct sdap_domain *sdom,
|
|
|
2fc102 |
- struct sdap_id_conn_ctx *conn)
|
|
|
2fc102 |
+sdap_dom_enum_ex_send(TALLOC_CTX *memctx,
|
|
|
2fc102 |
+ struct tevent_context *ev,
|
|
|
2fc102 |
+ struct sdap_id_ctx *ctx,
|
|
|
2fc102 |
+ struct sdap_domain *sdom,
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *user_conn,
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *group_conn,
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *svc_conn)
|
|
|
2fc102 |
{
|
|
|
2fc102 |
struct tevent_req *req;
|
|
|
2fc102 |
- struct sdap_dom_enum_state *state;
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state *state;
|
|
|
2fc102 |
int t;
|
|
|
2fc102 |
errno_t ret;
|
|
|
2fc102 |
|
|
|
2fc102 |
- req = tevent_req_create(ctx, &state, struct sdap_dom_enum_state);
|
|
|
2fc102 |
- if (!req) return NULL;
|
|
|
2fc102 |
+ req = tevent_req_create(ctx, &state, struct sdap_dom_enum_ex_state);
|
|
|
2fc102 |
+ if (req == NULL) return NULL;
|
|
|
2fc102 |
|
|
|
2fc102 |
state->ev = ev;
|
|
|
2fc102 |
state->ctx = ctx;
|
|
|
2fc102 |
state->sdom = sdom;
|
|
|
2fc102 |
- state->conn = conn;
|
|
|
2fc102 |
- state->op = sdap_id_op_create(state, state->ctx->conn->conn_cache);
|
|
|
2fc102 |
- if (!state->op) {
|
|
|
2fc102 |
- DEBUG(SSSDBG_CRIT_FAILURE, ("sdap_id_op_create failed\n"));
|
|
|
2fc102 |
- ret = EIO;
|
|
|
2fc102 |
- goto fail;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
+ state->user_conn = user_conn;
|
|
|
2fc102 |
+ state->group_conn = group_conn;
|
|
|
2fc102 |
+ state->svc_conn = svc_conn;
|
|
|
2fc102 |
sdom->last_enum = tevent_timeval_current();
|
|
|
2fc102 |
|
|
|
2fc102 |
t = dp_opt_get_int(ctx->opts->basic, SDAP_CACHE_PURGE_TIMEOUT);
|
|
|
2fc102 |
@@ -97,9 +104,17 @@ sdap_dom_enum_send(TALLOC_CTX *memctx,
|
|
|
2fc102 |
state->purge = true;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
- ret = sdap_dom_enum_retry(req);
|
|
|
2fc102 |
+ state->user_op = sdap_id_op_create(state, user_conn->conn_cache);
|
|
|
2fc102 |
+ if (state->user_op == NULL) {
|
|
|
2fc102 |
+ DEBUG(SSSDBG_CRIT_FAILURE, ("sdap_id_op_create failed for users\n"));
|
|
|
2fc102 |
+ ret = EIO;
|
|
|
2fc102 |
+ goto fail;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ ret = sdap_dom_enum_ex_retry(req, state->user_op,
|
|
|
2fc102 |
+ sdap_dom_enum_ex_get_users);
|
|
|
2fc102 |
if (ret != EOK) {
|
|
|
2fc102 |
- DEBUG(SSSDBG_OP_FAILURE, ("ldap_id_enumerate_retry failed\n"));
|
|
|
2fc102 |
+ DEBUG(SSSDBG_OP_FAILURE, ("sdap_dom_enum_ex_retry failed\n"));
|
|
|
2fc102 |
goto fail;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
@@ -111,31 +126,32 @@ fail:
|
|
|
2fc102 |
return req;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
-static errno_t sdap_dom_enum_retry(struct tevent_req *req)
|
|
|
2fc102 |
+static errno_t sdap_dom_enum_ex_retry(struct tevent_req *req,
|
|
|
2fc102 |
+ struct sdap_id_op *op,
|
|
|
2fc102 |
+ tevent_req_fn tcb)
|
|
|
2fc102 |
{
|
|
|
2fc102 |
- struct sdap_dom_enum_state *state = tevent_req_data(req,
|
|
|
2fc102 |
- struct sdap_dom_enum_state);
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state *state = tevent_req_data(req,
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state);
|
|
|
2fc102 |
struct tevent_req *subreq;
|
|
|
2fc102 |
errno_t ret;
|
|
|
2fc102 |
|
|
|
2fc102 |
- subreq = sdap_id_op_connect_send(state->op, state, &ret;;
|
|
|
2fc102 |
+ subreq = sdap_id_op_connect_send(op, state, &ret;;
|
|
|
2fc102 |
if (subreq == NULL) {
|
|
|
2fc102 |
DEBUG(SSSDBG_OP_FAILURE,
|
|
|
2fc102 |
("sdap_id_op_connect_send failed: %d\n", ret));
|
|
|
2fc102 |
return ret;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
- tevent_req_set_callback(subreq, sdap_dom_enum_conn_done, req);
|
|
|
2fc102 |
+ tevent_req_set_callback(subreq, tcb, req);
|
|
|
2fc102 |
return EOK;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
-static void sdap_dom_enum_conn_done(struct tevent_req *subreq)
|
|
|
2fc102 |
+static bool sdap_dom_enum_ex_connected(struct tevent_req *subreq)
|
|
|
2fc102 |
{
|
|
|
2fc102 |
+ errno_t ret;
|
|
|
2fc102 |
+ int dp_error;
|
|
|
2fc102 |
struct tevent_req *req = tevent_req_callback_data(subreq,
|
|
|
2fc102 |
struct tevent_req);
|
|
|
2fc102 |
- struct sdap_dom_enum_state *state = tevent_req_data(req,
|
|
|
2fc102 |
- struct sdap_dom_enum_state);
|
|
|
2fc102 |
- int ret, dp_error;
|
|
|
2fc102 |
|
|
|
2fc102 |
ret = sdap_id_op_connect_recv(subreq, &dp_error);
|
|
|
2fc102 |
talloc_zfree(subreq);
|
|
|
2fc102 |
@@ -150,150 +166,173 @@ static void sdap_dom_enum_conn_done(struct tevent_req *subreq)
|
|
|
2fc102 |
"LDAP server: (%d)[%s]\n", ret, strerror(ret)));
|
|
|
2fc102 |
tevent_req_error(req, ret);
|
|
|
2fc102 |
}
|
|
|
2fc102 |
+ return false;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ return true;
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_get_users(struct tevent_req *subreq)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ struct tevent_req *req = tevent_req_callback_data(subreq,
|
|
|
2fc102 |
+ struct tevent_req);
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state *state = tevent_req_data(req,
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ if (sdap_dom_enum_ex_connected(subreq) == false) {
|
|
|
2fc102 |
return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
subreq = enum_users_send(state, state->ev,
|
|
|
2fc102 |
state->ctx, state->sdom,
|
|
|
2fc102 |
- state->op, state->purge);
|
|
|
2fc102 |
+ state->user_op, state->purge);
|
|
|
2fc102 |
if (subreq == NULL) {
|
|
|
2fc102 |
tevent_req_error(req, ENOMEM);
|
|
|
2fc102 |
return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
- tevent_req_set_callback(subreq, sdap_dom_enum_users_done, req);
|
|
|
2fc102 |
+ tevent_req_set_callback(subreq, sdap_dom_enum_ex_users_done, req);
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
-static void sdap_dom_enum_users_done(struct tevent_req *subreq)
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_users_done(struct tevent_req *subreq)
|
|
|
2fc102 |
{
|
|
|
2fc102 |
struct tevent_req *req = tevent_req_callback_data(subreq,
|
|
|
2fc102 |
struct tevent_req);
|
|
|
2fc102 |
- struct sdap_dom_enum_state *state = tevent_req_data(req,
|
|
|
2fc102 |
- struct sdap_dom_enum_state);
|
|
|
2fc102 |
- uint64_t err = 0;
|
|
|
2fc102 |
- int ret, dp_error = DP_ERR_FATAL;
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state *state = tevent_req_data(req,
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state);
|
|
|
2fc102 |
+ errno_t ret;
|
|
|
2fc102 |
+ int dp_error;
|
|
|
2fc102 |
|
|
|
2fc102 |
- err = enum_users_recv(subreq);
|
|
|
2fc102 |
+ ret = enum_users_recv(subreq);
|
|
|
2fc102 |
talloc_zfree(subreq);
|
|
|
2fc102 |
- if (err != EOK && err != ENOENT) {
|
|
|
2fc102 |
- /* We call sdap_id_op_done only on error
|
|
|
2fc102 |
- * as the connection is reused by groups enumeration */
|
|
|
2fc102 |
- ret = sdap_id_op_done(state->op, (int)err, &dp_error);
|
|
|
2fc102 |
- if (dp_error == DP_ERR_OK) {
|
|
|
2fc102 |
- /* retry */
|
|
|
2fc102 |
- ret = sdap_dom_enum_retry(req);
|
|
|
2fc102 |
- if (ret == EOK) {
|
|
|
2fc102 |
- return;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- dp_error = DP_ERR_FATAL;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- if (dp_error == DP_ERR_OFFLINE) {
|
|
|
2fc102 |
- tevent_req_done(req);
|
|
|
2fc102 |
- } else {
|
|
|
2fc102 |
- DEBUG(SSSDBG_OP_FAILURE,
|
|
|
2fc102 |
- ("User enumeration failed with: (%d)[%s]\n",
|
|
|
2fc102 |
- ret, strerror(ret)));
|
|
|
2fc102 |
+ ret = sdap_id_op_done(state->user_op, ret, &dp_error);
|
|
|
2fc102 |
+ if (dp_error == DP_ERR_OK && ret != EOK) {
|
|
|
2fc102 |
+ /* retry */
|
|
|
2fc102 |
+ ret = sdap_dom_enum_ex_retry(req, state->user_op,
|
|
|
2fc102 |
+ sdap_dom_enum_ex_get_users);
|
|
|
2fc102 |
+ if (ret != EOK) {
|
|
|
2fc102 |
tevent_req_error(req, ret);
|
|
|
2fc102 |
+ return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
+ state->group_op = sdap_id_op_create(state, state->group_conn->conn_cache);
|
|
|
2fc102 |
+ if (state->group_op == NULL) {
|
|
|
2fc102 |
+ DEBUG(SSSDBG_CRIT_FAILURE, ("sdap_id_op_create failed for groups\n"));
|
|
|
2fc102 |
+ tevent_req_error(req, EIO);
|
|
|
2fc102 |
+ return;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ ret = sdap_dom_enum_ex_retry(req, state->group_op,
|
|
|
2fc102 |
+ sdap_dom_enum_ex_get_groups);
|
|
|
2fc102 |
+ if (ret != EOK) {
|
|
|
2fc102 |
+ tevent_req_error(req, ret);
|
|
|
2fc102 |
+ return;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Continues to sdap_dom_enum_ex_get_groups */
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_get_groups(struct tevent_req *subreq)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ struct tevent_req *req = tevent_req_callback_data(subreq,
|
|
|
2fc102 |
+ struct tevent_req);
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state *state = tevent_req_data(req,
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ if (sdap_dom_enum_ex_connected(subreq) == false) {
|
|
|
2fc102 |
+ return;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
subreq = enum_groups_send(state, state->ev, state->ctx,
|
|
|
2fc102 |
state->sdom,
|
|
|
2fc102 |
- state->op, state->purge);
|
|
|
2fc102 |
+ state->group_op, state->purge);
|
|
|
2fc102 |
if (subreq == NULL) {
|
|
|
2fc102 |
tevent_req_error(req, ENOMEM);
|
|
|
2fc102 |
return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
- tevent_req_set_callback(subreq, sdap_dom_enum_groups_done, req);
|
|
|
2fc102 |
+ tevent_req_set_callback(subreq, sdap_dom_enum_ex_groups_done, req);
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
-static void sdap_dom_enum_groups_done(struct tevent_req *subreq)
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_groups_done(struct tevent_req *subreq)
|
|
|
2fc102 |
{
|
|
|
2fc102 |
struct tevent_req *req = tevent_req_callback_data(subreq,
|
|
|
2fc102 |
struct tevent_req);
|
|
|
2fc102 |
- struct sdap_dom_enum_state *state = tevent_req_data(req,
|
|
|
2fc102 |
- struct sdap_dom_enum_state);
|
|
|
2fc102 |
- uint64_t err = 0;
|
|
|
2fc102 |
- int ret, dp_error = DP_ERR_FATAL;
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state *state = tevent_req_data(req,
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state);
|
|
|
2fc102 |
+ int ret;
|
|
|
2fc102 |
+ int dp_error;
|
|
|
2fc102 |
|
|
|
2fc102 |
- err = enum_groups_recv(subreq);
|
|
|
2fc102 |
+ ret = enum_groups_recv(subreq);
|
|
|
2fc102 |
talloc_zfree(subreq);
|
|
|
2fc102 |
- if (err != EOK && err != ENOENT) {
|
|
|
2fc102 |
- /* We call sdap_id_op_done only on error
|
|
|
2fc102 |
- * as the connection is reused by services enumeration */
|
|
|
2fc102 |
- ret = sdap_id_op_done(state->op, (int)err, &dp_error);
|
|
|
2fc102 |
- if (dp_error == DP_ERR_OK && ret != EOK) {
|
|
|
2fc102 |
- /* retry */
|
|
|
2fc102 |
- ret = sdap_dom_enum_retry(req);
|
|
|
2fc102 |
- if (ret == EOK) {
|
|
|
2fc102 |
- return;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- dp_error = DP_ERR_FATAL;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
+ ret = sdap_id_op_done(state->group_op, ret, &dp_error);
|
|
|
2fc102 |
+ if (dp_error == DP_ERR_OK && ret != EOK) {
|
|
|
2fc102 |
+ /* retry */
|
|
|
2fc102 |
+ ret = sdap_dom_enum_ex_retry(req, state->group_op,
|
|
|
2fc102 |
+ sdap_dom_enum_ex_get_groups);
|
|
|
2fc102 |
if (ret != EOK) {
|
|
|
2fc102 |
- if (dp_error == DP_ERR_OFFLINE) {
|
|
|
2fc102 |
- tevent_req_done(req);
|
|
|
2fc102 |
- } else {
|
|
|
2fc102 |
- DEBUG(SSSDBG_OP_FAILURE,
|
|
|
2fc102 |
- ("Group enumeration failed with: (%d)[%s]\n",
|
|
|
2fc102 |
- ret, strerror(ret)));
|
|
|
2fc102 |
- tevent_req_error(req, ret);
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
+ tevent_req_error(req, ret);
|
|
|
2fc102 |
return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
+ return;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ state->svc_op = sdap_id_op_create(state, state->svc_conn->conn_cache);
|
|
|
2fc102 |
+ if (state->svc_op == NULL) {
|
|
|
2fc102 |
+ DEBUG(SSSDBG_CRIT_FAILURE, ("sdap_id_op_create failed for svcs\n"));
|
|
|
2fc102 |
+ tevent_req_error(req, EIO);
|
|
|
2fc102 |
+ return;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ ret = sdap_dom_enum_ex_retry(req, state->svc_op,
|
|
|
2fc102 |
+ sdap_dom_enum_ex_get_svcs);
|
|
|
2fc102 |
+ if (ret != EOK) {
|
|
|
2fc102 |
+ tevent_req_error(req, ret);
|
|
|
2fc102 |
+ return;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_get_svcs(struct tevent_req *subreq)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ struct tevent_req *req = tevent_req_callback_data(subreq,
|
|
|
2fc102 |
+ struct tevent_req);
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state *state = tevent_req_data(req,
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ if (sdap_dom_enum_ex_connected(subreq) == false) {
|
|
|
2fc102 |
+ return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
subreq = enum_services_send(state, state->ev, state->ctx,
|
|
|
2fc102 |
- state->op, state->purge);
|
|
|
2fc102 |
+ state->svc_op, state->purge);
|
|
|
2fc102 |
if (!subreq) {
|
|
|
2fc102 |
tevent_req_error(req, ENOMEM);
|
|
|
2fc102 |
return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
- tevent_req_set_callback(subreq, sdap_dom_enum_services_done, req);
|
|
|
2fc102 |
+ tevent_req_set_callback(subreq, sdap_dom_enum_ex_svcs_done, req);
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
-static void sdap_dom_enum_services_done(struct tevent_req *subreq)
|
|
|
2fc102 |
+static void sdap_dom_enum_ex_svcs_done(struct tevent_req *subreq)
|
|
|
2fc102 |
{
|
|
|
2fc102 |
- errno_t ret;
|
|
|
2fc102 |
- int dp_error = DP_ERR_FATAL;
|
|
|
2fc102 |
struct tevent_req *req = tevent_req_callback_data(subreq,
|
|
|
2fc102 |
struct tevent_req);
|
|
|
2fc102 |
- struct sdap_dom_enum_state *state = tevent_req_data(req,
|
|
|
2fc102 |
- struct sdap_dom_enum_state);
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state *state = tevent_req_data(req,
|
|
|
2fc102 |
+ struct sdap_dom_enum_ex_state);
|
|
|
2fc102 |
+ int ret;
|
|
|
2fc102 |
+ int dp_error;
|
|
|
2fc102 |
|
|
|
2fc102 |
ret = enum_services_recv(subreq);
|
|
|
2fc102 |
talloc_zfree(subreq);
|
|
|
2fc102 |
- if (ret == ENOENT) ret = EOK;
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- /* All enumerations are complete, so conclude the
|
|
|
2fc102 |
- * id_op
|
|
|
2fc102 |
- */
|
|
|
2fc102 |
- ret = sdap_id_op_done(state->op, ret, &dp_error);
|
|
|
2fc102 |
+ ret = sdap_id_op_done(state->svc_op, ret, &dp_error);
|
|
|
2fc102 |
if (dp_error == DP_ERR_OK && ret != EOK) {
|
|
|
2fc102 |
/* retry */
|
|
|
2fc102 |
- ret = sdap_dom_enum_retry(req);
|
|
|
2fc102 |
- if (ret == EOK) {
|
|
|
2fc102 |
- return;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- dp_error = DP_ERR_FATAL;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- if (ret != EOK) {
|
|
|
2fc102 |
- if (dp_error == DP_ERR_OFFLINE) {
|
|
|
2fc102 |
- tevent_req_done(req);
|
|
|
2fc102 |
- } else {
|
|
|
2fc102 |
- DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
2fc102 |
- ("Service enumeration failed with: (%d)[%s]\n",
|
|
|
2fc102 |
- ret, strerror(ret)));
|
|
|
2fc102 |
+ ret = sdap_dom_enum_ex_retry(req, state->user_op,
|
|
|
2fc102 |
+ sdap_dom_enum_ex_get_svcs);
|
|
|
2fc102 |
+ if (ret != EOK) {
|
|
|
2fc102 |
tevent_req_error(req, ret);
|
|
|
2fc102 |
+ return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
-
|
|
|
2fc102 |
return;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
@@ -323,11 +362,27 @@ static void sdap_dom_enum_services_done(struct tevent_req *subreq)
|
|
|
2fc102 |
tevent_req_done(req);
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
+errno_t sdap_dom_enum_ex_recv(struct tevent_req *req)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ TEVENT_REQ_RETURN_ON_ERROR(req);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ return EOK;
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+/* ==Enumeration-Request==================================================== */
|
|
|
2fc102 |
+struct tevent_req *
|
|
|
2fc102 |
+sdap_dom_enum_send(TALLOC_CTX *memctx,
|
|
|
2fc102 |
+ struct tevent_context *ev,
|
|
|
2fc102 |
+ struct sdap_id_ctx *ctx,
|
|
|
2fc102 |
+ struct sdap_domain *sdom,
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *conn)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ return sdap_dom_enum_ex_send(memctx, ev, ctx, sdom, conn, conn, conn);
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
errno_t sdap_dom_enum_recv(struct tevent_req *req)
|
|
|
2fc102 |
{
|
|
|
2fc102 |
- TEVENT_REQ_RETURN_ON_ERROR(req);
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- return EOK;
|
|
|
2fc102 |
+ return sdap_dom_enum_ex_recv(req);
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
/* ==User-Enumeration===================================================== */
|
|
|
2fc102 |
diff --git a/src/providers/ldap/sdap_async_enum.h b/src/providers/ldap/sdap_async_enum.h
|
|
|
2fc102 |
index 04ec8c6dcbec4bcce0de67b9e10acc857c9e9416..2da38f988913fa0d6f252697925e50e05eb794a6 100644
|
|
|
2fc102 |
--- a/src/providers/ldap/sdap_async_enum.h
|
|
|
2fc102 |
+++ b/src/providers/ldap/sdap_async_enum.h
|
|
|
2fc102 |
@@ -27,6 +27,17 @@
|
|
|
2fc102 |
#define _SDAP_ASYNC_ENUM_H_
|
|
|
2fc102 |
|
|
|
2fc102 |
struct tevent_req *
|
|
|
2fc102 |
+sdap_dom_enum_ex_send(TALLOC_CTX *memctx,
|
|
|
2fc102 |
+ struct tevent_context *ev,
|
|
|
2fc102 |
+ struct sdap_id_ctx *ctx,
|
|
|
2fc102 |
+ struct sdap_domain *sdom,
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *user_conn,
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *group_conn,
|
|
|
2fc102 |
+ struct sdap_id_conn_ctx *svc_conn);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+errno_t sdap_dom_enum_ex_recv(struct tevent_req *req);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+struct tevent_req *
|
|
|
2fc102 |
sdap_dom_enum_send(TALLOC_CTX *memctx,
|
|
|
2fc102 |
struct tevent_context *ev,
|
|
|
2fc102 |
struct sdap_id_ctx *ctx,
|
|
|
2fc102 |
--
|
|
|
2fc102 |
1.8.4.2
|
|
|
2fc102 |
|