]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
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)
committerKarolin Seeger <kseeger@samba.org>
Tue, 6 Nov 2018 08:10:23 +0000 (09:10 +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>
(cherry picked from commit 9cd9859dc10d425d29774d221ec9ad697192b466)

source4/torture/vfs/fruit.c

index c34ae1a73d4ef436db0c6cb4863052b497426403..83b19d4694cd3c2a39b55ca377e300ce0e46f95c 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);