summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-26 03:36:17 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-26 03:36:17 +0000
commitfffd741a7a00b07c85eec254b8cc7c2fe40cef18 (patch)
tree15653de92c489d6ae9ba5ce490965b7ea9a285b8 /source4/torture
parentc123c8454142d17d2884ae9dd951b7f2a0b1a343 (diff)
downloadsamba-fffd741a7a00b07c85eec254b8cc7c2fe40cef18.tar.gz
samba-fffd741a7a00b07c85eec254b8cc7c2fe40cef18.tar.bz2
samba-fffd741a7a00b07c85eec254b8cc7c2fe40cef18.zip
added auto-determination of the DCERPC over TCP port number by asking
the servers endpoint mapper (This used to be commit 4abf5376b00f580eb69196e55a792cc7eb4c9880)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/torture.c20
1 files changed, 13 insertions, 7 deletions
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;