summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clientgen.c10
-rw-r--r--source3/utils/torture.c64
2 files changed, 65 insertions, 9 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 7dc57bfb47..117d065f76 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -348,11 +348,11 @@ BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
/****************************************************************************
call a remote api
****************************************************************************/
-static BOOL cli_api(struct cli_state *cli,
- char *param, int prcnt, int mprcnt,
- char *data, int drcnt, int mdrcnt,
- char **rparam, int *rprcnt,
- char **rdata, int *rdrcnt)
+BOOL cli_api(struct cli_state *cli,
+ char *param, int prcnt, int mprcnt,
+ char *data, int drcnt, int mdrcnt,
+ char **rparam, int *rprcnt,
+ char **rdata, int *rdrcnt)
{
cli_send_trans(cli,SMBtrans,
PIPE_LANMAN,strlen(PIPE_LANMAN), /* Name, length */
diff --git a/source3/utils/torture.c b/source3/utils/torture.c
index 53226d00e6..164bc4f743 100644
--- a/source3/utils/torture.c
+++ b/source3/utils/torture.c
@@ -71,7 +71,9 @@ static BOOL open_connection(struct cli_state *c)
return False;
}
- if (!cli_send_tconX(c, share, "A:", password, strlen(password)+1)) {
+ if (!cli_send_tconX(c, share,
+ strstr(share,"IPC$")?"IPC":"A:",
+ password, strlen(password)+1)) {
printf("%s refused tree connect (%s)\n", host, cli_errstr(c));
cli_shutdown(c);
return False;
@@ -230,7 +232,7 @@ static void run_torture(int numops)
static void run_locktest1(void)
{
static struct cli_state cli1, cli2;
- char *fname = "\\locktest.lck";
+ char *fname = "\\lockt1.lck";
int fnum1, fnum2, fnum3;
time_t t1, t2;
@@ -355,7 +357,7 @@ static void run_locktest1(void)
static void run_locktest2(void)
{
static struct cli_state cli;
- char *fname = "\\locktest.lck";
+ char *fname = "\\lockt2.lck";
int fnum1, fnum2, fnum3;
if (!open_connection(&cli)) {
@@ -458,7 +460,7 @@ static void run_locktest2(void)
static void run_locktest3(int numops)
{
static struct cli_state cli1, cli2;
- char *fname = "\\locktest.lck";
+ char *fname = "\\lockt3.lck";
int fnum1, fnum2, i;
uint32 offset;
@@ -605,6 +607,57 @@ static void run_unlinktest(void)
printf("unlink test finished\n");
}
+/* generate a random buffer */
+void rand_buf(char *buf, int len)
+{
+ while (len--) {
+ *buf = random();
+ buf++;
+ }
+}
+
+/* send random IPC commands */
+static void run_randomipc(void)
+{
+ char *rparam = NULL;
+ char *rdata = NULL;
+ int rdrcnt,rprcnt;
+ pstring param;
+ int api, param_len, i;
+ static struct cli_state cli;
+ struct {
+ int api, level;
+ char *format;
+ char *subformat;
+ int len;
+ } foo;
+
+ printf("starting random ipc test\n");
+
+ if (!open_connection(&cli)) {
+ return;
+ }
+
+ for (i=0;i<1000;i++) {
+ api = random() % 500;
+ param_len = random() % 64;
+
+ rand_buf(param, param_len);
+
+ SSVAL(param,0,api);
+
+ cli_api(&cli,
+ param, param_len, 8,
+ NULL, 0, BUFFER_SIZE,
+ &rparam, &rprcnt,
+ &rdata, &rdrcnt);
+ }
+
+ close_connection(&cli);
+
+ printf("finished random ipc test\n");
+}
+
static void browse_callback(char *sname, uint32 stype, char *comment)
@@ -613,6 +666,7 @@ static void browse_callback(char *sname, uint32 stype, char *comment)
}
+
/*
This test checks the browse list code
@@ -912,6 +966,8 @@ static void create_procs(int nprocs, int numops)
printf("host=%s share=%s user=%s myname=%s\n",
host, share, username, myname);
+ run_randomipc();
+
start_timer();
create_procs(nprocs, numops);
printf("rw_torture: %g secs\n", end_timer());