summaryrefslogtreecommitdiff
path: root/source4/torture/raw
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-05-30 03:36:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:43 -0500
commit1204445aa01111f7ad8935bb532b579384337b42 (patch)
treeaa69e0be3963e1870c39685e04f4f53db89545eb /source4/torture/raw
parent17936b09dba370928faf3794caadfe22c1862622 (diff)
downloadsamba-1204445aa01111f7ad8935bb532b579384337b42.tar.gz
samba-1204445aa01111f7ad8935bb532b579384337b42.tar.bz2
samba-1204445aa01111f7ad8935bb532b579384337b42.zip
r15946: Added check that proves that setpathinfo on an
oplocked open file generates a break. Jeremy. (This used to be commit 061b519b27cecbeb0687426201caaa7e8d95d856)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/oplock.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 18b99b29e4..7099691d6f 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -134,6 +134,7 @@ static BOOL test_oplock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
union smb_open io;
union smb_unlink unl;
union smb_read rd;
+ union smb_setfileinfo sfi;
uint16_t fnum=0, fnum2=0;
char c = 0;
@@ -565,6 +566,43 @@ static BOOL test_oplock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(break_info.level, 0);
CHECK_VAL(break_info.failures, 0);
+ smbcli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum2);
+ smbcli_unlink(cli->tree, fname);
+
+ /* Test if a set-eof on pathname breaks an exclusive oplock. */
+ printf("Test if setpathinfo breaks oplocks.\n");
+
+ ZERO_STRUCT(break_info);
+ smbcli_oplock_handler(cli->transport, oplock_handler_ack_to_levelII, cli->tree);
+
+ io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
+ NTCREATEX_FLAGS_REQUEST_OPLOCK |
+ NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
+ io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
+ io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
+ NTCREATEX_SHARE_ACCESS_WRITE|
+ NTCREATEX_SHARE_ACCESS_DELETE;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum2 = io.ntcreatex.out.file.fnum;
+ CHECK_VAL(break_info.count, 0);
+ CHECK_VAL(break_info.failures, 0);
+ CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
+
+ ZERO_STRUCT(sfi);
+ sfi.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
+ sfi.generic.in.file.path = fname;
+ sfi.end_of_file_info.in.size = 100;
+
+ status = smb_raw_setpathinfo(cli->tree, &sfi);
+
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VAL(break_info.count, 1);
+ CHECK_VAL(break_info.failures, 0);
+ CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
+
done:
smbcli_close(cli->tree, fnum);
smbcli_close(cli->tree, fnum2);