From: Ralph Boehme Date: Wed, 11 Oct 2017 16:11:12 +0000 (+0200) Subject: vfs_fruit: fix ftruncating resource fork X-Git-Tag: tevent-0.9.34~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d7932a33263514785fa3e95e2d5502bc02b4ea4;p=thirdparty%2Fsamba.git vfs_fruit: fix ftruncating resource fork fruit_ftruncate_rsrc_adouble() is called to effectively ftruncate() the ._ AppleDouble file to the requested size. The VFS function SMB_VFS_NEXT_FTRUNCATE() otoh would attempt to truncate to fsp *stream* in any way the next VFS module seems fit. As we know we're stacked with a streams module, the module will attempt to truncate the stream. So we're not truncating the ._ file. This went unnoticed as the AppleDouble file header contains the authorative resource fork size that was updated correctly. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13076 Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke --- diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 5c9e680d299..a774d238c0f 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -4902,7 +4902,7 @@ static int fruit_ftruncate_rsrc_adouble(struct vfs_handle_struct *handle, ad_off = ad_getentryoff(ad, ADEID_RFORK); - rc = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset + ad_off); + rc = ftruncate(fsp->fh->fd, offset + ad_off); if (rc != 0) { TALLOC_FREE(ad); return -1;