vfs_fruit: never return AFP_Resource stream for directories
authorRalph Boehme <slow@samba.org>
Mon, 22 May 2023 17:37:17 +0000 (19:37 +0200)
committerJule Anger <janger@samba.org>
Wed, 31 May 2023 07:49:14 +0000 (07:49 +0000)
The macOS client creates ._ AppleDouble files for directories that do contain
an (empty) resource fork AppleDouble entry. So when going from a Samba server
config without streams module (or when migrating data from another server
without streams support), to a Samba config with a streams module and vfs_fruit,
fruit_streaminfo() will wrongly return the AFP_Resource from the AppleDouble
file as stream to the client.

To address this, just never return an AFP_Resource stream for directories when
listing streams in fruit_streaminfo(). ad_convert(), when configured with

  fruit:delete_empty_adfiles = true
  fruit:wipe_intentionally_left_blank_rfork = true

will happily discard the AFP_Resource from the AppleDouble file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15378

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 06f0c070a0b18313f48362aa326e3e7e6a096492)

source3/modules/vfs_fruit.c

index 583de93a4b200672340b524b6b7e68302ef873e4..45c2f75fb42c86d97542ff96bbf677f0084831d7 100644 (file)
@@ -3959,6 +3959,10 @@ static NTSTATUS fruit_streaminfo_rsrc(vfs_handle_struct *handle,
        struct fruit_config_data *config = NULL;
        NTSTATUS status;
 
+       if (S_ISDIR(smb_fname->st.st_ex_mode)) {
+               return NT_STATUS_OK;
+       }
+
        SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data,
                                return NT_STATUS_INTERNAL_ERROR);