summaryrefslogtreecommitdiff
path: root/src/providers
diff options
context:
space:
mode:
authorJan Zeleny <jzeleny@redhat.com>2012-06-15 14:26:20 -0400
committerStephen Gallagher <sgallagh@redhat.com>2012-06-20 07:41:04 -0400
commit8e1d9a326a6cf88405344077a309cbe3898653c9 (patch)
tree82261cd808a2f530af9edf58cbd1bb5a8e1ae382 /src/providers
parentbb79e7559dae451a14150377099e32d6b5159a6c (diff)
downloadsssd-8e1d9a326a6cf88405344077a309cbe3898653c9.tar.gz
sssd-8e1d9a326a6cf88405344077a309cbe3898653c9.tar.bz2
sssd-8e1d9a326a6cf88405344077a309cbe3898653c9.zip
Fix possible segfault in sdap_save_group()
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ldap/sdap_async_groups.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index 3c3a954e..858c8c90 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -344,7 +344,8 @@ static int sdap_save_group(TALLOC_CTX *memctx,
}
}
- ret = sysdb_attrs_get_el(attrs, opts->group_map[SDAP_AT_GROUP_MEMBER].sys_name, &el1);
+ ret = sysdb_attrs_get_el(attrs, opts->group_map[SDAP_AT_GROUP_MEMBER].sys_name,
+ &el1);
if (ret != EOK) {
goto fail;
}
@@ -356,13 +357,21 @@ static int sdap_save_group(TALLOC_CTX *memctx,
}
el->values = el1->values;
el->num_values = el1->num_values;
-
}
ret = sysdb_attrs_get_el(attrs, SYSDB_GHOST, &gh);
if (ret != EOK) {
goto fail;
}
+ if (gh->num_values == 0) {
+ ret = sysdb_attrs_get_el(attrs,
+ opts->group_map[SDAP_AT_GROUP_MEMBER].sys_name,
+ &el1);
+ if (ret != EOK) {
+ goto fail;
+ }
+ }
+
ret = sysdb_attrs_get_el(group_attrs, SYSDB_GHOST, &el);
if (ret != EOK) {
goto fail;