|
|
9f2ebf |
From 3500a7766f5443c9ec50f9c8de27e2dea8c0c234 Mon Sep 17 00:00:00 2001
|
|
|
9f2ebf |
From: Sumit Bose <sbose@redhat.com>
|
|
|
9f2ebf |
Date: Mon, 20 Nov 2017 16:41:29 +0100
|
|
|
9f2ebf |
Subject: [PATCH 66/67] IPA: use cache searches in get_groups_dns()
|
|
|
9f2ebf |
MIME-Version: 1.0
|
|
|
9f2ebf |
Content-Type: text/plain; charset=UTF-8
|
|
|
9f2ebf |
Content-Transfer-Encoding: 8bit
|
|
|
9f2ebf |
|
|
|
9f2ebf |
If the group name is overridden in the default view we have to search
|
|
|
9f2ebf |
for the name and cannot construct it because the extdom plugin will
|
|
|
9f2ebf |
return the overridden name but the DN of the related group object in the
|
|
|
9f2ebf |
cache will contain the original name.
|
|
|
9f2ebf |
|
|
|
9f2ebf |
Related to https://pagure.io/SSSD/sssd/issue/3579
|
|
|
9f2ebf |
|
|
|
9f2ebf |
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
|
|
|
9f2ebf |
(cherry picked from commit f29040342a6d69e170f4543662621f2e27221f91)
|
|
|
9f2ebf |
---
|
|
|
9f2ebf |
src/providers/ipa/ipa_s2n_exop.c | 27 +++++++++++++++++++--------
|
|
|
9f2ebf |
1 file changed, 19 insertions(+), 8 deletions(-)
|
|
|
9f2ebf |
|
|
|
9f2ebf |
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
|
|
|
9f2ebf |
index c6132f509dcc8e7af84e03e8bfe20701107d1392..49c393e9a1eb19ab683949cf633a6838274bc0fe 100644
|
|
|
9f2ebf |
--- a/src/providers/ipa/ipa_s2n_exop.c
|
|
|
9f2ebf |
+++ b/src/providers/ipa/ipa_s2n_exop.c
|
|
|
9f2ebf |
@@ -2038,6 +2038,7 @@ static errno_t get_groups_dns(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom,
|
|
|
9f2ebf |
int c;
|
|
|
9f2ebf |
struct sss_domain_info *root_domain;
|
|
|
9f2ebf |
char **dn_list;
|
|
|
9f2ebf |
+ struct ldb_message *msg;
|
|
|
9f2ebf |
|
|
|
9f2ebf |
if (name_list == NULL) {
|
|
|
9f2ebf |
*_dn_list = NULL;
|
|
|
9f2ebf |
@@ -2082,15 +2083,25 @@ static errno_t get_groups_dns(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom,
|
|
|
9f2ebf |
goto done;
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
|
|
|
9f2ebf |
- /* This might fail if some unexpected cases are used. But current
|
|
|
9f2ebf |
- * sysdb code which handles group membership constructs DNs this way
|
|
|
9f2ebf |
- * as well, IPA names are lowercased and AD names by default will be
|
|
|
9f2ebf |
- * lowercased as well. If there are really use-cases which cause an
|
|
|
9f2ebf |
- * issue here, sysdb_group_strdn() has to be replaced by a proper
|
|
|
9f2ebf |
- * search. */
|
|
|
9f2ebf |
- dn_list[c] = sysdb_group_strdn(dn_list, dom->name, name_list[c]);
|
|
|
9f2ebf |
+ /* If the group name is overridden in the default view we have to
|
|
|
9f2ebf |
+ * search for the name and cannot construct it because the extdom
|
|
|
9f2ebf |
+ * plugin will return the overridden name but the DN of the related
|
|
|
9f2ebf |
+ * group object in the cache will contain the original name. */
|
|
|
9f2ebf |
+
|
|
|
9f2ebf |
+ ret = sysdb_search_group_by_name(tmp_ctx, dom, name_list[c], NULL,
|
|
|
9f2ebf |
+ &msg;;
|
|
|
9f2ebf |
+ if (ret == EOK) {
|
|
|
9f2ebf |
+ dn_list[c] = ldb_dn_alloc_linearized(dn_list, msg->dn);
|
|
|
9f2ebf |
+ } else {
|
|
|
9f2ebf |
+ /* best effort, try to construct the DN */
|
|
|
9f2ebf |
+ DEBUG(SSSDBG_TRACE_FUNC,
|
|
|
9f2ebf |
+ "sysdb_search_group_by_name failed with [%d], "
|
|
|
9f2ebf |
+ "generating DN for [%s] in domain [%s].\n",
|
|
|
9f2ebf |
+ ret, name_list[c], dom->name);
|
|
|
9f2ebf |
+ dn_list[c] = sysdb_group_strdn(dn_list, dom->name, name_list[c]);
|
|
|
9f2ebf |
+ }
|
|
|
9f2ebf |
if (dn_list[c] == NULL) {
|
|
|
9f2ebf |
- DEBUG(SSSDBG_OP_FAILURE, "sysdb_group_strdn failed.\n");
|
|
|
9f2ebf |
+ DEBUG(SSSDBG_OP_FAILURE, "ldb_dn_alloc_linearized failed.\n");
|
|
|
9f2ebf |
ret = ENOMEM;
|
|
|
9f2ebf |
goto done;
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
--
|
|
|
9f2ebf |
2.14.3
|
|
|
9f2ebf |
|