summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2018-10-09 14:54:31 +0200
committerKarolin Seeger <kseeger@samba.org>2018-11-02 15:02:42 +0100
commit3587cca9487074304b1fd7b8201cabff5a36ccab (patch)
treebaa3ddae3b27f2a483ab327d1a3d1506bf512ff0 /source3
parent5eb26a5e7c9a9b5ad4faf85d2ff70d9f1ec36f6e (diff)
downloadsamba-3587cca9487074304b1fd7b8201cabff5a36ccab.tar.gz
vfs_fruit: optionally delete AppleDouble files without Resourcefork data
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13642 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 3649f1a41a299b14609318ef52b44e2d53cba4b5) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Fri Nov 2 15:02:42 CET 2018 on sn-devel-144
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_fruit.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index b4a14b38756..e8c45f19092 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -1386,6 +1386,43 @@ static bool ad_convert_blank_rfork(struct adouble *ad,
return true;
}
+static bool ad_convert_delete_adfile(struct adouble *ad,
+ const struct smb_filename *smb_fname)
+{
+ struct fruit_config_data *config = NULL;
+ struct smb_filename *ad_name = NULL;
+ int rc;
+
+ if (ad_getentrylen(ad, ADEID_RFORK) > 0) {
+ return true;
+ }
+
+ SMB_VFS_HANDLE_GET_DATA(ad->ad_handle, config,
+ struct fruit_config_data, return false);
+
+ if (!config->delete_empty_adfiles) {
+ return true;
+ }
+
+ rc = adouble_path(talloc_tos(), smb_fname, &ad_name);
+ if (rc != 0) {
+ return false;
+ }
+
+ rc = SMB_VFS_NEXT_UNLINK(ad->ad_handle, ad_name);
+ if (rc != 0) {
+ DBG_ERR("Unlinking [%s] failed: %s\n",
+ smb_fname_str_dbg(ad_name), strerror(errno));
+ TALLOC_FREE(ad_name);
+ return false;
+ }
+
+ DBG_WARNING("Unlinked [%s] after conversion\n", smb_fname_str_dbg(ad_name));
+ TALLOC_FREE(ad_name);
+
+ return true;
+}
+
/**
* Convert from Apple's ._ file to Netatalk
*
@@ -1426,6 +1463,11 @@ static int ad_convert(struct adouble *ad,
return -1;
}
+ ok = ad_convert_delete_adfile(ad, smb_fname);
+ if (!ok) {
+ return -1;
+ }
+
return 0;
}