summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-05-30 08:12:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:21 -0500
commit496220916a5b8effa85f55f3a1fcba13d0d80337 (patch)
tree5ddb807e18b6d35098169723c105a5b472933195 /source4
parent45e93c19ef95978f908f5b14962770510634cd3b (diff)
downloadsamba-496220916a5b8effa85f55f3a1fcba13d0d80337.tar.gz
samba-496220916a5b8effa85f55f3a1fcba13d0d80337.tar.bz2
samba-496220916a5b8effa85f55f3a1fcba13d0d80337.zip
r946: Updated attribute only oplock tester to cover more cases.
Jeremy. (This used to be commit 6c9d32173b26353e8ae00f7f6b666290651883e6)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/raw/oplock.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 28b7557f3e..1329f58fa9 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -22,7 +22,7 @@
#define CHECK_VAL(v, correct) do { \
if ((v) != (correct)) { \
- printf("(%d) wrong value for %s 0x%x - 0x%x\n", \
+ printf("(%d) wrong value for %s got 0x%x - should be 0x%x\n", \
__LINE__, #v, (int)v, (int)correct); \
ret = False; \
}} while (0)
@@ -155,7 +155,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
CHECK_VAL(break_info.fnum, fnum);
- CHECK_VAL(break_info.level, 2);
+ CHECK_VAL(break_info.level, 1);
CHECK_VAL(break_info.count, 1);
@@ -179,7 +179,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(break_info.fnum, fnum);
- CHECK_VAL(break_info.level, 2);
+ CHECK_VAL(break_info.level, 1);
CHECK_VAL(break_info.count, 1);
printf("a self read should not cause a break\n");
@@ -226,7 +226,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
- CHECK_VAL(break_info.level, 2);
+ CHECK_VAL(break_info.level, 1);
printf("a 2nd open should get an oplock when we close instead of ack\n");
ZERO_STRUCT(break_info);
@@ -253,7 +253,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum2);
- CHECK_VAL(break_info.level, 2);
+ CHECK_VAL(break_info.level, 1);
cli_close(cli->tree, fnum);
@@ -284,6 +284,38 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(break_info.fnum, 0);
CHECK_VAL(break_info.level, 0);
+ cli_close(cli->tree, fnum);
+ cli_close(cli->tree, fnum2);
+ cli_unlink(cli->tree, fname);
+
+ printf("open with attributes only can create file\n");
+ io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
+ NTCREATEX_FLAGS_REQUEST_OPLOCK |
+ NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
+ io.ntcreatex.in.access_mask = SA_RIGHT_FILE_READ_ATTRIBUTES|SA_RIGHT_FILE_WRITE_ATTRIBUTES|STD_RIGHT_SYNCHRONIZE_ACCESS;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = io.ntcreatex.out.fnum;
+ CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
+
+ printf("Subsequent normal open should break oplock on attribute only open to level II\n");
+
+ ZERO_STRUCT(break_info);
+ cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+
+ io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
+ NTCREATEX_FLAGS_REQUEST_OPLOCK |
+ NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
+ io.ntcreatex.in.access_mask = GENERIC_RIGHTS_FILE_ALL_ACCESS;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum2 = io.ntcreatex.out.fnum;
+ CHECK_VAL(break_info.count, 1);
+ CHECK_VAL(break_info.fnum, fnum);
+ CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
+
done:
cli_close(cli->tree, fnum);
cli_close(cli->tree, fnum2);