summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2015-12-18 17:25:07 +0100
committerKarolin Seeger <kseeger@samba.org>2016-01-06 10:07:16 +0100
commit7b2f35b4fe9b9b5e4de6466172fe136e2b24801f (patch)
treeb9a4a7f50c01a789ed56cf14f422e35b75747738
parentb8512d414b933e30be9e3b9effee1df1311777da (diff)
downloadsamba-7b2f35b4fe9b9b5e4de6466172fe136e2b24801f.tar.gz
s4:torture:vfs_fruit: fix test_rename_dir_openfile() to work with OS X
OS X allows renaming of directories with open files regardless of AAPL negotiation. Samba will only allow this after negotiating AAPL. The first check in this test is that renaming fails without AAPL, so skip this test if the server is OS X. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 363260983f7ec85ecd3a2b35e6b07eeb5416bdc5)
-rw-r--r--source4/torture/vfs/fruit.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index b86c4b4ded3..d453910e18c 100644
--- a/source4/torture/vfs/fruit.c
+++ b/source4/torture/vfs/fruit.c
@@ -2653,6 +2653,7 @@ static bool test_rename_dir_openfile(struct torture_context *torture,
union smb_setfileinfo sinfo;
struct smb2_handle d1, h1;
const char *renamedir = BASEDIR "-new";
+ bool server_is_osx = torture_setting_bool(torture, "osx", false);
smb2_deltree(tree, BASEDIR);
smb2_util_rmdir(tree, BASEDIR);
@@ -2692,24 +2693,28 @@ static bool test_rename_dir_openfile(struct torture_context *torture,
torture_assert_ntstatus_ok(torture, status, "smb2_create file");
h1 = io.smb2.out.file.handle;
- torture_comment(torture, "Renaming directory without AAPL, must fail\n");
+ if (!server_is_osx) {
+ torture_comment(torture, "Renaming directory without AAPL, must fail\n");
- ZERO_STRUCT(sinfo);
- sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
- sinfo.rename_information.in.file.handle = d1;
- sinfo.rename_information.in.overwrite = 0;
- sinfo.rename_information.in.root_fid = 0;
- sinfo.rename_information.in.new_name = renamedir;
- status = smb2_setinfo_file(tree, &sinfo);
- torture_assert_ntstatus_equal(torture, status, NT_STATUS_ACCESS_DENIED,
- "smb2_setinfo_file");
+ ZERO_STRUCT(sinfo);
+ sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
+ sinfo.rename_information.in.file.handle = d1;
+ sinfo.rename_information.in.overwrite = 0;
+ sinfo.rename_information.in.root_fid = 0;
+ sinfo.rename_information.in.new_name = renamedir;
+ status = smb2_setinfo_file(tree, &sinfo);
- ZERO_STRUCT(cl.smb2);
- cl.smb2.level = RAW_CLOSE_SMB2;
- cl.smb2.in.file.handle = d1;
- status = smb2_close(tree, &(cl.smb2));
- torture_assert_ntstatus_ok(torture, status, "smb2_close");
- ZERO_STRUCT(d1);
+ torture_assert_ntstatus_equal(torture, status,
+ NT_STATUS_ACCESS_DENIED,
+ "smb2_setinfo_file");
+
+ ZERO_STRUCT(cl.smb2);
+ cl.smb2.level = RAW_CLOSE_SMB2;
+ cl.smb2.in.file.handle = d1;
+ status = smb2_close(tree, &(cl.smb2));
+ torture_assert_ntstatus_ok(torture, status, "smb2_close");
+ ZERO_STRUCT(d1);
+ }
torture_comment(torture, "Enabling AAPL\n");
@@ -2733,17 +2738,12 @@ static bool test_rename_dir_openfile(struct torture_context *torture,
torture_assert_ntstatus_ok(torture, status, "smb2_create dir");
d1 = io.smb2.out.file.handle;
- ZERO_STRUCT(io.smb2);
- io.generic.level = RAW_OPEN_SMB2;
- io.smb2.in.desired_access = 0x0017019f;
- io.smb2.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
- io.smb2.in.share_access = 0;
- io.smb2.in.alloc_size = 0;
- io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
- io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
- io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ ZERO_STRUCT(sinfo);
+ sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
sinfo.rename_information.in.file.handle = d1;
+ sinfo.rename_information.in.overwrite = 0;
+ sinfo.rename_information.in.root_fid = 0;
+ sinfo.rename_information.in.new_name = renamedir;
status = smb2_setinfo_file(tree, &sinfo);
torture_assert_ntstatus_ok(torture, status, "smb2_setinfo_file");