summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/raw/read.c31
-rw-r--r--source4/torture/smbtorture.c1
2 files changed, 30 insertions, 2 deletions
diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c
index 3b48aac848..90ca18d5b6 100644
--- a/source4/torture/raw/read.c
+++ b/source4/torture/raw/read.c
@@ -94,13 +94,18 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli)
buf = talloc_zero_array(tctx, uint8_t, maxsize);
+ if (!torture_setting_bool(tctx, "read_support", true)) {
+ printf("server refuses to support READ\n");
+ return true;
+ }
+
if (!torture_setup_dir(cli, BASEDIR)) {
return false;
}
printf("Testing RAW_READ_READ\n");
io.generic.level = RAW_READ_READ;
-
+
fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
@@ -478,7 +483,29 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
- printf("Trying large read\n");
+ printf("Trying page sized read\n");
+ io.readx.in.offset = 0;
+ io.readx.in.mincnt = 0x1000;
+ io.readx.in.maxcnt = 0x1000;
+ status = smb_raw_read(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
+ CHECK_VALUE(io.readx.out.compaction_mode, 0);
+ CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
+ CHECK_BUFFER(buf, seed, io.readx.out.nread);
+
+ printf("Trying page + 1 sized read (check alignment)\n");
+ io.readx.in.offset = 0;
+ io.readx.in.mincnt = 0x1001;
+ io.readx.in.maxcnt = 0x1001;
+ status = smb_raw_read(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
+ CHECK_VALUE(io.readx.out.compaction_mode, 0);
+ CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
+ CHECK_BUFFER(buf, seed, io.readx.out.nread);
+
+ printf("Trying large read (UINT16_MAX)\n");
io.readx.in.offset = 0;
io.readx.in.mincnt = 0xFFFF;
io.readx.in.maxcnt = 0xFFFF;
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 747911e5a9..d02ec2961b 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -548,6 +548,7 @@ int main(int argc,char *argv[])
"true");
lp_set_cmdline(cmdline_lp_ctx, "torture:deny_dos_support", "false");
lp_set_cmdline(cmdline_lp_ctx, "torture:deny_fcb_support", "false");
+ lp_set_cmdline(cmdline_lp_ctx, "torture:read_support", "false");
}
if (max_runtime) {