summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-25 11:13:26 +0100
committerGünther Deschner <gd@samba.org>2014-02-11 16:20:32 +0100
commit4340590ae90956c5c73141ffe56e499fdd14f376 (patch)
tree7c6ad491ceb9c2b7143610635c0df04b53bc1685
parent4cf691ce1fb2af5413b2bb16afd4b4be0a8e3f35 (diff)
downloadsamba-4340590ae90956c5c73141ffe56e499fdd14f376.tar.gz
samba-4340590ae90956c5c73141ffe56e499fdd14f376.tar.xz
samba-4340590ae90956c5c73141ffe56e499fdd14f376.zip
s4:librpc/rpc: fix memory hierachie in dcerpc_epm_map_binding_send()
We should allocate on 's' the internal state, not on the callers mem_ctx. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
-rw-r--r--source4/librpc/rpc/dcerpc_util.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 9a9dbc502d..e43e4a0f00 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -247,11 +247,6 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
s->binding = binding;
s->table = table;
- /* anonymous credentials for rpc connection used to get endpoint mapping */
- anon_creds = cli_credentials_init(mem_ctx);
- if (composite_nomem(anon_creds, c)) return c;
- cli_credentials_set_anonymous(anon_creds);
-
/*
First, check if there is a default endpoint specified in the IDL
*/
@@ -291,7 +286,11 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
}
}
- epmapper_binding = talloc_zero(c, struct dcerpc_binding);
+ /* anonymous credentials for rpc connection used to get endpoint mapping */
+ anon_creds = cli_credentials_init_anon(s);
+ if (composite_nomem(anon_creds, c)) return c;
+
+ epmapper_binding = talloc_zero(s, struct dcerpc_binding);
if (composite_nomem(epmapper_binding, c)) return c;
/* basic endpoint mapping data */
@@ -311,7 +310,7 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
epmapper_binding->endpoint = NULL;
/* initiate rpc pipe connection */
- pipe_connect_req = dcerpc_pipe_connect_b_send(c, epmapper_binding,
+ pipe_connect_req = dcerpc_pipe_connect_b_send(s, epmapper_binding,
&ndr_table_epmapper,
anon_creds, c->event_ctx,
lp_ctx);