summaryrefslogtreecommitdiff
path: root/source4/torture/raw/oplock.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-05-25 00:05:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:13 -0500
commitdaa890e2c86ba7dded91144e6aa75105c23e0008 (patch)
treee02c325005a5b82267eeb1345137b09529e6ddcc /source4/torture/raw/oplock.c
parent9425495e30825079acfe9584642ec12fd084347f (diff)
downloadsamba-daa890e2c86ba7dded91144e6aa75105c23e0008.tar.gz
samba-daa890e2c86ba7dded91144e6aa75105c23e0008.tar.bz2
samba-daa890e2c86ba7dded91144e6aa75105c23e0008.zip
r865: Regression test for attribute-only opens not causing an oplock break.
Samba3 server used to get this wrong. Jeremy. (This used to be commit 4120b3bdf6668909efa0af97b2c63adea22c35da)
Diffstat (limited to 'source4/torture/raw/oplock.c')
-rw-r--r--source4/torture/raw/oplock.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 0eabcc94f7..403d19113d 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -255,9 +255,38 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(break_info.fnum, fnum2);
CHECK_VAL(break_info.level, 2);
+ cli_close(cli->tree, fnum);
+
+ printf("open with batch oplock\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;
+ 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);
+
+ ZERO_STRUCT(break_info);
+ printf("second open with attributes only shouldn't cause oplock break\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;
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum2 = io.ntcreatex.out.fnum;
+ CHECK_VAL(io.ntcreatex.out.oplock_level, NO_OPLOCK_RETURN);
+ CHECK_VAL(break_info.count, 0);
+ CHECK_VAL(break_info.fnum, 0);
+ CHECK_VAL(break_info.level, 0);
done:
cli_close(cli->tree, fnum);
+ cli_close(cli->tree, fnum2);
cli_unlink(cli->tree, fname);
return ret;
}