summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-08-29 16:49:29 -0700
committerJeremy Allison <jra@samba.org>2011-08-30 03:26:48 +0200
commit8e5adf72ebe3e7193c9e9197f5f21a075b0df78c (patch)
tree62bc4935ba60dcbfe5c74fe4e80011753fe71952
parentdec3b21cd1737b317749e7ebced5aa1c2115ebdf (diff)
downloadsamba-8e5adf72ebe3e7193c9e9197f5f21a075b0df78c.tar.gz
samba-8e5adf72ebe3e7193c9e9197f5f21a075b0df78c.tar.bz2
samba-8e5adf72ebe3e7193c9e9197f5f21a075b0df78c.zip
Fixed regression test case for Bug 8412 - Microsoft Office 2007 (Microsoft Word) fails to save as on a Samba share with SMB2
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Aug 30 03:26:49 CEST 2011 on sn-devel-104
-rw-r--r--source4/torture/smb2/oplock.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/source4/torture/smb2/oplock.c b/source4/torture/smb2/oplock.c
index 2d74c5d1f4..e5c3571f47 100644
--- a/source4/torture/smb2/oplock.c
+++ b/source4/torture/smb2/oplock.c
@@ -734,6 +734,7 @@ static bool test_smb2_oplock_exclusive6(struct torture_context *tctx,
bool ret = true;
union smb_open io;
union smb_setfileinfo sinfo;
+ struct smb2_close closeio;
struct smb2_handle h, h1;
status = torture_smb2_testdir(tree1, BASEDIR, &h);
@@ -772,7 +773,8 @@ static bool test_smb2_oplock_exclusive6(struct torture_context *tctx,
h1 = io.smb2.out.file.handle;
CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_EXCLUSIVE);
- torture_comment(tctx, "rename should not generate a break but get "
+ torture_comment(tctx, "rename with the parent directory handle open "
+ "for DELETE should not generate a break but get "
"a sharing violation\n");
ZERO_STRUCT(sinfo);
sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
@@ -781,13 +783,49 @@ static bool test_smb2_oplock_exclusive6(struct torture_context *tctx,
sinfo.rename_information.in.new_name = fname2;
status = smb2_setinfo_file(tree1, &sinfo);
- torture_comment(tctx, "trying rename while first file open\n");
+ torture_comment(tctx, "trying rename while parent handle open for delete.\n");
torture_assert_ntstatus_equal(tctx, status, NT_STATUS_SHARING_VIOLATION,
"Incorrect status");
torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
+ /* Close the parent directry handle. */
+ ZERO_STRUCT(closeio);
+ closeio.in.file.handle = h;
+ status = smb2_close(tree1, &closeio);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Incorrect status");
+
+ /* Re-open without DELETE access. */
+ ZERO_STRUCT(io);
+ io.smb2.in.oplock_level = 0;
+ io.smb2.in.desired_access = SEC_RIGHTS_FILE_ALL & (~SEC_STD_DELETE);
+ io.smb2.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
+ io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
+ io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE;
+ io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ io.smb2.in.fname = BASEDIR;
+
+ status = smb2_create(tree1, tctx, &(io.smb2));
+ torture_assert_ntstatus_ok(tctx, status, "Error opening the base directory");
+
+ torture_comment(tctx, "rename with the parent directory handle open "
+ "without DELETE should succeed without a break\n");
+ ZERO_STRUCT(sinfo);
+ sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
+ sinfo.rename_information.in.file.handle = h1;
+ sinfo.rename_information.in.overwrite = true;
+ sinfo.rename_information.in.new_name = fname2;
+ status = smb2_setinfo_file(tree1, &sinfo);
+
+ torture_comment(tctx, "trying rename while parent handle open without delete\n");
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Incorrect status");
+ torture_wait_for_oplock_break(tctx);
+ CHECK_VAL(break_info.count, 0);
+ CHECK_VAL(break_info.failures, 0);
+
smb2_util_close(tree1, h1);
smb2_util_close(tree1, h);