[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Mon Nov 26 09:37:07 MST 2012


The branch, master has been updated
       via  b11ba24 s3-rpc_client: try to use socket_addr if available in rpc_pipe_open_tcp() (bug #9426)
      from  8336061 s4:torture/rpc/handles: try to make all assoc_group tests less flakey

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b11ba248837ae9bf1df1c5ae1ca1768d57e582bb
Author: Günther Deschner <gd at samba.org>
Date:   Fri Nov 23 18:15:30 2012 +0100

    s3-rpc_client: try to use socket_addr if available in rpc_pipe_open_tcp() (bug #9426)
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Mon Nov 26 17:36:20 CET 2012 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/rpc_client/cli_pipe.c  |   23 ++++++++++++++++-------
 source3/rpc_client/cli_pipe.h  |    1 +
 source3/torture/rpc_open_tcp.c |    3 ++-
 3 files changed, 19 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index f8c7b24..61e6cce 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -2420,6 +2420,7 @@ NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
  * Create an rpc pipe client struct, connecting to a tcp port.
  */
 static NTSTATUS rpc_pipe_open_tcp_port(TALLOC_CTX *mem_ctx, const char *host,
+				       const struct sockaddr_storage *ss_addr,
 				       uint16_t port,
 				       const struct ndr_syntax_id *abstract_syntax,
 				       struct rpc_pipe_client **presult)
@@ -2448,9 +2449,13 @@ static NTSTATUS rpc_pipe_open_tcp_port(TALLOC_CTX *mem_ctx, const char *host,
 	result->max_xmit_frag = RPC_MAX_PDU_FRAG_LEN;
 	result->max_recv_frag = RPC_MAX_PDU_FRAG_LEN;
 
-	if (!resolve_name(host, &addr, NBT_NAME_SERVER, false)) {
-		status = NT_STATUS_NOT_FOUND;
-		goto fail;
+	if (ss_addr == NULL) {
+		if (!resolve_name(host, &addr, NBT_NAME_SERVER, false)) {
+			status = NT_STATUS_NOT_FOUND;
+			goto fail;
+		}
+	} else {
+		addr = *ss_addr;
 	}
 
 	status = open_socket_out(&addr, port, 60*1000, &fd);
@@ -2487,6 +2492,7 @@ static NTSTATUS rpc_pipe_open_tcp_port(TALLOC_CTX *mem_ctx, const char *host,
  * target host.
  */
 static NTSTATUS rpc_pipe_get_tcp_port(const char *host,
+				      const struct sockaddr_storage *addr,
 				      const struct ndr_syntax_id *abstract_syntax,
 				      uint16_t *pport)
 {
@@ -2517,7 +2523,7 @@ static NTSTATUS rpc_pipe_get_tcp_port(const char *host,
 	}
 
 	/* open the connection to the endpoint mapper */
-	status = rpc_pipe_open_tcp_port(tmp_ctx, host, 135,
+	status = rpc_pipe_open_tcp_port(tmp_ctx, host, addr, 135,
 					&ndr_table_epmapper.syntax_id,
 					&epm_pipe);
 
@@ -2631,18 +2637,19 @@ done:
  * host.
  */
 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
+			   const struct sockaddr_storage *addr,
 			   const struct ndr_syntax_id *abstract_syntax,
 			   struct rpc_pipe_client **presult)
 {
 	NTSTATUS status;
 	uint16_t port = 0;
 
-	status = rpc_pipe_get_tcp_port(host, abstract_syntax, &port);
+	status = rpc_pipe_get_tcp_port(host, addr, abstract_syntax, &port);
 	if (!NT_STATUS_IS_OK(status)) {
 		return status;
 	}
 
-	return rpc_pipe_open_tcp_port(mem_ctx, host, port,
+	return rpc_pipe_open_tcp_port(mem_ctx, host, addr, port,
 					abstract_syntax, presult);
 }
 
@@ -2816,7 +2823,9 @@ static NTSTATUS cli_rpc_pipe_open(struct cli_state *cli,
 {
 	switch (transport) {
 	case NCACN_IP_TCP:
-		return rpc_pipe_open_tcp(NULL, smbXcli_conn_remote_name(cli->conn),
+		return rpc_pipe_open_tcp(NULL,
+					 smbXcli_conn_remote_name(cli->conn),
+					 smbXcli_conn_remote_sockaddr(cli->conn),
 					 interface, presult);
 	case NCACN_NP:
 		return rpc_pipe_open_np(cli, interface, presult);
diff --git a/source3/rpc_client/cli_pipe.h b/source3/rpc_client/cli_pipe.h
index 3984cf0..343bd0a 100644
--- a/source3/rpc_client/cli_pipe.h
+++ b/source3/rpc_client/cli_pipe.h
@@ -66,6 +66,7 @@ NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx,
 
 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx,
 			   const char *host,
+			   const struct sockaddr_storage *ss_addr,
 			   const struct ndr_syntax_id *abstract_syntax,
 			   struct rpc_pipe_client **presult);
 
diff --git a/source3/torture/rpc_open_tcp.c b/source3/torture/rpc_open_tcp.c
index 074b186..d29f4cf 100644
--- a/source3/torture/rpc_open_tcp.c
+++ b/source3/torture/rpc_open_tcp.c
@@ -94,7 +94,8 @@ int main(int argc, const char **argv)
 		return -1;
 	}
 
-	status = rpc_pipe_open_tcp(mem_ctx, argv[2], &((*table)->syntax_id),
+	status = rpc_pipe_open_tcp(mem_ctx, argv[2], NULL,
+				   &((*table)->syntax_id),
 				   &rpc_pipe);
 	if (!NT_STATUS_IS_OK(status)) {
 		d_printf("ERROR calling rpc_pipe_open_tcp(): %s\n",


-- 
Samba Shared Repository


More information about the samba-cvs mailing list