summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-07-08 13:19:31 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2016-08-02 08:55:59 +0200
commit64175969779e51c00a78397746d4fec7ce7033a4 (patch)
tree32bd1d80d5b284465d958d4b09d786f0303a5f50 /src
parent50a7a92f92e1584702bf25e61a50cb1c09c7e260 (diff)
LDAP: Fix storing initgroups for users with no supplementary groups
If there are no supplementary groups, we tried to qualify a NULL pointer to an array which resulted in an error. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/providers/ldap/sdap_async_initgroups.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/providers/ldap/sdap_async_initgroups.c b/src/providers/ldap/sdap_async_initgroups.c
index 702942772..cc63dff78 100644
--- a/src/providers/ldap/sdap_async_initgroups.c
+++ b/src/providers/ldap/sdap_async_initgroups.c
@@ -301,13 +301,15 @@ int sdap_initgr_common_store(struct sysdb_ctx *sysdb,
/* Find the differences between the sysdb and LDAP lists
* Groups in the sysdb only must be removed.
*/
- ldap_fqdnlist = sss_create_internal_fqname_list(
- tmp_ctx,
- (const char * const *) ldap_grouplist,
- domain->name);
- if (ldap_fqdnlist == NULL) {
- ret = ENOMEM;
- goto done;
+ if (ldap_grouplist != NULL) {
+ ldap_fqdnlist = sss_create_internal_fqname_list(
+ tmp_ctx,
+ (const char * const *) ldap_grouplist,
+ domain->name);
+ if (ldap_fqdnlist == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
}
ret = diff_string_lists(tmp_ctx, ldap_fqdnlist, sysdb_grouplist,
@@ -1288,13 +1290,15 @@ sdap_initgr_store_user_memberships(struct sdap_initgr_nested_state *state)
}
}
- ldap_fqdnlist = sss_create_internal_fqname_list(
- tmp_ctx,
- (const char * const *) ldap_parent_name_list,
- state->dom->name);
- if (ldap_fqdnlist == NULL) {
- ret = ENOMEM;
- goto done;
+ if (ldap_parent_name_list) {
+ ldap_fqdnlist = sss_create_internal_fqname_list(
+ tmp_ctx,
+ (const char * const *) ldap_parent_name_list,
+ state->dom->name);
+ if (ldap_fqdnlist == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
}
ret = sysdb_get_direct_parents(tmp_ctx, state->dom, SYSDB_MEMBER_USER,