diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-10-13 13:01:48 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:21:00 -0500 |
commit | 57b8c5cd227d33b2eec34ed503b0b14c04344a87 (patch) | |
tree | ce7f660463f5273f3ff89eee4670216b1fc153ce /source4/librpc/rpc/dcerpc_connect.c | |
parent | 541339fbd2d0d4154644c7a843adf56ec382afc4 (diff) | |
download | samba-57b8c5cd227d33b2eec34ed503b0b14c04344a87.tar.gz samba-57b8c5cd227d33b2eec34ed503b0b14c04344a87.tar.bz2 samba-57b8c5cd227d33b2eec34ed503b0b14c04344a87.zip |
r19266: Add a target_hostname element to the binding struct. This allows us
to perform a lookup once, resolve the name to an IP, while still
communicating the full name to the lower layers, for kerberos etc.
This fixes 'net samdump', which was failing due to the schannel target
name being *smbserver.
Andrew Bartlett
(This used to be commit 0546f487f4cc99b5549dc1e457ea243d4bd66333)
Diffstat (limited to 'source4/librpc/rpc/dcerpc_connect.c')
-rw-r--r-- | source4/librpc/rpc/dcerpc_connect.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index fba0ae0c02..c35da23f58 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -111,14 +111,11 @@ struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CTX *mem_ remote rpc server */ conn->in.dest_host = s->io.binding->host; conn->in.port = 0; - conn->in.called_name = strupper_talloc(mem_ctx, s->io.binding->host); + conn->in.called_name = s->io.binding->target_hostname; conn->in.service = "IPC$"; conn->in.service_type = NULL; conn->in.workgroup = lp_workgroup(); - /* verify if called_name has been allocated when uppercasing */ - if (composite_nomem(conn->in.called_name, c)) return c; - /* * provide proper credentials - user supplied, but allow a * fallback to anonymous if this is an schannel connection @@ -281,6 +278,7 @@ NTSTATUS dcerpc_pipe_connect_ncacn_np_smb2(TALLOC_CTX *mem_ctx, struct pipe_ip_tcp_state { struct dcerpc_pipe_connect io; const char *host; + const char *target_hostname; uint32_t port; }; @@ -321,12 +319,15 @@ struct composite_context* dcerpc_pipe_connect_ncacn_ip_tcp_send(TALLOC_CTX *mem_ c->private_data = s; /* store input parameters in state structure */ - s->io = *io; - s->host = talloc_strdup(c, io->binding->host); - s->port = atoi(io->binding->endpoint); /* port number is a binding endpoint here */ + s->io = *io; + s->host = talloc_reference(c, io->binding->host); + s->target_hostname = talloc_reference(c, io->binding->target_hostname); + /* port number is a binding endpoint here */ + s->port = atoi(io->binding->endpoint); /* send pipe open request on tcp/ip */ - pipe_req = dcerpc_pipe_open_tcp_send(s->io.pipe->conn, s->host, s->port); + pipe_req = dcerpc_pipe_open_tcp_send(s->io.pipe->conn, s->host, s->target_hostname, + s->port); composite_continue(c, pipe_req, continue_pipe_open_ncacn_ip_tcp, c); return c; } @@ -822,10 +823,11 @@ NTSTATUS dcerpc_pipe_connect_b_recv(struct composite_context *c, TALLOC_CTX *mem status = composite_wait(c); - s = talloc_get_type(c->private_data, struct pipe_connect_state); - talloc_steal(mem_ctx, s->pipe); - *p = s->pipe; - + if (NT_STATUS_IS_OK(status)) { + s = talloc_get_type(c->private_data, struct pipe_connect_state); + talloc_steal(mem_ctx, s->pipe); + *p = s->pipe; + } talloc_free(c); return status; } @@ -864,7 +866,6 @@ static void continue_pipe_connect_b(struct composite_context *ctx); The string is to be parsed to a binding structure first. */ struct composite_context* dcerpc_pipe_connect_send(TALLOC_CTX *parent_ctx, - struct dcerpc_pipe **pp, const char *binding, const struct dcerpc_interface_table *table, struct cli_credentials *credentials, @@ -966,7 +967,8 @@ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct event_context *ev) { struct composite_context *c; - c = dcerpc_pipe_connect_send(parent_ctx, pp, binding, table, + c = dcerpc_pipe_connect_send(parent_ctx, binding, + table, credentials, ev); return dcerpc_pipe_connect_recv(c, parent_ctx, pp); } @@ -1032,6 +1034,7 @@ struct composite_context* dcerpc_secondary_connection_send(struct dcerpc_pipe *p case NCACN_IP_TCP: pipe_tcp_req = dcerpc_pipe_open_tcp_send(s->pipe2->conn, s->binding->host, + s->binding->target_hostname, atoi(s->binding->endpoint)); composite_continue(c, pipe_tcp_req, continue_open_tcp, c); return c; |