From a8e7d395b4aab4e7a236aebf162a844ae51cc7db Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Fri, 13 Sep 2013 16:06:03 +0200 Subject: LDAP: Use primary cn to search netgroup Resolves: https://fedorahosted.org/sssd/ticket/2075 --- src/providers/ldap/sdap.c | 11 +++++++++++ src/providers/ldap/sdap.h | 6 ++++++ src/providers/ldap/sdap_async_netgroups.c | 12 +++++------- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c index 7741030c..078326ad 100644 --- a/src/providers/ldap/sdap.c +++ b/src/providers/ldap/sdap.c @@ -1260,3 +1260,14 @@ errno_t sdap_get_group_primary_name(TALLOC_CTX *memctx, opts->group_map[SDAP_AT_GROUP_NAME].name, attrs, dom, _group_name); } + +errno_t sdap_get_netgroup_primary_name(TALLOC_CTX *memctx, + struct sdap_options *opts, + struct sysdb_attrs *attrs, + struct sss_domain_info *dom, + const char **_netgroup_name) +{ + return sdap_get_primary_name(memctx, + opts->netgroup_map[SDAP_AT_NETGROUP_NAME].name, + attrs, dom, _netgroup_name); +} diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h index 441ac904..0e886e98 100644 --- a/src/providers/ldap/sdap.h +++ b/src/providers/ldap/sdap.h @@ -511,6 +511,12 @@ errno_t sdap_get_user_primary_name(TALLOC_CTX *memctx, struct sss_domain_info *dom, const char **_user_name); +errno_t sdap_get_netgroup_primary_name(TALLOC_CTX *memctx, + struct sdap_options *opts, + struct sysdb_attrs *attrs, + struct sss_domain_info *dom, + const char **_netgroup_name); + errno_t sdap_set_config_options_with_rootdse(struct sysdb_attrs *rootdse, struct sdap_options *opts, struct sdap_domain *sdom); diff --git a/src/providers/ldap/sdap_async_netgroups.c b/src/providers/ldap/sdap_async_netgroups.c index 099955a6..b47b3e59 100644 --- a/src/providers/ldap/sdap_async_netgroups.c +++ b/src/providers/ldap/sdap_async_netgroups.c @@ -53,15 +53,13 @@ static errno_t sdap_save_netgroup(TALLOC_CTX *memctx, char *timestamp = NULL; char **missing = NULL; - ret = sysdb_attrs_get_el(attrs, - opts->netgroup_map[SDAP_AT_NETGROUP_NAME].sys_name, - &el); - if (ret) goto fail; - if (el->num_values == 0) { - ret = EINVAL; + ret = sdap_get_netgroup_primary_name(memctx, opts, attrs, dom, &name); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, ("Failed to get netgroup name\n")); goto fail; } - name = (const char *)el->values[0].data; + + DEBUG(SSSDBG_TRACE_FUNC, ("Processing netgroup %s\n", name)); netgroup_attrs = sysdb_new_attrs(memctx); if (!netgroup_attrs) { -- cgit