summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-07-28 04:46:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:30:08 -0500
commita97f6670288097adc7a924a93bb1078062ceee32 (patch)
tree6d0b8ee7ab1ebb1f279a4d8cb30994f13117cee4 /source4
parentba759b4c86efbf386bc20c1a10ff1996715af132 (diff)
downloadsamba-a97f6670288097adc7a924a93bb1078062ceee32.tar.gz
samba-a97f6670288097adc7a924a93bb1078062ceee32.tar.bz2
samba-a97f6670288097adc7a924a93bb1078062ceee32.zip
r8820: Push this common block of code into the caller.
Use talloc_steal() rather than talloc_reference(). Andrew Bartlett (This used to be commit 8774f971f3926c5c37aad1e8dfeafa394de87d63)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/rpc/dcerpc_util.c57
1 files changed, 18 insertions, 39 deletions
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index efcd36f24b..40f2fda3a4 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -1022,19 +1022,6 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(TALLOC_CTX *tmp_ctx,
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 @@ static NTSTATUS dcerpc_pipe_connect_ncalrpc(TALLOC_CTX *tmp_ctx,
{
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 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp(TALLOC_CTX *tmp_ctx,
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 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
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 @@ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx,
credentials, ev);
if (NT_STATUS_IS_OK(status)) {
- *pp = talloc_reference(parent_ctx, *pp);
+ *pp = talloc_steal(parent_ctx, *pp);
}
talloc_free(tmp_ctx);