Author: abartlet Date: 2005-07-28 04:46:11 +0000 (Thu, 28 Jul 2005) New Revision: 8820
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8820 Log: Push this common block of code into the caller. Use talloc_steal() rather than talloc_reference(). Andrew Bartlett Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c Changeset: Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c =================================================================== --- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c 2005-07-28 04:09:11 UTC (rev 8819) +++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c 2005-07-28 04:46:11 UTC (rev 8820) @@ -1022,19 +1022,6 @@ return status; } - /* Look up identifier using the epmapper */ - if (!binding->endpoint) { - status = dcerpc_epm_map_binding(tmp_ctx, binding, - pipe_uuid, pipe_version, - p->conn->event_ctx); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("Failed to map DCERPC/TCP NCACN_NP pipe for '%s' - %s\n", - pipe_uuid, nt_errstr(status))); - return status; - } - DEBUG(2,("Mapped to DCERPC/NP pipe %s\n", binding->endpoint)); - } - pipe_name = binding->endpoint; status = dcerpc_pipe_open_smb(p->conn, cli->tree, pipe_name); @@ -1056,19 +1043,6 @@ { NTSTATUS status; - /* Look up identifier using the epmapper */ - if (!binding->endpoint) { - status = dcerpc_epm_map_binding(tmp_ctx, binding, - pipe_uuid, pipe_version, - p->conn->event_ctx); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("Failed to map DCERPC/TCP NCALRPC identifier for '%s' - %s\n", - pipe_uuid, nt_errstr(status))); - return status; - } - DEBUG(2,("Mapped to DCERPC/LRPC identifier %s\n", binding->endpoint)); - } - status = dcerpc_pipe_open_pipe(p->conn, binding->endpoint); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to open ncalrpc pipe '%s' - %s\n", @@ -1118,18 +1092,6 @@ NTSTATUS status; uint32_t port = 0; - if (!binding->endpoint) { - status = dcerpc_epm_map_binding(tmp_ctx, binding, - pipe_uuid, pipe_version, - p->conn->event_ctx); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("Failed to map DCERPC/TCP port for '%s' - %s\n", - pipe_uuid, nt_errstr(status))); - return status; - } - DEBUG(2,("Mapped to DCERPC/TCP port %s\n", binding->endpoint)); - } - port = atoi(binding->endpoint); status = dcerpc_pipe_open_tcp(p->conn, binding->host, port); @@ -1168,6 +1130,23 @@ switch (binding->transport) { case NCACN_NP: + case NCACN_IP_TCP: + case NCALRPC: + if (!binding->endpoint) { + status = dcerpc_epm_map_binding(tmp_ctx, binding, + pipe_uuid, pipe_version, + p->conn->event_ctx); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Failed to map DCERPC endpoint for '%s' - %s\n", + pipe_uuid, nt_errstr(status))); + return status; + } + DEBUG(2,("Mapped to DCERPC endpoint %s\n", binding->endpoint)); + } + } + + switch (binding->transport) { + case NCACN_NP: status = dcerpc_pipe_connect_ncacn_np(tmp_ctx, p, binding, pipe_uuid, pipe_version, credentials); break; @@ -1237,7 +1216,7 @@ credentials, ev); if (NT_STATUS_IS_OK(status)) { - *pp = talloc_reference(parent_ctx, *pp); + *pp = talloc_steal(parent_ctx, *pp); } talloc_free(tmp_ctx);