vfs_fruit: update handling of read-only creation of resource fork
authorRalph Boehme <slow@samba.org>
Mon, 22 Oct 2018 10:32:09 +0000 (12:32 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 31 Oct 2018 20:27:19 +0000 (21:27 +0100)
macOS SMB server versions supports this since 10.12, so we adapt our
behaviour.

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>
selftest/knownfail.d/samba3.vfs.fruit
source3/modules/vfs_fruit.c

index a2758ffeded7e5c8c31aa8ceed74dfca613753cf..6307e2b34043b5f960a67ad7861eeb004b5bed3e 100644 (file)
@@ -1,5 +1,2 @@
 ^samba3.vfs.fruit streams_depot.OS X AppleDouble file conversion\(nt4_dc\)
 ^samba3.vfs.fruit streams_depot.OS X AppleDouble file conversion without embedded xattr\(nt4_dc\)
-^samba3.vfs.fruit metadata_netatalk.creating rsrc with read-only access\(nt4_dc\)
-^samba3.vfs.fruit metadata_stream.creating rsrc with read-only access\(nt4_dc\)
-^samba3.vfs.fruit streams_depot.creating rsrc with read-only access\(nt4_dc\)
index 6dd0b13bfcc9c054cc5c885e0333d201d95d8592..caa06201308d6c5a7ccf233aa34912cc44b45e81 100644 (file)
@@ -3575,12 +3575,9 @@ static int fruit_open_rsrc_adouble(vfs_handle_struct *handle,
                goto exit;
        }
 
-       /* Sanitize flags */
-       if (flags & O_WRONLY) {
-               /* We always need read access for the metadata header too */
-               flags &= ~O_WRONLY;
-               flags |= O_RDWR;
-       }
+       /* We always need read/write access for the metadata header too */
+       flags &= ~(O_RDONLY | O_WRONLY);
+       flags |= O_RDWR;
 
        hostfd = SMB_VFS_NEXT_OPEN(handle, smb_fname_base, fsp,
                                   flags, mode);
@@ -3667,20 +3664,6 @@ static int fruit_open_rsrc(vfs_handle_struct *handle,
        SMB_VFS_HANDLE_GET_DATA(handle, config,
                                struct fruit_config_data, return -1);
 
-       if (((flags & O_ACCMODE) == O_RDONLY)
-           && (flags & O_CREAT)
-           && !VALID_STAT(fsp->fsp_name->st))
-       {
-               /*
-                * This means the stream doesn't exist. macOS SMB server fails
-                * this with NT_STATUS_OBJECT_NAME_NOT_FOUND, so must we. Cf bug
-                * 12565 and the test for this combination in
-                * test_rfork_create().
-                */
-               errno = ENOENT;
-               return -1;
-       }
-
        switch (config->rsrc) {
        case FRUIT_RSRC_STREAM:
                fd = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);