1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

Extended seek tests to check position information.

Jeremy.
(This used to be commit c4cc40c5c808d03e9ef813e6b2340c469cc6dc2d)
This commit is contained in:
Jeremy Allison 2003-08-14 21:11:06 +00:00
parent e08eee4db0
commit a19e269c2c

View File

@ -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);