From fffd741a7a00b07c85eec254b8cc7c2fe40cef18 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 26 Nov 2003 03:36:17 +0000 Subject: added auto-determination of the DCERPC over TCP port number by asking the servers endpoint mapper (This used to be commit 4abf5376b00f580eb69196e55a792cc7eb4c9880) --- source4/torture/torture.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 11b27f12eb..18d339d65e 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -138,11 +138,21 @@ static NTSTATUS torture_rpc_tcp(struct dcerpc_pipe **p, { NTSTATUS status; char *host = lp_parm_string(-1, "torture", "host"); - const char *port = lp_parm_string(-1, "torture", "share"); + const char *port_str = lp_parm_string(-1, "torture", "share"); + uint32 port = atoi(port_str); + + if (port == 0) { + status = dcerpc_epm_map_tcp_port(host, + pipe_uuid, pipe_version, + &port); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + } - DEBUG(2,("Connecting to dcerpc server %s:%s\n", host, port)); + DEBUG(2,("Connecting to dcerpc server %s:%u\n", host, port)); - status = dcerpc_pipe_open_tcp(p, host, atoi(port)); + status = dcerpc_pipe_open_tcp(p, host, port); if (!NT_STATUS_IS_OK(status)) { printf("Open of pipe '%s' failed with error (%s)\n", pipe_name, nt_errstr(status)); @@ -202,14 +212,10 @@ NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p, } /* bind to the pipe, using the uuid as the key */ -#if 1 status = dcerpc_bind_auth_ntlm(*p, pipe_uuid, pipe_version, lp_workgroup(), lp_parm_string(-1, "torture", "username"), lp_parm_string(-1, "torture", "password")); -#else - status = dcerpc_bind_auth_none(*p, pipe_uuid, pipe_version); -#endif if (!NT_STATUS_IS_OK(status)) { dcerpc_pipe_close(*p); return status; -- cgit