summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-09-13 16:06:03 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-09-20 20:52:04 +0200
commita8e7d395b4aab4e7a236aebf162a844ae51cc7db (patch)
tree751c2a063243d8c7d82ddb481b518717831f2d80 /src
parent09b915007009b3e7a0942630fae132a6c534e349 (diff)
downloadsssd-a8e7d395b4aab4e7a236aebf162a844ae51cc7db.tar.gz
sssd-a8e7d395b4aab4e7a236aebf162a844ae51cc7db.tar.bz2
sssd-a8e7d395b4aab4e7a236aebf162a844ae51cc7db.zip
LDAP: Use primary cn to search netgroup
Resolves: https://fedorahosted.org/sssd/ticket/2075
Diffstat (limited to 'src')
-rw-r--r--src/providers/ldap/sdap.c11
-rw-r--r--src/providers/ldap/sdap.h6
-rw-r--r--src/providers/ldap/sdap_async_netgroups.c12
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) {