s4:rpc_server/epmapper: make use of dcerpc_binding_dup() in build_ep_list()
authorStefan Metzmacher <metze@samba.org>
Tue, 4 Feb 2014 01:33:03 +0000 (02:33 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 11 Feb 2014 17:30:55 +0000 (18:30 +0100)
We should not alter the callers binding.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Feb 11 18:30:55 CET 2014 on sn-devel-104

source4/rpc_server/epmapper/rpc_epmapper.c

index 371a3b5dd5313a6293875597a85f68e3d60a7ad4..58cdc0f9a2ee09bd0b77f5be06ea5273be8a5a49 100644 (file)
@@ -50,9 +50,10 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx,
 
        for (d=endpoint_list; d; d=d->next) {
                struct dcesrv_if_list *iface;
-               struct dcerpc_binding *description;
 
                for (iface=d->interface_list;iface;iface=iface->next) {
+                       struct dcerpc_binding *description;
+
                        (*eps) = talloc_realloc(mem_ctx, 
                                                  *eps, 
                                                  struct dcesrv_ep_iface,
@@ -62,12 +63,18 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx,
                        }
                        (*eps)[total].name = iface->iface.name;
 
-                       description = d->ep_description;
+                       description = dcerpc_binding_dup(*eps, d->ep_description);
+                       if (description == NULL) {
+                               return 0;
+                       }
+
                        description->object = iface->iface.syntax_id;
 
                        status = dcerpc_binding_build_tower(*eps, description, &(*eps)[total].ep);
-                       if (NT_STATUS_IS_ERR(status)) {
-                               DEBUG(1, ("Unable to build tower for %s\n", iface->iface.name));
+                       TALLOC_FREE(description);
+                       if (!NT_STATUS_IS_OK(status)) {
+                               DEBUG(1, ("Unable to build tower for %s - %s\n",
+                                         iface->iface.name, nt_errstr(status)));
                                continue;
                        }
                        total++;