The branch, master has been updated via 95eb6db s3-net: use talloc array in share allowedusers from 9c48dbd dns_server: Fix CNAME handling
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 95eb6db580678a29b1f5f30a9567ea449a43d75a Author: Ralph Boehme <s...@samba.org> Date: Tue Aug 4 11:18:34 2015 +0200 s3-net: use talloc array in share allowedusers Bug: https://bugzilla.samba.org/show_bug.cgi?id=11426 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> Autobuild-User(master): Ralph Böhme <s...@samba.org> Autobuild-Date(master): Tue Aug 4 16:48:36 CEST 2015 on sn-devel-104 ----------------------------------------------------------------------- Summary of changes: source3/utils/net_rpc.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 6eb27c9..1de08c4 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -4522,10 +4522,25 @@ static struct full_alias *server_aliases; /* * Add an alias to the static list. */ -static void push_alias(TALLOC_CTX *mem_ctx, struct full_alias *alias) +static void push_alias(struct full_alias *alias) { - if (server_aliases == NULL) - server_aliases = SMB_MALLOC_ARRAY(struct full_alias, 100); + size_t array_size; + + if (server_aliases == NULL) { + server_aliases = talloc_array(NULL, struct full_alias, 100); + if (server_aliases == NULL) { + smb_panic("talloc_array failed"); + } + } + + array_size = talloc_array_length(server_aliases); + if (array_size == num_server_aliases) { + server_aliases = talloc_realloc(NULL, server_aliases, + struct full_alias, array_size + 100); + if (server_aliases == NULL) { + smb_panic("talloc_realloc failed"); + } + } server_aliases[num_server_aliases] = *alias; num_server_aliases += 1; @@ -4634,7 +4649,7 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd, sid_compose(&alias.sid, domain_sid, groups->entries[i].idx); - push_alias(mem_ctx, &alias); + push_alias(&alias); } } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); @@ -5264,6 +5279,7 @@ static NTSTATUS rpc_share_allowedusers_internals(struct net_context *c, free_user_token(&tokens[i].token); } SAFE_FREE(tokens); + TALLOC_FREE(server_aliases); return nt_status; } -- Samba Shared Repository