|
|
bb7cd1 |
From e3b29c9f95d5a5ff007000b254143c337ef0b0dc Mon Sep 17 00:00:00 2001
|
|
|
bb7cd1 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
bb7cd1 |
Date: Fri, 19 May 2017 12:52:47 +0200
|
|
|
bb7cd1 |
Subject: [PATCH 138/138] ipa: filter IPA users from extdom lookups by
|
|
|
bb7cd1 |
certificate
|
|
|
bb7cd1 |
MIME-Version: 1.0
|
|
|
bb7cd1 |
Content-Type: text/plain; charset=UTF-8
|
|
|
bb7cd1 |
Content-Transfer-Encoding: 8bit
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
The extdom lookup by certificate will return the names of all matching
|
|
|
bb7cd1 |
users, both from the IPA and trusted domains. The IPA users from the
|
|
|
bb7cd1 |
list should not be looked up via the extdom plugin because they are
|
|
|
bb7cd1 |
already lookup up directly. Additionally the lookup might fail and cause
|
|
|
bb7cd1 |
an error which might prevent that the remaining users from the list are
|
|
|
bb7cd1 |
looked up.
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Resolves https://pagure.io/SSSD/sssd/issue/3407
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
bb7cd1 |
(cherry picked from commit eb7095099b2dd0afb1d028dbc15d8c5a897d90f8)
|
|
|
bb7cd1 |
---
|
|
|
bb7cd1 |
src/providers/ipa/ipa_s2n_exop.c | 35 ++++++++++++++++++++++++++++++-----
|
|
|
bb7cd1 |
1 file changed, 30 insertions(+), 5 deletions(-)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
|
|
|
bb7cd1 |
index f5f4401f86615dc7f81f844e1096ad43e965c384..15904e0197919c34b1bce58b4bd2c070f99b67a7 100644
|
|
|
bb7cd1 |
--- a/src/providers/ipa/ipa_s2n_exop.c
|
|
|
bb7cd1 |
+++ b/src/providers/ipa/ipa_s2n_exop.c
|
|
|
bb7cd1 |
@@ -792,6 +792,7 @@ static errno_t s2n_response_to_attrs(TALLOC_CTX *mem_ctx,
|
|
|
bb7cd1 |
char **name_list = NULL;
|
|
|
bb7cd1 |
ber_len_t ber_len;
|
|
|
bb7cd1 |
char *fq_name = NULL;
|
|
|
bb7cd1 |
+ struct sss_domain_info *root_domain = NULL;
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
if (retoid == NULL || retdata == NULL) {
|
|
|
bb7cd1 |
DEBUG(SSSDBG_OP_FAILURE, "Missing OID or data.\n");
|
|
|
bb7cd1 |
@@ -965,6 +966,8 @@ static errno_t s2n_response_to_attrs(TALLOC_CTX *mem_ctx,
|
|
|
bb7cd1 |
goto done;
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+ root_domain = get_domains_head(dom);
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
while (ber_peek_tag(ber, &ber_len) == LBER_SEQUENCE) {
|
|
|
bb7cd1 |
tag = ber_scanf(ber, "{aa}", &domain_name, &name);
|
|
|
bb7cd1 |
if (tag == LBER_ERROR) {
|
|
|
bb7cd1 |
@@ -983,7 +986,12 @@ static errno_t s2n_response_to_attrs(TALLOC_CTX *mem_ctx,
|
|
|
bb7cd1 |
DEBUG(SSSDBG_TRACE_ALL, "[%s][%s][%s].\n", domain_name, name,
|
|
|
bb7cd1 |
fq_name);
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
- ret = add_string_to_list(attrs, fq_name, &name_list);
|
|
|
bb7cd1 |
+ if (strcasecmp(root_domain->name, domain_name) != 0) {
|
|
|
bb7cd1 |
+ ret = add_string_to_list(attrs, fq_name, &name_list);
|
|
|
bb7cd1 |
+ } else {
|
|
|
bb7cd1 |
+ DEBUG(SSSDBG_TRACE_ALL,
|
|
|
bb7cd1 |
+ "[%s] from root domain, skipping.\n", fq_name);
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
ber_memfree(domain_name);
|
|
|
bb7cd1 |
ber_memfree(name);
|
|
|
bb7cd1 |
talloc_free(fq_name);
|
|
|
bb7cd1 |
@@ -1228,7 +1236,7 @@ static errno_t ipa_s2n_get_list_step(struct tevent_req *req)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
break;
|
|
|
bb7cd1 |
default:
|
|
|
bb7cd1 |
- DEBUG(SSSDBG_OP_FAILURE, "Unexpected inoput type [%d].\n",
|
|
|
bb7cd1 |
+ DEBUG(SSSDBG_OP_FAILURE, "Unexpected input type [%d].\n",
|
|
|
bb7cd1 |
state->req_input.type);
|
|
|
bb7cd1 |
return EINVAL;
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
@@ -1247,9 +1255,10 @@ static errno_t ipa_s2n_get_list_step(struct tevent_req *req)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
if (state->req_input.type == REQ_INP_NAME
|
|
|
bb7cd1 |
&& state->req_input.inp.name != NULL) {
|
|
|
bb7cd1 |
- DEBUG(SSSDBG_TRACE_FUNC, "Sending request_type: [%s] for group [%s].\n",
|
|
|
bb7cd1 |
- ipa_s2n_reqtype2str(state->request_type),
|
|
|
bb7cd1 |
- state->list[state->list_idx]);
|
|
|
bb7cd1 |
+ DEBUG(SSSDBG_TRACE_FUNC,
|
|
|
bb7cd1 |
+ "Sending request_type: [%s] for object [%s].\n",
|
|
|
bb7cd1 |
+ ipa_s2n_reqtype2str(state->request_type),
|
|
|
bb7cd1 |
+ state->list[state->list_idx]);
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
subreq = ipa_s2n_exop_send(state, state->ev, state->sh, need_v1,
|
|
|
bb7cd1 |
@@ -1886,6 +1895,13 @@ static void ipa_s2n_get_user_done(struct tevent_req *subreq)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
if (state->simple_attrs->response_type == RESP_NAME_LIST
|
|
|
bb7cd1 |
&& state->req_input->type == REQ_INP_CERT) {
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ if (state->simple_attrs->name_list == NULL) {
|
|
|
bb7cd1 |
+ /* No results from sub-domains, nothing to do */
|
|
|
bb7cd1 |
+ ret = EOK;
|
|
|
bb7cd1 |
+ goto done;
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
state->mapped_attrs = sysdb_new_attrs(state);
|
|
|
bb7cd1 |
if (state->mapped_attrs == NULL) {
|
|
|
bb7cd1 |
DEBUG(SSSDBG_OP_FAILURE, "sysdb_new_attrs failed.\n");
|
|
|
bb7cd1 |
@@ -2640,6 +2656,15 @@ static void ipa_s2n_get_list_done(struct tevent_req *subreq)
|
|
|
bb7cd1 |
return;
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+ if (state->attrs == NULL) {
|
|
|
bb7cd1 |
+ /* If this is a request by certificate we are done */
|
|
|
bb7cd1 |
+ if (state->req_input->type == REQ_INP_CERT) {
|
|
|
bb7cd1 |
+ tevent_req_done(req);
|
|
|
bb7cd1 |
+ } else {
|
|
|
bb7cd1 |
+ tevent_req_error(req, EINVAL);
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
ret = sysdb_attrs_get_string(state->attrs->sysdb_attrs, SYSDB_SID_STR,
|
|
|
bb7cd1 |
&sid_str);
|
|
|
bb7cd1 |
if (ret == ENOENT) {
|
|
|
bb7cd1 |
--
|
|
|
bb7cd1 |
2.9.4
|
|
|
bb7cd1 |
|