diff options
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/idmap.c | 12 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_ads.c | 25 |
2 files changed, 24 insertions, 13 deletions
diff --git a/source3/nsswitch/idmap.c b/source3/nsswitch/idmap.c index 26fcc692e9..5222eba8f3 100644 --- a/source3/nsswitch/idmap.c +++ b/source3/nsswitch/idmap.c @@ -1026,9 +1026,15 @@ static NTSTATUS idmap_backends_sids_to_unixids(struct id_map **ids) /* split list per domain */ - dom_ids = TALLOC_ZERO_ARRAY(ctx, struct id_map **, num_domains); - IDMAP_CHECK_ALLOC(dom_ids); - counters = TALLOC_ZERO_ARRAY(ctx, int, num_domains); + if (num_domains) { + dom_ids = TALLOC_ZERO_ARRAY(ctx, struct id_map **, num_domains); + IDMAP_CHECK_ALLOC(dom_ids); + counters = TALLOC_ZERO_ARRAY(ctx, int, num_domains); + IDMAP_CHECK_ALLOC(counters); + } else { + dom_ids = NULL; + counters = NULL; + } /* partition the requests by domain */ diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c index 01174edf37..355a093855 100644 --- a/source3/nsswitch/winbindd_ads.c +++ b/source3/nsswitch/winbindd_ads.c @@ -907,16 +907,21 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain, the problem is that the members are in the form of distinguised names */ - (*sid_mem) = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID, num_members); - (*name_types) = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_members); - (*names) = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_members); - - if ((num_members != 0) && - ((members == NULL) || (*sid_mem == NULL) || - (*name_types == NULL) || (*names == NULL))) { - DEBUG(1, ("talloc failed\n")); - status = NT_STATUS_NO_MEMORY; - goto done; + if (num_members) { + (*sid_mem) = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID, num_members); + (*name_types) = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_members); + (*names) = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_members); + + if ((members == NULL) || (*sid_mem == NULL) || + (*name_types == NULL) || (*names == NULL)) { + DEBUG(1, ("talloc failed\n")); + status = NT_STATUS_NO_MEMORY; + goto done; + } + } else { + (*sid_mem) = NULL; + (*name_types) = NULL; + (*names) = NULL; } for (i=0;i<num_members;i++) { |