summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2015-12-17 20:08:35 +0100
committerKarolin Seeger <kseeger@samba.org>2016-01-06 10:07:17 +0100
commit293363b483498272e572eae684f860669e7ef174 (patch)
treebd7eae8258471981f11651617d59639b79f9b9c9
parent95699b3680512f46d2a013f08be12b5c4fd10ed9 (diff)
downloadsamba-293363b483498272e572eae684f860669e7ef174.tar.gz
vfs_fruit: writing all 0 to AFP_AfpInfo stream
When writing all 0 to AFP_AfpInfo stream we can remove the underlying storage object. This beaviour of OS X SMB server was found with a torture test. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit e94b17715ea8049df8819b472178170b8e987946)
-rw-r--r--source3/modules/vfs_fruit.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index ef25599c538..c1c71a5d21f 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -2795,6 +2795,23 @@ static ssize_t fruit_pwrite(vfs_handle_struct *handle,
}
memcpy(ad_entry(ad, ADEID_FINDERI),
&ai->afpi_FinderInfo[0], ADEDLEN_FINDERI);
+ if (empty_finderinfo(ad)) {
+ /* Discard metadata */
+ if (config->meta == FRUIT_META_STREAM) {
+ rc = SMB_VFS_FTRUNCATE(fsp, 0);
+ } else {
+ rc = SMB_VFS_REMOVEXATTR(handle->conn,
+ fsp->fsp_name->base_name,
+ AFPINFO_EA_NETATALK);
+ }
+ if (rc != 0 && errno != ENOENT && errno != ENOATTR) {
+ DEBUG(1,("Can't delete metadata for %s: %s\n",
+ fsp->fsp_name->base_name, strerror(errno)));
+ goto exit;
+ }
+ rc = 0;
+ goto exit;
+ }
rc = ad_write(ad, name);
} else {
len = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n,