1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-20 14:03:59 +03:00

vfs_fruit: add fruit:convert_adouble parameter

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

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): Fri May 26 00:52:29 UTC 2023 on atb-devel-224

(cherry picked from commit 035f6d914d133cf3248f15b1be06a9e1837238da)
This commit is contained in:
Ralph Boehme 2023-05-22 12:32:00 +02:00 committed by Jule Anger
parent 5c5ab78d93
commit 6dfa2252fd
2 changed files with 37 additions and 14 deletions

View File

@ -406,6 +406,19 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>fruit:convert_adouble = yes | no</term>
<listitem>
<para>Whether an attempt shall be made to convert ._ AppleDouble
sidecar files to native streams (xattrs when using
vfs_streams_xattr). The main use case for this conversion is
transparent migration from a server config without streams support
where the macOS client created those AppleDouble sidecar
files.</para>
<para>The default is <emphasis>yes</emphasis>.</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>

View File

@ -131,6 +131,7 @@ struct fruit_config_data {
const char *model; const char *model;
bool time_machine; bool time_machine;
off_t time_machine_max_size; off_t time_machine_max_size;
bool convert_adouble;
bool wipe_intentionally_left_blank_rfork; bool wipe_intentionally_left_blank_rfork;
bool delete_empty_adfiles; bool delete_empty_adfiles;
@ -381,6 +382,10 @@ static int init_fruit_config(vfs_handle_struct *handle)
config->time_machine_max_size = conv_str_size(tm_size_str); config->time_machine_max_size = conv_str_size(tm_size_str);
} }
config->convert_adouble = lp_parm_bool(
SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME,
"convert_adouble", true);
config->wipe_intentionally_left_blank_rfork = lp_parm_bool( config->wipe_intentionally_left_blank_rfork = lp_parm_bool(
SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME, SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME,
"wipe_intentionally_left_blank_rfork", false); "wipe_intentionally_left_blank_rfork", false);
@ -4290,7 +4295,10 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle,
SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data, SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data,
return NT_STATUS_UNSUCCESSFUL); return NT_STATUS_UNSUCCESSFUL);
if (is_apple_stream(smb_fname->stream_name) && !internal_open) { if (is_apple_stream(smb_fname->stream_name) &&
!internal_open &&
config->convert_adouble)
{
uint32_t conv_flags = 0; uint32_t conv_flags = 0;
if (config->wipe_intentionally_left_blank_rfork) { if (config->wipe_intentionally_left_blank_rfork) {
@ -4404,20 +4412,22 @@ static NTSTATUS fruit_freaddir_attr(struct vfs_handle_struct *handle,
DBG_DEBUG("Path [%s]\n", fsp_str_dbg(fsp)); DBG_DEBUG("Path [%s]\n", fsp_str_dbg(fsp));
if (config->wipe_intentionally_left_blank_rfork) { if (config->convert_adouble) {
conv_flags |= AD_CONV_WIPE_BLANK; if (config->wipe_intentionally_left_blank_rfork) {
} conv_flags |= AD_CONV_WIPE_BLANK;
if (config->delete_empty_adfiles) { }
conv_flags |= AD_CONV_DELETE; if (config->delete_empty_adfiles) {
} conv_flags |= AD_CONV_DELETE;
}
ret = ad_convert(handle, ret = ad_convert(handle,
fsp->fsp_name, fsp->fsp_name,
macos_string_replace_map, macos_string_replace_map,
conv_flags); conv_flags);
if (ret != 0) { if (ret != 0) {
DBG_ERR("ad_convert(\"%s\") failed\n", DBG_ERR("ad_convert(\"%s\") failed\n",
fsp_str_dbg(fsp)); fsp_str_dbg(fsp));
}
} }
*pattr_data = talloc_zero(mem_ctx, struct readdir_attr_data); *pattr_data = talloc_zero(mem_ctx, struct readdir_attr_data);