int torture_failures=1;
static int procnum; /* records process count number when forking */
static struct cli_state *current_cli;
-static char *randomfname;
static BOOL use_oplocks;
static BOOL use_level_II_oplocks;
static const char *client_txt = "client_oplocks.txt";
return ret;
}
+/* open a rpc connection to a named pipe */
+static NTSTATUS torture_rpc_tcp(struct dcerpc_pipe **p,
+ const char *pipe_name,
+ const char *pipe_uuid,
+ uint32 pipe_version)
+{
+ NTSTATUS status;
+ char *host = lp_parm_string(-1, "torture", "host");
+ const char *port = lp_parm_string(-1, "torture", "share");
+
+ DEBUG(2,("Connecting to dcerpc server %s:%s\n", host, port));
+
+ status = dcerpc_pipe_open_tcp(p, host, atoi(port));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Open of pipe '%s' failed with error (%s)\n",
+ pipe_name, nt_errstr(status));
+ return status;
+ }
+
+ /* always do NDR validation in smbtorture */
+ (*p)->flags |= DCERPC_DEBUG_VALIDATE_BOTH;
+
+ /* bind to the pipe, using the uuid as the key */
+ status = dcerpc_bind_auth_ntlm(*p, pipe_uuid, pipe_version,
+ lp_workgroup(),
+ lp_parm_string(-1, "torture", "username"),
+ lp_parm_string(-1, "torture", "password"));
+ if (!NT_STATUS_IS_OK(status)) {
+ dcerpc_pipe_close(*p);
+ return status;
+ }
+
+ return status;
+}
+
+
/* open a rpc connection to a named pipe */
NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p,
const char *pipe_name,
{
struct cli_state *cli;
NTSTATUS status;
+ char *transport = lp_parm_string(-1, "torture", "transport");
+
+ 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 (! *lp_parm_string(-1, "torture", "share")) {
+ lp_set_cmdline("torture:share", "ipc$");
+ }
if (!torture_open_connection(&cli)) {
return NT_STATUS_UNSUCCESSFUL;
}
- if (!(*p = dcerpc_pipe_init(cli->tree))) {
- return NT_STATUS_NO_MEMORY;
- }
-
- status = dcerpc_pipe_open_smb(*p, pipe_name, pipe_uuid, pipe_version);
+ status = dcerpc_pipe_open_smb(p, cli->tree, pipe_name);
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;
}
+
+ /* 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;
+ }
+
+ /* always do NDR validation in smbtorture */
+ (*p)->flags |= DCERPC_DEBUG_VALIDATE_BOTH;
return status;
}
/* close a rpc connection to a named pipe */
NTSTATUS torture_rpc_close(struct dcerpc_pipe *p)
{
- union smb_close io;
- NTSTATUS status;
-
- io.close.level = RAW_CLOSE_CLOSE;
- io.close.in.fnum = p->fnum;
- io.close.in.write_time = 0;
- status = smb_raw_close(p->tree, &io);
-
dcerpc_pipe_close(p);
-
- return status;
+ return NT_STATUS_OK;
}
return ret;
}
-static BOOL rw_torture3(struct cli_state *c, char *lockfname)
+static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
{
int fnum = -1;
unsigned int i = 0;
cli = current_cli;
- printf("run_readwritemulti: fname %s\n", randomfname);
- test = rw_torture3(cli, randomfname);
+ test = rw_torture3(cli, "\\multitest.txt");
if (!torture_close_connection(cli)) {
test = False;
{"RPC-SAMR", torture_rpc_samr, 0},
{"RPC-WKSSVC", torture_rpc_wkssvc, 0},
{"RPC-SRVSVC", torture_rpc_srvsvc, 0},
+ {"RPC-ATSVC", torture_rpc_atsvc, 0},
+ {"RPC-EVENTLOG", torture_rpc_eventlog, 0},
+ {"RPC-EPMAPPER", torture_rpc_epmapper, 0},
+ {"RPC-WINREG", torture_rpc_winreg, 0},
+ {"RPC-MGMT", torture_rpc_mgmt, 0},
{NULL, NULL, 0}};
}
for (i=0;torture_ops[i].name;i++) {
- asprintf(&randomfname, "\\XX%x",
- (unsigned)random());
-
if (gen_fnmatch(name, torture_ops[i].name) == 0) {
double t;
matched = True;
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++;