summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2015-08-25 17:06:52 +0200
committerKarolin Seeger <kseeger@samba.org>2015-09-04 12:41:17 +0200
commitd28246057c80e2c8233d24412a272c9c3425e1a5 (patch)
treeaf845739c5c979efd3529231a288f7545eab39e4
parent05e80175fb85faf048d0d36a3972c8e0f8710cb4 (diff)
downloadsamba-d28246057c80e2c8233d24412a272c9c3425e1a5.tar.gz
vfs_fruit: delete ._ file when deleting the basefile
0 byte resource fork streams are not listed by vfs_streaminfo, as a result stream cleanup/deletion of file deletion doesn't remove the resourcefork stream. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11467 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/modules/vfs_fruit.c62
1 files changed, 50 insertions, 12 deletions
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 342af76d3db..21b49f9bfa7 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -2389,15 +2389,44 @@ static int fruit_unlink(vfs_handle_struct *handle,
{
int rc = -1;
struct fruit_config_data *config = NULL;
- char *adp = NULL;
-
- if (!is_ntfs_stream_smb_fname(smb_fname)) {
- return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
- }
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct fruit_config_data, return -1);
+ if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ char *adp = NULL;
+
+ rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
+ if (rc != 0) {
+ return -1;
+ }
+
+ if (config->rsrc != FRUIT_RSRC_ADFILE) {
+ return 0;
+ }
+
+ /*
+ * 0 byte resource fork streams are not listed by
+ * vfs_streaminfo, as a result stream cleanup/deletion of file
+ * deletion doesn't remove the resourcefork stream.
+ */
+ rc = adouble_path(talloc_tos(),
+ smb_fname->base_name, &adp);
+ if (rc != 0) {
+ return -1;
+ }
+
+ /* FIXME: direct unlink(), missing smb_fname */
+ DEBUG(1,("fruit_unlink: %s\n", adp));
+ rc = unlink(adp);
+ if ((rc == -1) && (errno == ENOENT)) {
+ rc = 0;
+ }
+
+ TALLOC_FREE(adp);
+ return 0;
+ }
+
if (is_afpinfo_stream(smb_fname)) {
if (config->meta == FRUIT_META_STREAM) {
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
@@ -2406,8 +2435,14 @@ static int fruit_unlink(vfs_handle_struct *handle,
smb_fname->base_name,
AFPINFO_EA_NETATALK);
}
- } else if (is_afpresource_stream(smb_fname)) {
+
+ return rc;
+ }
+
+ if (is_afpresource_stream(smb_fname)) {
if (config->rsrc == FRUIT_RSRC_ADFILE) {
+ char *adp = NULL;
+
rc = adouble_path(talloc_tos(),
smb_fname->base_name, &adp);
if (rc != 0) {
@@ -2418,17 +2453,20 @@ static int fruit_unlink(vfs_handle_struct *handle,
if ((rc == -1) && (errno == ENOENT)) {
rc = 0;
}
+ TALLOC_FREE(adp);
} else {
rc = SMB_VFS_REMOVEXATTR(handle->conn,
- smb_fname->base_name,
- AFPRESOURCE_EA_NETATALK);
+ smb_fname->base_name,
+ AFPRESOURCE_EA_NETATALK);
}
- } else {
- rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
+
+ return rc;
}
- TALLOC_FREE(adp);
- return rc;
+ return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
+
+
+ return 0;
}
static int fruit_chmod(vfs_handle_struct *handle,