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";
static BOOL use_kerberos;
-static BOOL bypass_io;
BOOL torture_showall = False;
if (use_kerberos)
flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
-
+
status = cli_full_connection(c, lp_netbios_name(),
host, NULL,
share, "?????",
- username, lp_workgroup(),
+ username, username[0]?lp_workgroup():"",
password, flags, &retry);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open connection - %s\n", nt_errstr(status));
}
+/* open a rpc connection to a named pipe */
+NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p,
+ const char *pipe_name,
+ const char *pipe_uuid,
+ uint32 pipe_version)
+{
+ NTSTATUS status;
+ char *binding = lp_parm_string(-1, "torture", "binding");
+
+ if (!binding) {
+ printf("You must specify a ncacn binding string\n");
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ status = dcerpc_pipe_connect(p, binding, pipe_uuid, pipe_version,
+ lp_workgroup(),
+ lp_parm_string(-1, "torture", "username"),
+ lp_parm_string(-1, "torture", "password"));
+
+ return status;
+}
+
+/* close a rpc connection to a named pipe */
+NTSTATUS torture_rpc_close(struct dcerpc_pipe *p)
+{
+ dcerpc_pipe_close(p);
+ return NT_STATUS_OK;
+}
+
+
/* check if the server produced the expected error code */
static BOOL check_error(int line, struct cli_state *c,
uint8 eclass, uint32 ecode, NTSTATUS nterr)
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;
static BOOL run_pipe_number(int dummy)
{
struct cli_state *cli1;
- const char *pipe_name = "\\SPOOLSS";
+ const char *pipe_name = "\\WKSSVC";
int fnum;
int num_pipes = 0;
uint16 device, function;
int fnum;
const char *fname = "\\ioctl.dat";
- DATA_BLOB blob;
NTSTATUS status;
- struct smb_ioctl parms;
+ union smb_ioctl parms;
TALLOC_CTX *mem_ctx;
if (!torture_open_connection(&cli)) {
return False;
}
- parms.in.request = IOCTL_QUERY_JOB_INFO;
+ parms.ioctl.level = RAW_IOCTL_IOCTL;
+ parms.ioctl.in.request = IOCTL_QUERY_JOB_INFO;
status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
printf("ioctl job info: %s\n", cli_errstr(cli));
for (device=0;device<0x100;device++) {
printf("testing device=0x%x\n", device);
for (function=0;function<0x100;function++) {
- parms.in.request = (device << 16) | function;
+ parms.ioctl.in.request = (device << 16) | function;
status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
if (NT_STATUS_IS_OK(status)) {
printf("ioctl device=0x%x function=0x%x OK : %d bytes\n",
- device, function, blob.length);
- data_blob_free(&parms.out.blob);
+ device, function, parms.ioctl.out.blob.length);
}
}
}
return ret;
}
-
-
-
static BOOL run_dirtest1(int dummy)
{
int i;
return True;
}
+static void sigcont(void)
+{
+}
static double create_procs(BOOL (*fn)(int), BOOL *result)
{
volatile BOOL *child_status_out;
int synccount;
int tries = 8;
+ double start_time_limit = 10 + (nprocs * 1.5);
synccount = 0;
+ signal(SIGCONT, sigcont);
+
child_status = (volatile pid_t *)shm_setup(sizeof(pid_t)*nprocs);
if (!child_status) {
printf("Failed to setup shared memory\n");
printf("pid %d failed to start\n", (int)getpid());
_exit(1);
}
- msleep(10);
+ msleep(100);
}
child_status[i] = getpid();
- while (child_status[i] && end_timer() < 5) msleep(2);
+ pause();
+
+ if (child_status[i]) {
+ printf("Child %d failed to start!\n", i);
+ child_status_out[i] = 1;
+ _exit(1);
+ }
child_status_out[i] = fn(i);
_exit(0);
if (child_status[i]) synccount++;
}
if (synccount == nprocs) break;
- msleep(10);
- } while (end_timer() < 30);
+ msleep(100);
+ } while (end_timer() < start_time_limit);
if (synccount != nprocs) {
printf("FAILED TO START %d CLIENTS (started %d)\n", nprocs, synccount);
return end_timer();
}
+ printf("Starting %d clients\n", nprocs);
+
/* start the client load */
start_timer();
-
for (i=0;i<nprocs;i++) {
child_status[i] = 0;
}
+ kill(0, SIGCONT);
printf("%d clients started\n", nprocs);
for (i=0;i<nprocs;i++) {
- while (waitpid(0, &status, 0) == -1 && errno == EINTR) /* noop */ ;
+ int ret;
+ while ((ret=waitpid(0, &status, 0)) == -1 && errno == EINTR) /* noop */ ;
+ if (ret == -1 || WEXITSTATUS(status) != 0) {
+ *result = False;
+ }
}
printf("\n");
{"SCAN-NTTRANS", torture_nttrans_scan, 0},
{"SCAN-ALIASES", torture_trans2_aliases, 0},
{"SCAN-SMB", torture_smb_scan, 0},
+ {"RPC-LSA", torture_rpc_lsa, 0},
+ {"RPC-ECHO", torture_rpc_echo, 0},
+ {"RPC-DFS", torture_rpc_dfs, 0},
+ {"RPC-SPOOLSS", torture_rpc_spoolss, 0},
+ {"RPC-SAMR", torture_rpc_samr, 0},
+ {"RPC-NETLOGON", torture_rpc_netlogon, 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},
+ {"RPC-SCANNER", torture_rpc_scanner, 0},
+ {"RPC-AUTOIDL", torture_rpc_autoidl, 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;
{
int opt, i;
char *p;
- int gotuser = 0;
BOOL correct = True;
char *host, *share, *username;
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_", 6) == 0) {
+ lp_set_cmdline("torture:binding", argv[1]);
+ } 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++;
srandom(time(NULL));
- while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:e:m:Ld:Ac:ks:f:bs:")) != EOF) {
+ while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:e:m:Ld:Ac:ks:f:s:")) != EOF) {
switch (opt) {
case 'p':
lp_set_cmdline("smb ports", optarg);
break;
case 'd':
lp_set_cmdline("debug level", optarg);
- setup_logging(NULL,True);
+ setup_logging(NULL, DEBUG_STDOUT);
break;
case 'O':
lp_set_cmdline("socket options", optarg);
#endif
break;
case 'U':
- gotuser = 1;
parse_user(optarg);
break;
case 'f':
torture_failures = atoi(optarg);
break;
- case 'b':
- bypass_io = True;
- break;
-
+
default:
printf("Unknown option %c (%d)\n", (char)opt, opt);
usage();
}
}
- printf("host=%s share=%s user=%s myname=%s\n",
- host, share, lp_parm_string(-1, "torture", "username"),
- lp_netbios_name());
-
if (argc == optind) {
printf("You must specify a test to run, or 'ALL'\n");
} else {