vfs_fruit: delete 0 byte size streams if AAPL is enabled
authorRalph Boehme <slow@samba.org>
Thu, 17 May 2018 14:48:09 +0000 (16:48 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 30 May 2018 00:34:29 +0000 (02:34 +0200)
macOS SMB server uses xattrs as storage backend for streams, directly
exposing xattr get/set characteristics. Setting EOF on a stream to 0
just deletes the xattr as macOS doesn't support 0-byte sized xattrs.

Note that this does not apply to the AFP_AfpInfo and AFP_Resource
streams, they have even stranger semantics and we have other tests
for those.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed May 30 02:34:29 CEST 2018 on sn-devel-144

selftest/knownfail.d/samba3.vfs.fruit
source3/modules/vfs_fruit.c

index 5931c47..8df25bc 100644 (file)
@@ -1,4 +1 @@
 ^samba3.vfs.fruit streams_depot.OS X AppleDouble file conversion\(nt4_dc\)
-^samba3.vfs.fruit metadata_netatalk.setinfo eof stream\(nt4_dc\)
-^samba3.vfs.fruit metadata_stream.setinfo eof stream\(nt4_dc\)
-^samba3.vfs.fruit streams_depot.setinfo eof stream\(nt4_dc\)
index 0a8141a..df3cd0c 100644 (file)
@@ -5542,6 +5542,9 @@ static int fruit_ftruncate(struct vfs_handle_struct *handle,
                  (intmax_t)offset);
 
        if (fio == NULL) {
+               if (offset == 0 && global_fruit_config.nego_aapl) {
+                       return SMB_VFS_NEXT_UNLINK(handle, fsp->fsp_name);
+               }
                return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
        }