From a19e269c2c401766fe0e44ea0a1daaad14f06f70 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 14 Aug 2003 21:11:06 +0000 Subject: Extended seek tests to check position information. Jeremy. (This used to be commit c4cc40c5c808d03e9ef813e6b2340c469cc6dc2d) --- source4/torture/raw/seek.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c index de62f88695..ec3b7125c9 100644 --- a/source4/torture/raw/seek.c +++ b/source4/torture/raw/seek.c @@ -114,6 +114,13 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.out.offset, 0xffffffff); + printf("Testing position information change\n"); + finfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; + finfo.position_information.in.fnum = fnum; + status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo); + CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VALUE(finfo.position_information.out.position, 0); + printf("Trying max overflow\n"); io.in.fnum = fnum; io.in.mode = SEEK_MODE_CURRENT; @@ -122,6 +129,13 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.out.offset, 999); + printf("Testing position information change\n"); + finfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; + finfo.position_information.in.fnum = fnum; + status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo); + CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VALUE(finfo.position_information.out.position, 0); + printf("trying read to update offset\n"); ZERO_STRUCT(c); if (cli_write(cli, fnum, 0, c, 0, 2) != 2) { @@ -129,6 +143,14 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx) ret = False; goto done; } + + printf("Testing position information change\n"); + finfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; + finfo.position_information.in.fnum = fnum; + status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo); + CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VALUE(finfo.position_information.out.position, 0); + io.in.fnum = fnum; io.in.mode = SEEK_MODE_CURRENT; io.in.offset = 0; @@ -141,6 +163,14 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx) ret = False; goto done; } + + printf("Testing position information change\n"); + finfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; + finfo.position_information.in.fnum = fnum; + status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo); + CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VALUE(finfo.position_information.out.position, 1); + status = smb_raw_seek(cli->tree, &io); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.out.offset, 1); -- cgit