summaryrefslogtreecommitdiff
path: root/source4/torture/torture.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-24 13:19:00 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-24 13:19:00 +0000
commitf4e485117a0dea627addfb8518e6517c7104fd9e (patch)
tree6caaaa42897ddc169de7d23990725cf7af2a6bdb /source4/torture/torture.c
parent7befc0648e4366980b7efdf31cc946ea11de5101 (diff)
downloadsamba-f4e485117a0dea627addfb8518e6517c7104fd9e.tar.gz
samba-f4e485117a0dea627addfb8518e6517c7104fd9e.tar.bz2
samba-f4e485117a0dea627addfb8518e6517c7104fd9e.zip
* fixed byte order in epmapper parsing
* allow rpc transport to be specified on command line in smbtorture (This used to be commit 8a82050fd6f45bcdb31c2c365eaed5fc12599e4f)
Diffstat (limited to 'source4/torture/torture.c')
-rw-r--r--source4/torture/torture.c94
1 files changed, 65 insertions, 29 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 73373d944c..22798ed236 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -131,23 +131,22 @@ BOOL torture_close_connection(struct cli_state *c)
}
/* open a rpc connection to a named pipe */
-NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p,
+static NTSTATUS torture_rpc_tcp(struct dcerpc_pipe **p,
const char *pipe_name,
const char *pipe_uuid,
uint32 pipe_version)
{
- struct cli_state *cli;
NTSTATUS status;
+ char *host = lp_parm_string(-1, "torture", "host");
+ const char *port = lp_parm_string(-1, "torture", "share");
- if (!torture_open_connection(&cli)) {
- return NT_STATUS_UNSUCCESSFUL;
- }
+ DEBUG(2,("Connecting to dcerpc server %s:%s\n", host, port));
- status = dcerpc_pipe_open_smb(p, cli->tree, pipe_name, pipe_uuid, pipe_version);
+ status = dcerpc_pipe_open_tcp(p, host, atoi(port),
+ pipe_uuid, pipe_version);
if (!NT_STATUS_IS_OK(status)) {
printf("Open of pipe '%s' failed with error (%s)\n",
pipe_name, nt_errstr(status));
- torture_close_connection(cli);
return status;
}
@@ -157,21 +156,35 @@ NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p,
return status;
}
+
/* open a rpc connection to a named pipe */
-NTSTATUS torture_rpc_tcp(struct dcerpc_pipe **p,
- const char *pipe_name,
- const char *pipe_uuid,
- uint32 pipe_version)
+NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p,
+ const char *pipe_name,
+ const char *pipe_uuid,
+ uint32 pipe_version)
{
+ struct cli_state *cli;
NTSTATUS status;
+ char *transport = lp_parm_string(-1, "torture", "transport");
- status = dcerpc_pipe_open_tcp(p,
- lp_parm_string(-1, "torture", "host"),
- lp_parm_int(-1, "torture", "share"),
- pipe_uuid, pipe_version);
+ if (strcmp(transport, "ncacn_ip_tcp") == 0) {
+ return torture_rpc_tcp(p, pipe_name, pipe_uuid, pipe_version);
+ }
+
+ if (strcmp(transport, "ncacn_np") != 0) {
+ printf("Unsupported RPC transport '%s'\n", transport);
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ if (!torture_open_connection(&cli)) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ status = dcerpc_pipe_open_smb(p, cli->tree, pipe_name, pipe_uuid, pipe_version);
if (!NT_STATUS_IS_OK(status)) {
printf("Open of pipe '%s' failed with error (%s)\n",
pipe_name, nt_errstr(status));
+ torture_close_connection(cli);
return status;
}
@@ -4148,27 +4161,50 @@ static void usage(void)
for(p = argv[1]; *p; p++)
if(*p == '\\')
*p = '/';
-
- if (strncmp(argv[1], "//", 2)) {
- usage();
- }
- host = strdup(&argv[1][2]);
- p = strchr_m(&host[2],'/');
- if (!p) {
- usage();
+
+ /* see if its a RPC transport specifier */
+ if (strncmp(argv[1], "ncacn", 5) == 0) {
+ char *transport = strdup(argv[1]);
+ p = strchr_m(transport, ':');
+ if (!p) usage();
+ *p = 0;
+ host = p+1;
+ p = strchr_m(host, ':');
+ if (p) {
+ *p = 0;
+ share = p+1;
+ lp_set_cmdline("torture:share", share);
+ } else {
+ share = "";
+ lp_set_cmdline("torture:share", share);
+ }
+ lp_set_cmdline("torture:host", host);
+ lp_set_cmdline("torture:transport", transport);
+ } else {
+ if (strncmp(argv[1], "//", 2)) {
+ usage();
+ }
+
+ host = strdup(&argv[1][2]);
+ p = strchr_m(&host[2],'/');
+ if (!p) {
+ usage();
+ }
+ *p = 0;
+ share = strdup(p+1);
+
+ lp_set_cmdline("torture:host", host);
+ lp_set_cmdline("torture:share", share);
+ lp_set_cmdline("torture:password", "");
+ lp_set_cmdline("torture:transport", "ncacn_np");
}
- *p = 0;
- share = strdup(p+1);
if (getenv("LOGNAME")) {
username = strdup(getenv("LOGNAME"));
}
-
- lp_set_cmdline("torture:host", host);
- lp_set_cmdline("torture:share", share);
lp_set_cmdline("torture:username", username);
- lp_set_cmdline("torture:password", "");
+
argc--;
argv++;