s4:torture/vfs/fruit: update test "read open rsrc after rename" to work with macOS
authorRalph Boehme <slow@samba.org>
Mon, 15 Oct 2018 14:24:19 +0000 (16:24 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 31 Oct 2018 20:27:19 +0000 (21:27 +0100)
macOS SMB server seems to return NT_STATUS_SHARING_VIOLATION in this
case while Windows 2016 returns NT_STATUS_ACCESS_DENIED.

Lets stick with the Windows error code for now in the Samba fileserver,
but let the test pass against macOS.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/torture/vfs/fruit.c

index 141faa1..43c9dd1 100644 (file)
@@ -4179,6 +4179,8 @@ static bool test_rename_and_read_rsrc(struct torture_context *tctx,
        const char *fname_renamed = "test_rename_openfile_renamed";
        const char *data = "1234567890";
        union smb_setfileinfo sinfo;
+       bool server_is_macos = torture_setting_bool(tctx, "osx", false);
+       NTSTATUS expected_status;
 
        ret = enable_aapl(tctx, tree);
        torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
@@ -4229,14 +4231,25 @@ static bool test_rename_and_read_rsrc(struct torture_context *tctx,
        sinfo.rename_information.in.root_fid = 0;
        sinfo.rename_information.in.new_name = fname_renamed;
 
+       if (server_is_macos) {
+               expected_status = NT_STATUS_SHARING_VIOLATION;
+       } else {
+               expected_status = NT_STATUS_ACCESS_DENIED;
+       }
+
        status = smb2_setinfo_file(tree, &sinfo);
        torture_assert_ntstatus_equal_goto(
-               tctx, status, NT_STATUS_ACCESS_DENIED, ret, done,
+               tctx, status, expected_status, ret, done,
                "smb2_setinfo_file failed");
 
-       smb2_util_close(tree, h1);
        smb2_util_close(tree, h2);
 
+       status = smb2_util_write(tree, h1, "foo", 0, 3);
+       torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+                                       "write failed\n");
+
+       smb2_util_close(tree, h1);
+
 done:
        smb2_util_unlink(tree, fname);
        smb2_util_unlink(tree, fname_renamed);