From 59db26782d052ddbec633279d08e8627ca57fd41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 2 Jun 2017 14:16:30 +0200 Subject: [PATCH 102/115] IPA: Use sysdb_search_*_by_orig_dn() in _subdomains_ext_group.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Methods for searching the users, groups and entries by their orig dn have been introduced in one of the previous commit. Let's make use of those whenever it makes sense. Signed-off-by: Fabiano Fidêncio Reviewed-by: Jakub Hrozek Reviewed-by: Lukáš Slebodník --- src/providers/ipa/ipa_subdomains_ext_groups.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/providers/ipa/ipa_subdomains_ext_groups.c b/src/providers/ipa/ipa_subdomains_ext_groups.c index 505d89a51423489a5e2c0e09c9aa49d93c15231b..0359e0dedeef8db0da71d16a6f0044e43a7a9840 100644 --- a/src/providers/ipa/ipa_subdomains_ext_groups.c +++ b/src/providers/ipa/ipa_subdomains_ext_groups.c @@ -315,7 +315,6 @@ static errno_t add_ad_user_to_cached_groups(struct ldb_dn *user_dn, struct sysdb_attrs *user_attrs; size_t msgs_count; struct ldb_message **msgs; - char *subfilter; TALLOC_CTX *tmp_ctx; int ret; @@ -332,15 +331,8 @@ static errno_t add_ad_user_to_cached_groups(struct ldb_dn *user_dn, continue; } - subfilter = talloc_asprintf(tmp_ctx, "(%s=%s)", SYSDB_ORIG_DN, groups[c]); - if (subfilter == NULL) { - DEBUG(SSSDBG_OP_FAILURE, "talloc_asprintf failed.\n"); - ret = ENOMEM; - goto done; - } - - ret = sysdb_search_groups(tmp_ctx, group_dom, subfilter, NULL, - &msgs_count, &msgs); + ret = sysdb_search_groups_by_orig_dn(tmp_ctx, group_dom, groups[c], + NULL, &msgs_count, &msgs); if (ret != EOK) { if (ret == ENOENT) { DEBUG(SSSDBG_TRACE_ALL, "Group [%s] not in the cache.\n", -- 2.14.1