|
|
905b4d |
From 7d4d2a29a210964024f971708e82c441034d49a7 Mon Sep 17 00:00:00 2001
|
|
|
905b4d |
From: Sumit Bose <sbose@redhat.com>
|
|
|
905b4d |
Date: Thu, 4 Dec 2014 13:26:32 +0100
|
|
|
905b4d |
Subject: [PATCH 161/167] IPA: do not look up overrides on client with default
|
|
|
905b4d |
view
|
|
|
905b4d |
|
|
|
905b4d |
The IPA extdom plugin returns the data with the default view already
|
|
|
905b4d |
applied hence it is on needed to look up the override data if the client
|
|
|
905b4d |
has the default view assigned.
|
|
|
905b4d |
|
|
|
905b4d |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
905b4d |
(cherry picked from commit d8ceb194023a2cdc8bc183acc322e9a7fb6fe2b1)
|
|
|
905b4d |
---
|
|
|
905b4d |
src/providers/ipa/ipa_s2n_exop.c | 63 +++++++++++++++++++++++++++++++---------
|
|
|
905b4d |
1 file changed, 49 insertions(+), 14 deletions(-)
|
|
|
905b4d |
|
|
|
905b4d |
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
|
|
|
905b4d |
index 55450c7029391a99bfc33b8446765f71c4d0928a..1d9a79a383e47fcdd37f30a24327ae76facea5b9 100644
|
|
|
905b4d |
--- a/src/providers/ipa/ipa_s2n_exop.c
|
|
|
905b4d |
+++ b/src/providers/ipa/ipa_s2n_exop.c
|
|
|
905b4d |
@@ -888,11 +888,13 @@ struct ipa_s2n_get_groups_state {
|
|
|
905b4d |
int exop_timeout;
|
|
|
905b4d |
struct resp_attrs *attrs;
|
|
|
905b4d |
struct sss_domain_info *obj_domain;
|
|
|
905b4d |
+ struct sysdb_attrs *override_attrs;
|
|
|
905b4d |
};
|
|
|
905b4d |
|
|
|
905b4d |
static errno_t ipa_s2n_get_groups_step(struct tevent_req *req);
|
|
|
905b4d |
static void ipa_s2n_get_groups_get_override_done(struct tevent_req *subreq);
|
|
|
905b4d |
static void ipa_s2n_get_groups_next(struct tevent_req *subreq);
|
|
|
905b4d |
+static errno_t ipa_s2n_get_groups_save_step(struct tevent_req *req);
|
|
|
905b4d |
|
|
|
905b4d |
static struct tevent_req *ipa_s2n_get_groups_send(TALLOC_CTX *mem_ctx,
|
|
|
905b4d |
struct tevent_context *ev,
|
|
|
905b4d |
@@ -921,6 +923,7 @@ static struct tevent_req *ipa_s2n_get_groups_send(TALLOC_CTX *mem_ctx,
|
|
|
905b4d |
state->req_input.inp.name = NULL;
|
|
|
905b4d |
state->exop_timeout = exop_timeout;
|
|
|
905b4d |
state->attrs = NULL;
|
|
|
905b4d |
+ state->override_attrs = NULL;
|
|
|
905b4d |
|
|
|
905b4d |
ret = ipa_s2n_get_groups_step(req);
|
|
|
905b4d |
if (ret != EOK) {
|
|
|
905b4d |
@@ -1018,6 +1021,18 @@ static void ipa_s2n_get_groups_next(struct tevent_req *subreq)
|
|
|
905b4d |
goto fail;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
+ if (strcmp(state->ipa_ctx->view_name, SYSDB_DEFAULT_VIEW_NAME) == 0) {
|
|
|
905b4d |
+ ret = ipa_s2n_get_groups_save_step(req);
|
|
|
905b4d |
+ if (ret == EOK) {
|
|
|
905b4d |
+ tevent_req_done(req);
|
|
|
905b4d |
+ } else if (ret != EAGAIN) {
|
|
|
905b4d |
+ DEBUG(SSSDBG_OP_FAILURE, "ipa_s2n_get_groups_save_step failed.\n");
|
|
|
905b4d |
+ goto fail;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+
|
|
|
905b4d |
+ return;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+
|
|
|
905b4d |
ret = sysdb_attrs_get_string(state->attrs->sysdb_attrs, SYSDB_SID_STR,
|
|
|
905b4d |
&sid_str);
|
|
|
905b4d |
if (ret != EOK) {
|
|
|
905b4d |
@@ -1059,39 +1074,55 @@ static void ipa_s2n_get_groups_get_override_done(struct tevent_req *subreq)
|
|
|
905b4d |
struct tevent_req);
|
|
|
905b4d |
struct ipa_s2n_get_groups_state *state = tevent_req_data(req,
|
|
|
905b4d |
struct ipa_s2n_get_groups_state);
|
|
|
905b4d |
- struct sysdb_attrs *override_attrs = NULL;
|
|
|
905b4d |
|
|
|
905b4d |
- ret = ipa_get_ad_override_recv(subreq, NULL, state, &override_attrs);
|
|
|
905b4d |
+ ret = ipa_get_ad_override_recv(subreq, NULL, state, &state->override_attrs);
|
|
|
905b4d |
talloc_zfree(subreq);
|
|
|
905b4d |
if (ret != EOK) {
|
|
|
905b4d |
DEBUG(SSSDBG_OP_FAILURE, "IPA override lookup failed: %d\n", ret);
|
|
|
905b4d |
goto fail;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
+ ret = ipa_s2n_get_groups_save_step(req);
|
|
|
905b4d |
+ if (ret == EOK) {
|
|
|
905b4d |
+ tevent_req_done(req);
|
|
|
905b4d |
+ } else if (ret != EAGAIN) {
|
|
|
905b4d |
+ DEBUG(SSSDBG_OP_FAILURE, "ipa_s2n_get_groups_save_step failed.\n");
|
|
|
905b4d |
+ goto fail;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+
|
|
|
905b4d |
+ return;
|
|
|
905b4d |
+
|
|
|
905b4d |
+fail:
|
|
|
905b4d |
+ tevent_req_error(req,ret);
|
|
|
905b4d |
+ return;
|
|
|
905b4d |
+}
|
|
|
905b4d |
+
|
|
|
905b4d |
+static errno_t ipa_s2n_get_groups_save_step(struct tevent_req *req)
|
|
|
905b4d |
+{
|
|
|
905b4d |
+ int ret;
|
|
|
905b4d |
+ struct ipa_s2n_get_groups_state *state = tevent_req_data(req,
|
|
|
905b4d |
+ struct ipa_s2n_get_groups_state);
|
|
|
905b4d |
+
|
|
|
905b4d |
ret = ipa_s2n_save_objects(state->dom, &state->req_input, state->attrs,
|
|
|
905b4d |
- NULL, state->ipa_ctx->view_name, override_attrs);
|
|
|
905b4d |
+ NULL, state->ipa_ctx->view_name,
|
|
|
905b4d |
+ state->override_attrs);
|
|
|
905b4d |
if (ret != EOK) {
|
|
|
905b4d |
DEBUG(SSSDBG_OP_FAILURE, "ipa_s2n_save_objects failed.\n");
|
|
|
905b4d |
- goto fail;
|
|
|
905b4d |
+ return ret;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
state->group_idx++;
|
|
|
905b4d |
if (state->group_list[state->group_idx] == NULL) {
|
|
|
905b4d |
- tevent_req_done(req);
|
|
|
905b4d |
- return;
|
|
|
905b4d |
+ return EOK;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
ret = ipa_s2n_get_groups_step(req);
|
|
|
905b4d |
if (ret != EOK) {
|
|
|
905b4d |
DEBUG(SSSDBG_OP_FAILURE, "ipa_s2n_get_groups_step failed.\n");
|
|
|
905b4d |
- goto fail;
|
|
|
905b4d |
+ return ret;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
- return;
|
|
|
905b4d |
-
|
|
|
905b4d |
-fail:
|
|
|
905b4d |
- tevent_req_error(req,ret);
|
|
|
905b4d |
- return;
|
|
|
905b4d |
+ return EAGAIN;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
static int ipa_s2n_get_groups_recv(struct tevent_req *req)
|
|
|
905b4d |
@@ -1484,7 +1515,9 @@ static void ipa_s2n_get_user_done(struct tevent_req *subreq)
|
|
|
905b4d |
ret = ENOENT;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
- if (ret == ENOENT) {
|
|
|
905b4d |
+ if (ret == ENOENT
|
|
|
905b4d |
+ || strcmp(state->ipa_ctx->view_name,
|
|
|
905b4d |
+ SYSDB_DEFAULT_VIEW_NAME) == 0) {
|
|
|
905b4d |
ret = ipa_s2n_save_objects(state->dom, state->req_input, state->attrs,
|
|
|
905b4d |
state->simple_attrs, NULL, NULL);
|
|
|
905b4d |
if (ret != EOK) {
|
|
|
905b4d |
@@ -2046,7 +2079,9 @@ static void ipa_s2n_get_groups_done(struct tevent_req *subreq)
|
|
|
905b4d |
goto fail;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
- if (state->override_attrs == NULL) {
|
|
|
905b4d |
+ if (state->override_attrs == NULL
|
|
|
905b4d |
+ && strcmp(state->ipa_ctx->view_name,
|
|
|
905b4d |
+ SYSDB_DEFAULT_VIEW_NAME) != 0) {
|
|
|
905b4d |
subreq = ipa_get_ad_override_send(state, state->ev,
|
|
|
905b4d |
state->ipa_ctx->sdap_id_ctx,
|
|
|
905b4d |
state->ipa_ctx->ipa_options,
|
|
|
905b4d |
--
|
|
|
905b4d |
2.1.0
|
|
|
905b4d |
|