summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2018-10-20 23:40:14 +0200
committerKarolin Seeger <kseeger@samba.org>2018-11-06 09:10:25 +0100
commit80c95670e21f08da555f2ee1bd236a5fb8aca7ac (patch)
tree9b22134cff18a0e0df9d9f8dfc225b3c6673dd0d /source3
parent248b5fc305b3b18ff82a9567234ba46ebe779f1f (diff)
downloadsamba-80c95670e21f08da555f2ee1bd236a5fb8aca7ac.tar.gz
vfs_fruit: let fruit_pwrite_meta_stream also ftruncate empty FinderInfo
fruit_streaminfo currently filters out the FinderInfo stream is delete-on-close is set. We set it here internally, but the client may also set it over SMB. Turns out that the macOS SMB server does NOT filter out FinderInfo stream with delete-on-close set, so we must change the way filtering is done in fruit_streaminfo. Filtering is now done based on the FinderInfo stream being 0-bytes large which is why I'm adding the ftruncate here. No idea why the tests that check the filtering passed the commits leading up to this one, but if you revert this commit after applying the whole patchset, the "delete AFP_AfpInfo by writing all 0" test will fail. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 480695cd723cc4949e0b39ddb83560efac393412)
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_fruit.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 07ee5654e5d..c459046a7e1 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -4544,23 +4544,29 @@ static ssize_t fruit_pwrite_meta_stream(vfs_handle_struct *handle,
return -1;
}
- nwritten = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
- if (nwritten != n) {
- return -1;
- }
-
- if (!ai_empty_finderinfo(ai)) {
- return n;
- }
+ if (ai_empty_finderinfo(ai)) {
+ ret = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, 0);
+ if (ret != 0) {
+ DBG_ERR("SMB_VFS_NEXT_FTRUNCATE on [%s] failed\n",
+ fsp_str_dbg(fsp));
+ return -1;
+ }
- ok = set_delete_on_close(
+ ok = set_delete_on_close(
fsp,
true,
handle->conn->session_info->security_token,
handle->conn->session_info->unix_token);
- if (!ok) {
- DBG_ERR("set_delete_on_close on [%s] failed\n",
- fsp_str_dbg(fsp));
+ if (!ok) {
+ DBG_ERR("set_delete_on_close on [%s] failed\n",
+ fsp_str_dbg(fsp));
+ return -1;
+ }
+ return n;
+ }
+
+ nwritten = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+ if (nwritten != n) {
return -1;
}