diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 1163b752b1d..b771e135f4e 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -945,7 +945,6 @@ BOOL cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t) /**************************************************************************** Check for existance of a dir. ****************************************************************************/ - BOOL cli_chkpath(struct cli_state *cli, const char *path) { pstring path2; @@ -1052,3 +1051,34 @@ int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path) return SVAL(cli->inbuf,smb_vwv0); } + + +/* + send a raw ioctl - used by the torture code +*/ +NTSTATUS cli_raw_ioctl(struct cli_state *cli, int fnum, uint32 code, DATA_BLOB *blob) +{ + memset(cli->outbuf,'\0',smb_size); + memset(cli->inbuf,'\0',smb_size); + + set_message(cli->outbuf, 3, 0, True); + SCVAL(cli->outbuf,smb_com,SMBioctl); + cli_setup_packet(cli); + + SSVAL(cli->outbuf, smb_vwv0, fnum); + SSVAL(cli->outbuf, smb_vwv1, code>>16); + SSVAL(cli->outbuf, smb_vwv2, (code&0xFFFF)); + + cli_send_smb(cli); + if (!cli_receive_smb(cli)) { + return NT_STATUS_UNEXPECTED_NETWORK_ERROR; + } + + if (cli_is_error(cli)) { + return cli_nt_error(cli); + } + + *blob = data_blob(NULL, 0); + + return NT_STATUS_OK; +} diff --git a/source3/torture/denytest.c b/source3/torture/denytest.c index 017bb1c06d6..3a7906fb33b 100644 --- a/source3/torture/denytest.c +++ b/source3/torture/denytest.c @@ -1408,7 +1408,7 @@ static void progress_bar(unsigned i, unsigned total) */ BOOL torture_denytest1(int dummy) { - static struct cli_state cli1; + struct cli_state *cli1; int fnum1, fnum2; int i; BOOL correct = True; @@ -1421,10 +1421,10 @@ BOOL torture_denytest1(int dummy) printf("starting denytest1\n"); for (i=0;i<2;i++) { - cli_unlink(&cli1, fnames[i]); - fnum1 = cli_open(&cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE); - cli_write(&cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i])); - cli_close(&cli1, fnum1); + cli_unlink(cli1, fnames[i]); + fnum1 = cli_open(cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE); + cli_write(cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i])); + cli_close(cli1, fnum1); } printf("testing %d entries\n", ARRAY_SIZE(denytable1)); @@ -1435,10 +1435,10 @@ BOOL torture_denytest1(int dummy) progress_bar(i, ARRAY_SIZE(denytable1)); - fnum1 = cli_open(&cli1, fname, + fnum1 = cli_open(cli1, fname, denytable1[i].mode1, denytable1[i].deny1); - fnum2 = cli_open(&cli1, fname, + fnum2 = cli_open(cli1, fname, denytable1[i].mode2, denytable1[i].deny2); @@ -1449,10 +1449,10 @@ BOOL torture_denytest1(int dummy) } else { char x = 1; res = A_0; - if (cli_read(&cli1, fnum2, (void *)&x, 0, 1) == 1) { + if (cli_read(cli1, fnum2, (void *)&x, 0, 1) == 1) { res += A_R; } - if (cli_write(&cli1, fnum2, 0, (void *)&x, 0, 1) == 1) { + if (cli_write(cli1, fnum2, 0, (void *)&x, 0, 1) == 1) { res += A_W; } } @@ -1472,15 +1472,15 @@ BOOL torture_denytest1(int dummy) resultstr(denytable1[i].result)); } - cli_close(&cli1, fnum1); - cli_close(&cli1, fnum2); + cli_close(cli1, fnum1); + cli_close(cli1, fnum2); } for (i=0;i<2;i++) { - cli_unlink(&cli1, fnames[i]); + cli_unlink(cli1, fnames[i]); } - if (!torture_close_connection(&cli1)) { + if (!torture_close_connection(cli1)) { correct = False; } @@ -1494,7 +1494,7 @@ BOOL torture_denytest1(int dummy) */ BOOL torture_denytest2(int dummy) { - static struct cli_state cli1, cli2; + static struct cli_state *cli1, *cli2; int fnum1, fnum2; int i; BOOL correct = True; @@ -1507,10 +1507,10 @@ BOOL torture_denytest2(int dummy) printf("starting denytest2\n"); for (i=0;i<2;i++) { - cli_unlink(&cli1, fnames[i]); - fnum1 = cli_open(&cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE); - cli_write(&cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i])); - cli_close(&cli1, fnum1); + cli_unlink(cli1, fnames[i]); + fnum1 = cli_open(cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE); + cli_write(cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i])); + cli_close(cli1, fnum1); } for (i=0; i 0) { @@ -160,11 +167,11 @@ BOOL torture_casetable(int dummy) if (size/sizeof(int) >= MAX_EQUIVALENCE) { printf("too many chars match?? size=%d c=0x%04x\n", size, c); - cli_close(&cli, fnum); + cli_close(cli, fnum); return False; } - cli_read(&cli, fnum, (char *)c2, 0, size); + cli_read(cli, fnum, (char *)c2, 0, size); printf("%04x: ", c); equiv[c][0] = c; for (i=0; i