s3:dcerpc_ep: make ep_register() more tolerant regarding the passes binding vector
authorStefan Metzmacher <metze@samba.org>
Thu, 30 Jan 2014 08:51:09 +0000 (09:51 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 11 Feb 2014 15:20:28 +0000 (16:20 +0100)
We should take a copy and set the abstract syntax to from the given interface
before we construct the tower.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/librpc/rpc/dcerpc_ep.c

index d0c264a5a84b5ce7e30ef7f75523ad9db7ada699..99a88c425125c09b2caf3b37041dd28c27183c46 100644 (file)
@@ -398,9 +398,17 @@ static NTSTATUS ep_register(TALLOC_CTX *mem_ctx,
        entries = talloc_array(tmp_ctx, struct epm_entry_t, num_ents);
 
        for (i = 0; i < num_ents; i++) {
-               struct dcerpc_binding *map_binding = bind_vec->bindings[i];
+               struct dcerpc_binding *map_binding;
                struct epm_twr_t *map_tower;
 
+               map_binding = dcerpc_binding_dup(entries, bind_vec->bindings[i]);
+               if (map_binding == NULL) {
+                       status = NT_STATUS_NO_MEMORY;
+                       goto done;
+               }
+
+               map_binding->object = iface->syntax_id;
+
                map_tower = talloc_zero(entries, struct epm_twr_t);
                if (map_tower == NULL) {
                        status = NT_STATUS_NO_MEMORY;
@@ -414,6 +422,8 @@ static NTSTATUS ep_register(TALLOC_CTX *mem_ctx,
                        goto done;
                }
 
+               TALLOC_FREE(map_binding);
+
                entries[i].tower = map_tower;
                if (annotation == NULL) {
                        entries[i].annotation = talloc_strdup(entries, "");