s4:librpc/rpc: use dcerpc_binding_dup() before modifying the given binding
authorStefan Metzmacher <metze@samba.org>
Wed, 12 Feb 2014 11:11:51 +0000 (12:11 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 13 Feb 2014 10:54:13 +0000 (11:54 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source4/librpc/rpc/dcerpc.h
source4/librpc/rpc/dcerpc_connect.c

index b4b2913cce65cb4a62fec07abcc2e25e425fd9b5..a28c3c4a93c3e6ac64f6728d5329c08eb9d8d431 100644 (file)
@@ -168,7 +168,7 @@ NTSTATUS dcerpc_secondary_connection_recv(struct composite_context *c,
                                          struct dcerpc_pipe **p2);
 
 struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent_ctx,
-                                                    struct dcerpc_binding *binding,
+                                                    const struct dcerpc_binding *binding,
                                                     const struct ndr_interface_table *table,
                                                     struct cli_credentials *credentials,
                                                     struct tevent_context *ev,
@@ -179,7 +179,7 @@ NTSTATUS dcerpc_pipe_connect_b_recv(struct composite_context *c, TALLOC_CTX *mem
 
 NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
                               struct dcerpc_pipe **pp,
-                              struct dcerpc_binding *binding,
+                              const struct dcerpc_binding *binding,
                               const struct ndr_interface_table *table,
                               struct cli_credentials *credentials,
                               struct tevent_context *ev,
index 15a3c3beb8be87b3bbedf8134160fdb00f4fc47b..f3983123614b9e3fe687326d9a2651d42dd6a552 100644 (file)
@@ -799,7 +799,7 @@ static void dcerpc_connect_timeout_handler(struct tevent_context *ev, struct tev
   specified binding structure to determine the endpoint and options
 */
 _PUBLIC_ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent_ctx,
-                                                    struct dcerpc_binding *binding,
+                                                    const struct dcerpc_binding *binding,
                                                     const struct ndr_interface_table *table,
                                                     struct cli_credentials *credentials,
                                                     struct tevent_context *ev,
@@ -826,7 +826,8 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent
                s->pipe->conn->packet_log_dir = lpcfg_lock_directory(lp_ctx);
 
        /* store parameters in state structure */
-       s->binding      = binding;
+       s->binding      = dcerpc_binding_dup(s, binding);
+       if (composite_nomem(s->binding, c)) return c;
        s->table        = table;
        s->credentials  = credentials;
        s->lp_ctx       = lp_ctx;
@@ -896,7 +897,7 @@ _PUBLIC_ NTSTATUS dcerpc_pipe_connect_b_recv(struct composite_context *c, TALLOC
 */
 _PUBLIC_ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
                               struct dcerpc_pipe **pp,
-                              struct dcerpc_binding *binding,
+                              const struct dcerpc_binding *binding,
                               const struct ndr_interface_table *table,
                               struct cli_credentials *credentials,
                               struct tevent_context *ev,