|
|
14acf4 |
From 2515f7d9a19c2634baf1cd2f008a2148b5300db0 Mon Sep 17 00:00:00 2001
|
|
|
14acf4 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
14acf4 |
Date: Mon, 25 Jan 2016 16:11:59 +0100
|
|
|
14acf4 |
Subject: [PATCH 107/108] IPA: Add interface to call into IPA provider from
|
|
|
14acf4 |
LDAP provider
|
|
|
14acf4 |
|
|
|
14acf4 |
https://fedorahosted.org/sssd/ticket/2522
|
|
|
14acf4 |
|
|
|
14acf4 |
Adds a pluggable interface that is able to resolve the IPA group's
|
|
|
14acf4 |
external members. At the moment, the request calls the full be_
|
|
|
14acf4 |
interface to make sure all corner cases like id-views are handled
|
|
|
14acf4 |
internally.
|
|
|
14acf4 |
|
|
|
14acf4 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
14acf4 |
(cherry picked from commit e2d96566aeb881bd89e5c9236d663f6a9a88019a)
|
|
|
14acf4 |
(cherry picked from commit 00ee45423f0712b83926c6f8b354a1a18ff741c8)
|
|
|
14acf4 |
---
|
|
|
14acf4 |
src/providers/ipa/ipa_id.c | 5 +-
|
|
|
14acf4 |
src/providers/ipa/ipa_init.c | 28 +++
|
|
|
14acf4 |
src/providers/ipa/ipa_subdomains.h | 11 ++
|
|
|
14acf4 |
src/providers/ipa/ipa_subdomains_ext_groups.c | 275 ++++++++++++++++++++++++++
|
|
|
14acf4 |
src/providers/ipa/ipa_subdomains_id.c | 1 +
|
|
|
14acf4 |
src/providers/ldap/sdap.h | 23 +++
|
|
|
14acf4 |
6 files changed, 342 insertions(+), 1 deletion(-)
|
|
|
14acf4 |
|
|
|
14acf4 |
diff --git a/src/providers/ipa/ipa_id.c b/src/providers/ipa/ipa_id.c
|
|
|
14acf4 |
index e81ccb34dd6eb44618538593f5473fbe5e89d896..8782a81247f7ca7ba6d2aa55f8d01897a0b38523 100644
|
|
|
14acf4 |
--- a/src/providers/ipa/ipa_id.c
|
|
|
14acf4 |
+++ b/src/providers/ipa/ipa_id.c
|
|
|
14acf4 |
@@ -384,7 +384,10 @@ static int ipa_initgr_get_overrides_step(struct tevent_req *req)
|
|
|
14acf4 |
/* This should never happen, the search filter used to get the list
|
|
|
14acf4 |
* of groups includes "uuid=*"
|
|
|
14acf4 |
*/
|
|
|
14acf4 |
- DEBUG(SSSDBG_OP_FAILURE, "A group with no UUID, error!\n");
|
|
|
14acf4 |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
14acf4 |
+ "The group %s has no UUID attribute %s, error!\n",
|
|
|
14acf4 |
+ ldb_dn_get_linearized(state->groups[state->group_idx]->dn),
|
|
|
14acf4 |
+ state->groups_id_attr);
|
|
|
14acf4 |
return EINVAL;
|
|
|
14acf4 |
}
|
|
|
14acf4 |
|
|
|
14acf4 |
diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c
|
|
|
14acf4 |
index 0e16dd97c78a087256fb77be500c9741484867c5..453e2b25673ac709c9fa3809d35b7885630c8b24 100644
|
|
|
14acf4 |
--- a/src/providers/ipa/ipa_init.c
|
|
|
14acf4 |
+++ b/src/providers/ipa/ipa_init.c
|
|
|
14acf4 |
@@ -139,6 +139,24 @@ int common_ipa_init(struct be_ctx *bectx)
|
|
|
14acf4 |
return EOK;
|
|
|
14acf4 |
}
|
|
|
14acf4 |
|
|
|
14acf4 |
+static struct sdap_ext_member_ctx *
|
|
|
14acf4 |
+ipa_create_ext_members_ctx(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
+ struct ipa_id_ctx *id_ctx)
|
|
|
14acf4 |
+{
|
|
|
14acf4 |
+ struct sdap_ext_member_ctx *ext_ctx = NULL;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ext_ctx = talloc_zero(mem_ctx, struct sdap_ext_member_ctx);
|
|
|
14acf4 |
+ if (ext_ctx == NULL) {
|
|
|
14acf4 |
+ return NULL;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ext_ctx->pvt = id_ctx;
|
|
|
14acf4 |
+ ext_ctx->ext_member_resolve_send = ipa_ext_group_member_send;
|
|
|
14acf4 |
+ ext_ctx->ext_member_resolve_recv = ipa_ext_group_member_recv;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ return ext_ctx;
|
|
|
14acf4 |
+}
|
|
|
14acf4 |
+
|
|
|
14acf4 |
int sssm_ipa_id_init(struct be_ctx *bectx,
|
|
|
14acf4 |
struct bet_ops **ops,
|
|
|
14acf4 |
void **pvt_data)
|
|
|
14acf4 |
@@ -360,6 +378,16 @@ int sssm_ipa_id_init(struct be_ctx *bectx,
|
|
|
14acf4 |
"will not work [%d]: %s\n", ret, strerror(ret));
|
|
|
14acf4 |
}
|
|
|
14acf4 |
|
|
|
14acf4 |
+ ipa_ctx->sdap_id_ctx->opts->ext_ctx = ipa_create_ext_members_ctx(
|
|
|
14acf4 |
+ ipa_ctx->sdap_id_ctx->opts,
|
|
|
14acf4 |
+ ipa_ctx);
|
|
|
14acf4 |
+ if (ipa_ctx->sdap_id_ctx->opts->ext_ctx == NULL) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
14acf4 |
+ "Unable to set SRV the extrernal group ctx\n");
|
|
|
14acf4 |
+ ret = ENOMEM;
|
|
|
14acf4 |
+ goto done;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
*ops = &ipa_id_ops;
|
|
|
14acf4 |
*pvt_data = ipa_ctx;
|
|
|
14acf4 |
ret = EOK;
|
|
|
14acf4 |
diff --git a/src/providers/ipa/ipa_subdomains.h b/src/providers/ipa/ipa_subdomains.h
|
|
|
14acf4 |
index 0c13f8ed2eeda87237dfb097f532c7137095ddf1..23c3b7e3cd3ee1e0ac1dbcf98dc71a6c2337b835 100644
|
|
|
14acf4 |
--- a/src/providers/ipa/ipa_subdomains.h
|
|
|
14acf4 |
+++ b/src/providers/ipa/ipa_subdomains.h
|
|
|
14acf4 |
@@ -137,4 +137,15 @@ struct tevent_req *ipa_get_ad_memberships_send(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
const char *domain);
|
|
|
14acf4 |
|
|
|
14acf4 |
errno_t ipa_get_ad_memberships_recv(struct tevent_req *req, int *dp_error_out);
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+struct tevent_req *ipa_ext_group_member_send(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
+ struct tevent_context *ev,
|
|
|
14acf4 |
+ const char *ext_member,
|
|
|
14acf4 |
+ void *pvt);
|
|
|
14acf4 |
+errno_t ipa_ext_group_member_recv(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
+ struct tevent_req *req,
|
|
|
14acf4 |
+ enum sysdb_member_type *_member_type,
|
|
|
14acf4 |
+ struct sss_domain_info **_dom,
|
|
|
14acf4 |
+ struct sysdb_attrs **_member);
|
|
|
14acf4 |
+
|
|
|
14acf4 |
#endif /* _IPA_SUBDOMAINS_H_ */
|
|
|
14acf4 |
diff --git a/src/providers/ipa/ipa_subdomains_ext_groups.c b/src/providers/ipa/ipa_subdomains_ext_groups.c
|
|
|
14acf4 |
index d487a58b8adffabe09ff50e31cb750b800b1d252..5dc6d0d6417ec3fb5e7865e4cbaf3c07f4afbd07 100644
|
|
|
14acf4 |
--- a/src/providers/ipa/ipa_subdomains_ext_groups.c
|
|
|
14acf4 |
+++ b/src/providers/ipa/ipa_subdomains_ext_groups.c
|
|
|
14acf4 |
@@ -923,3 +923,278 @@ static errno_t ipa_add_ad_memberships_recv(struct tevent_req *req,
|
|
|
14acf4 |
|
|
|
14acf4 |
return EOK;
|
|
|
14acf4 |
}
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+static errno_t
|
|
|
14acf4 |
+search_user_or_group_by_sid_str(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
+ struct sss_domain_info *domain,
|
|
|
14acf4 |
+ const char *sid_str,
|
|
|
14acf4 |
+ enum sysdb_member_type *_member_type,
|
|
|
14acf4 |
+ struct ldb_message **_msg)
|
|
|
14acf4 |
+{
|
|
|
14acf4 |
+ errno_t ret;
|
|
|
14acf4 |
+ struct ldb_message *msg = NULL;
|
|
|
14acf4 |
+ const char *attrs[] = { SYSDB_NAME,
|
|
|
14acf4 |
+ SYSDB_SID_STR,
|
|
|
14acf4 |
+ SYSDB_ORIG_DN,
|
|
|
14acf4 |
+ SYSDB_OBJECTCLASS,
|
|
|
14acf4 |
+ SYSDB_CACHE_EXPIRE,
|
|
|
14acf4 |
+ NULL };
|
|
|
14acf4 |
+ TALLOC_CTX *tmp_ctx = NULL;
|
|
|
14acf4 |
+ char *sanitized_sid = NULL;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ tmp_ctx = talloc_new(NULL);
|
|
|
14acf4 |
+ if (tmp_ctx == NULL) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_CRIT_FAILURE, "talloc_new() failed\n");
|
|
|
14acf4 |
+ return ENOMEM;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ /* In theory SID shouldn't contain any special LDAP characters, but let's
|
|
|
14acf4 |
+ * be paranoid
|
|
|
14acf4 |
+ */
|
|
|
14acf4 |
+ ret = sss_filter_sanitize(tmp_ctx, sid_str, &sanitized_sid);
|
|
|
14acf4 |
+ if (ret != EOK) {
|
|
|
14acf4 |
+ goto done;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ret = sysdb_search_user_by_sid_str(tmp_ctx, domain,
|
|
|
14acf4 |
+ sid_str, attrs, &msg;;
|
|
|
14acf4 |
+ if (ret == EOK) {
|
|
|
14acf4 |
+ *_member_type = SYSDB_MEMBER_USER;
|
|
|
14acf4 |
+ } else if (ret == ENOENT) {
|
|
|
14acf4 |
+ ret = sysdb_search_group_by_sid_str(tmp_ctx, domain,
|
|
|
14acf4 |
+ sid_str, attrs, &msg;;
|
|
|
14acf4 |
+ if (ret == EOK) {
|
|
|
14acf4 |
+ *_member_type = SYSDB_MEMBER_GROUP;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ switch (ret) {
|
|
|
14acf4 |
+ case EOK:
|
|
|
14acf4 |
+ DEBUG(SSSDBG_TRACE_FUNC, "Found %s in sysdb\n", sid_str);
|
|
|
14acf4 |
+ *_msg = talloc_steal(mem_ctx, msg);
|
|
|
14acf4 |
+ break;
|
|
|
14acf4 |
+ case ENOENT:
|
|
|
14acf4 |
+ DEBUG(SSSDBG_TRACE_FUNC,
|
|
|
14acf4 |
+ "Could not find %s in sysdb", sid_str);
|
|
|
14acf4 |
+ break;
|
|
|
14acf4 |
+ default:
|
|
|
14acf4 |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
14acf4 |
+ "Error looking for %s in sysdb [%d]: %s\n",
|
|
|
14acf4 |
+ sid_str, ret, sss_strerror(ret));
|
|
|
14acf4 |
+ break;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+done:
|
|
|
14acf4 |
+ talloc_free(tmp_ctx);
|
|
|
14acf4 |
+ return ret;
|
|
|
14acf4 |
+}
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+static errno_t
|
|
|
14acf4 |
+ipa_ext_group_member_check(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
+ struct ipa_id_ctx *ipa_ctx,
|
|
|
14acf4 |
+ struct sss_domain_info *member_dom,
|
|
|
14acf4 |
+ const char *ext_member,
|
|
|
14acf4 |
+ enum sysdb_member_type *_member_type,
|
|
|
14acf4 |
+ struct sysdb_attrs **_member)
|
|
|
14acf4 |
+{
|
|
|
14acf4 |
+ TALLOC_CTX *tmp_ctx = NULL;
|
|
|
14acf4 |
+ errno_t ret;
|
|
|
14acf4 |
+ uint64_t expire;
|
|
|
14acf4 |
+ time_t now = time(NULL);
|
|
|
14acf4 |
+ struct ldb_message *msg;
|
|
|
14acf4 |
+ struct sysdb_attrs **members;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ tmp_ctx = talloc_new(NULL);
|
|
|
14acf4 |
+ if (tmp_ctx == NULL) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_CRIT_FAILURE, "talloc_new() failed\n");
|
|
|
14acf4 |
+ return ENOMEM;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ret = search_user_or_group_by_sid_str(tmp_ctx, member_dom, ext_member,
|
|
|
14acf4 |
+ _member_type, &msg;;
|
|
|
14acf4 |
+ if (ret != EOK) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
14acf4 |
+ "Error looking up sid %s: [%d]: %s\n",
|
|
|
14acf4 |
+ ext_member, ret, sss_strerror(ret));
|
|
|
14acf4 |
+ goto done;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ret = sysdb_msg2attrs(tmp_ctx, 1, &msg, &members);
|
|
|
14acf4 |
+ if (ret != EOK) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
14acf4 |
+ "Could not convert result to sysdb_attrs [%d]: %s\n",
|
|
|
14acf4 |
+ ret, sss_strerror(ret));
|
|
|
14acf4 |
+ goto done;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ /* Return the member both expired and valid */
|
|
|
14acf4 |
+ *_member = talloc_steal(mem_ctx, members[0]);
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ expire = ldb_msg_find_attr_as_uint64(msg, SYSDB_CACHE_EXPIRE, 0);
|
|
|
14acf4 |
+ if (expire != 0 && expire <= now) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_TRACE_FUNC, "%s is expired", ext_member);
|
|
|
14acf4 |
+ ret = EAGAIN;
|
|
|
14acf4 |
+ goto done;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+done:
|
|
|
14acf4 |
+ talloc_free(tmp_ctx);
|
|
|
14acf4 |
+ return ret;
|
|
|
14acf4 |
+}
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+/* For the IPA external member resolution, we expect a SID as the input.
|
|
|
14acf4 |
+ * The _recv() function output is the member and a type (user/group)
|
|
|
14acf4 |
+ * since nothing else can be a group member.
|
|
|
14acf4 |
+ */
|
|
|
14acf4 |
+struct ipa_ext_member_state {
|
|
|
14acf4 |
+ const char *ext_member;
|
|
|
14acf4 |
+ struct sss_domain_info *dom;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ enum sysdb_member_type member_type;
|
|
|
14acf4 |
+ struct sysdb_attrs *member;
|
|
|
14acf4 |
+};
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+static void ipa_ext_group_member_done(struct tevent_req *subreq);
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+struct tevent_req *ipa_ext_group_member_send(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
+ struct tevent_context *ev,
|
|
|
14acf4 |
+ const char *ext_member,
|
|
|
14acf4 |
+ void *pvt)
|
|
|
14acf4 |
+{
|
|
|
14acf4 |
+ struct ipa_id_ctx *ipa_ctx;
|
|
|
14acf4 |
+ struct ipa_ext_member_state *state;
|
|
|
14acf4 |
+ struct tevent_req *req;
|
|
|
14acf4 |
+ struct tevent_req *subreq;
|
|
|
14acf4 |
+ struct be_acct_req *ar;
|
|
|
14acf4 |
+ errno_t ret;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ req = tevent_req_create(mem_ctx, &state, struct ipa_ext_member_state);
|
|
|
14acf4 |
+ if (req == NULL) {
|
|
|
14acf4 |
+ return NULL;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+ state->ext_member = ext_member;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ipa_ctx = talloc_get_type(pvt, struct ipa_id_ctx);
|
|
|
14acf4 |
+ if (ipa_ctx == NULL) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_CRIT_FAILURE, "Wrong private context!\n");
|
|
|
14acf4 |
+ ret = EINVAL;
|
|
|
14acf4 |
+ goto immediate;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ state->dom = find_domain_by_sid(ipa_ctx->sdap_id_ctx->be->domain,
|
|
|
14acf4 |
+ ext_member);
|
|
|
14acf4 |
+ if (state->dom == NULL) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
14acf4 |
+ "Cannot find domain of SID [%s]\n", ext_member);
|
|
|
14acf4 |
+ ret = ENOENT;
|
|
|
14acf4 |
+ goto immediate;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ret = ipa_ext_group_member_check(state, ipa_ctx, state->dom, ext_member,
|
|
|
14acf4 |
+ &state->member_type, &state->member);
|
|
|
14acf4 |
+ if (ret == EOK) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_TRACE_INTERNAL,
|
|
|
14acf4 |
+ "external member %s already cached\n", ext_member);
|
|
|
14acf4 |
+ goto immediate;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ret = get_be_acct_req_for_sid(state, ext_member, state->dom->name, &ar);
|
|
|
14acf4 |
+ if (ret != EOK) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
14acf4 |
+ "Cannot create the account request for [%s]\n", ext_member);
|
|
|
14acf4 |
+ goto immediate;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ subreq = be_get_account_info_send(state, ev, NULL,
|
|
|
14acf4 |
+ ipa_ctx->sdap_id_ctx->be, ar);
|
|
|
14acf4 |
+ if (subreq == NULL) {
|
|
|
14acf4 |
+ ret = ENOMEM;
|
|
|
14acf4 |
+ goto immediate;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+ tevent_req_set_callback(subreq, ipa_ext_group_member_done, req);
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ return req;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+immediate:
|
|
|
14acf4 |
+ if (ret != EOK) {
|
|
|
14acf4 |
+ tevent_req_error(req, ret);
|
|
|
14acf4 |
+ } else {
|
|
|
14acf4 |
+ tevent_req_done(req);
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+ tevent_req_post(req, ev);
|
|
|
14acf4 |
+ return req;
|
|
|
14acf4 |
+}
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+static void ipa_ext_group_member_done(struct tevent_req *subreq)
|
|
|
14acf4 |
+{
|
|
|
14acf4 |
+ struct tevent_req *req = tevent_req_callback_data(subreq,
|
|
|
14acf4 |
+ struct tevent_req);
|
|
|
14acf4 |
+ struct ipa_ext_member_state *state = tevent_req_data(req,
|
|
|
14acf4 |
+ struct ipa_ext_member_state);
|
|
|
14acf4 |
+ errno_t ret;
|
|
|
14acf4 |
+ int err_maj;
|
|
|
14acf4 |
+ int err_min;
|
|
|
14acf4 |
+ const char *err_msg;
|
|
|
14acf4 |
+ struct ldb_message *msg;
|
|
|
14acf4 |
+ struct sysdb_attrs **members;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ret = be_get_account_info_recv(subreq, state,
|
|
|
14acf4 |
+ &err_maj, &err_min, &err_msg);
|
|
|
14acf4 |
+ talloc_free(subreq);
|
|
|
14acf4 |
+ if (ret != EOK) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
14acf4 |
+ "be request failed %d:%d: %s\n", err_maj, err_min, err_msg);
|
|
|
14acf4 |
+ tevent_req_error(req, ret);
|
|
|
14acf4 |
+ return;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ret = search_user_or_group_by_sid_str(state,
|
|
|
14acf4 |
+ state->dom,
|
|
|
14acf4 |
+ state->ext_member,
|
|
|
14acf4 |
+ &state->member_type,
|
|
|
14acf4 |
+ &msg;;
|
|
|
14acf4 |
+ if (ret != EOK) {
|
|
|
14acf4 |
+ DEBUG(ret == ENOENT ? SSSDBG_TRACE_FUNC : SSSDBG_OP_FAILURE,
|
|
|
14acf4 |
+ "Could not find %s in sysdb [%d]: %s\n",
|
|
|
14acf4 |
+ state->ext_member, ret, sss_strerror(ret));
|
|
|
14acf4 |
+ tevent_req_error(req, ret);
|
|
|
14acf4 |
+ return;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ret = sysdb_msg2attrs(state, 1, &msg, &members);
|
|
|
14acf4 |
+ if (ret != EOK) {
|
|
|
14acf4 |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
14acf4 |
+ "Could not convert result to sysdb_attrs [%d]: %s\n",
|
|
|
14acf4 |
+ ret, sss_strerror(ret));
|
|
|
14acf4 |
+ tevent_req_error(req, ret);
|
|
|
14acf4 |
+ return;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ state->member = members[0];
|
|
|
14acf4 |
+ tevent_req_done(req);
|
|
|
14acf4 |
+}
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+errno_t ipa_ext_group_member_recv(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
+ struct tevent_req *req,
|
|
|
14acf4 |
+ enum sysdb_member_type *_member_type,
|
|
|
14acf4 |
+ struct sss_domain_info **_dom,
|
|
|
14acf4 |
+ struct sysdb_attrs **_member)
|
|
|
14acf4 |
+{
|
|
|
14acf4 |
+ struct ipa_ext_member_state *state = tevent_req_data(req,
|
|
|
14acf4 |
+ struct ipa_ext_member_state);
|
|
|
14acf4 |
+ TEVENT_REQ_RETURN_ON_ERROR(req);
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ if (_member_type != NULL) {
|
|
|
14acf4 |
+ *_member_type = state->member_type;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ if (_dom) {
|
|
|
14acf4 |
+ *_dom = state->dom;
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ if (_member != NULL) {
|
|
|
14acf4 |
+ *_member = talloc_steal(mem_ctx, state->member);
|
|
|
14acf4 |
+ }
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ return EOK;
|
|
|
14acf4 |
+}
|
|
|
14acf4 |
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
|
|
|
14acf4 |
index 7acbb38e66c2c36ff230ae35b236544195a8104b..ebbf3be71d7488c0e5138183925668fc6187df97 100644
|
|
|
14acf4 |
--- a/src/providers/ipa/ipa_subdomains_id.c
|
|
|
14acf4 |
+++ b/src/providers/ipa/ipa_subdomains_id.c
|
|
|
14acf4 |
@@ -1229,6 +1229,7 @@ static errno_t ipa_get_ad_apply_override_step(struct tevent_req *req)
|
|
|
14acf4 |
* attributes set, i.e. where overrides might not have been applied. */
|
|
|
14acf4 |
ret = sysdb_asq_search(state, state->obj_dom, state->obj_msg->dn,
|
|
|
14acf4 |
"(&("SYSDB_GC")("SYSDB_GIDNUM"=*)" \
|
|
|
14acf4 |
+ "("SYSDB_POSIX"=TRUE)" \
|
|
|
14acf4 |
"(!("ORIGINALAD_PREFIX SYSDB_GIDNUM"=*))" \
|
|
|
14acf4 |
"(!("ORIGINALAD_PREFIX SYSDB_NAME"=*)))",
|
|
|
14acf4 |
SYSDB_INITGR_ATTR,
|
|
|
14acf4 |
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
|
|
|
14acf4 |
index d7053949f5804b637c27bb2d8e34991653770639..312789411fa273dd263bd6319f7a5ff45437d8d0 100644
|
|
|
14acf4 |
--- a/src/providers/ldap/sdap.h
|
|
|
14acf4 |
+++ b/src/providers/ldap/sdap.h
|
|
|
14acf4 |
@@ -415,6 +415,26 @@ struct sdap_domain {
|
|
|
14acf4 |
void *pvt;
|
|
|
14acf4 |
};
|
|
|
14acf4 |
|
|
|
14acf4 |
+typedef struct tevent_req *
|
|
|
14acf4 |
+(*ext_member_send_fn_t)(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
+ struct tevent_context *ev,
|
|
|
14acf4 |
+ const char *ext_member,
|
|
|
14acf4 |
+ void *pvt);
|
|
|
14acf4 |
+typedef errno_t
|
|
|
14acf4 |
+(*ext_member_recv_fn_t)(TALLOC_CTX *mem_ctx,
|
|
|
14acf4 |
+ struct tevent_req *req,
|
|
|
14acf4 |
+ enum sysdb_member_type *member_type,
|
|
|
14acf4 |
+ struct sss_domain_info **_dom,
|
|
|
14acf4 |
+ struct sysdb_attrs **_member);
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+struct sdap_ext_member_ctx {
|
|
|
14acf4 |
+ /* Typically ID context of the external ID provider */
|
|
|
14acf4 |
+ void *pvt;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
+ ext_member_send_fn_t ext_member_resolve_send;
|
|
|
14acf4 |
+ ext_member_recv_fn_t ext_member_resolve_recv;
|
|
|
14acf4 |
+};
|
|
|
14acf4 |
+
|
|
|
14acf4 |
struct sdap_options {
|
|
|
14acf4 |
struct dp_option *basic;
|
|
|
14acf4 |
struct sdap_attr_map *gen_map;
|
|
|
14acf4 |
@@ -427,6 +447,9 @@ struct sdap_options {
|
|
|
14acf4 |
/* ID-mapping support */
|
|
|
14acf4 |
struct sdap_idmap_ctx *idmap_ctx;
|
|
|
14acf4 |
|
|
|
14acf4 |
+ /* Resolving external members */
|
|
|
14acf4 |
+ struct sdap_ext_member_ctx *ext_ctx;
|
|
|
14acf4 |
+
|
|
|
14acf4 |
/* FIXME - should this go to a special struct to avoid mixing with name-service-switch maps? */
|
|
|
14acf4 |
struct sdap_attr_map *sudorule_map;
|
|
|
14acf4 |
struct sdap_attr_map *autofs_mobject_map;
|
|
|
14acf4 |
--
|
|
|
14acf4 |
2.4.3
|
|
|
14acf4 |
|