summaryrefslogtreecommitdiffstats
path: root/source3/nsswitch/winbindd_cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/nsswitch/winbindd_cache.c')
-rw-r--r--source3/nsswitch/winbindd_cache.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c
index da8983dda25..47bd872f030 100644
--- a/source3/nsswitch/winbindd_cache.c
+++ b/source3/nsswitch/winbindd_cache.c
@@ -1794,11 +1794,15 @@ static NTSTATUS lookup_useraliases(struct winbindd_domain *domain,
*num_aliases = centry_uint32(centry);
*alias_rids = NULL;
- (*alias_rids) = TALLOC_ARRAY(mem_ctx, uint32, *num_aliases);
+ if (*num_aliases) {
+ (*alias_rids) = TALLOC_ARRAY(mem_ctx, uint32, *num_aliases);
- if ((*num_aliases != 0) && ((*alias_rids) == NULL)) {
- centry_free(centry);
- return NT_STATUS_NO_MEMORY;
+ if ((*alias_rids) == NULL) {
+ centry_free(centry);
+ return NT_STATUS_NO_MEMORY;
+ }
+ } else {
+ (*alias_rids) = NULL;
}
for (i=0; i<(*num_aliases); i++)
@@ -1962,15 +1966,21 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
*num_domains = centry_uint32(centry);
- (*names) = TALLOC_ARRAY(mem_ctx, char *, *num_domains);
- (*alt_names) = TALLOC_ARRAY(mem_ctx, char *, *num_domains);
- (*dom_sids) = TALLOC_ARRAY(mem_ctx, DOM_SID, *num_domains);
+ if (*num_domains) {
+ (*names) = TALLOC_ARRAY(mem_ctx, char *, *num_domains);
+ (*alt_names) = TALLOC_ARRAY(mem_ctx, char *, *num_domains);
+ (*dom_sids) = TALLOC_ARRAY(mem_ctx, DOM_SID, *num_domains);
- if (! (*dom_sids) || ! (*names) || ! (*alt_names)) {
- smb_panic_fn("trusted_domains out of memory");
- centry_free(centry);
- return NT_STATUS_NO_MEMORY;
- }
+ if (! (*dom_sids) || ! (*names) || ! (*alt_names)) {
+ smb_panic_fn("trusted_domains out of memory");
+ centry_free(centry);
+ return NT_STATUS_NO_MEMORY;
+ }
+ } else {
+ (*names) = NULL;
+ (*alt_names) = NULL;
+ (*dom_sids) = NULL;
+ }
for (i=0; i<(*num_domains); i++) {
(*names)[i] = centry_string(centry, mem_ctx);