diff options
author | Ralph Boehme <slow@samba.org> | 2015-12-14 16:09:54 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2016-01-06 10:07:17 +0100 |
commit | 642b62b755f9f023438e4b8d3b0cac66a81b21b1 (patch) | |
tree | 4e91c66e34f42b647fcdade01c0139fbc57be60e | |
parent | a4e06390ab61ad30e8305dfd6097556304e471cb (diff) | |
download | samba-642b62b755f9f023438e4b8d3b0cac66a81b21b1.tar.gz |
vfs_fruit: handling of ftruncate() on AFP_AfpInfo stream
With help of some torture tests I verified the following behaviour of OS
X SMB server:
* ftruncate AFP_AfpInfo stream > 60 bytes results in an error
NT_STATUS_ALLOTTED_SPACE_EXCEEDED
* ftruncate AFP_AfpInfo stream <=60 returns success but has no effect
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 4024153894a07b7b1115dbe1699cba94fee13f23)
-rw-r--r-- | source3/modules/vfs_fruit.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 18ee2dac16d..ef25599c538 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -3230,19 +3230,23 @@ static int fruit_ftruncate_meta(struct vfs_handle_struct *handle, off_t offset, struct adouble *ad) { - /* - * As this request hasn't been seen in the wild, - * the only sensible use I can imagine is the client - * truncating the stream to 0 bytes size. - * We simply remove the metadata on such a request. - */ - if (offset != 0) { + struct fruit_config_data *config; + + SMB_VFS_HANDLE_GET_DATA(handle, config, + struct fruit_config_data, return -1); + + if (offset > 60) { DEBUG(1,("ftruncate %s to %jd", fsp_str_dbg(fsp), (intmax_t)offset)); + /* OS X returns NT_STATUS_ALLOTTED_SPACE_EXCEEDED */ + errno = EOVERFLOW; return -1; } - return SMB_VFS_FREMOVEXATTR(fsp, AFPRESOURCE_EA_NETATALK); + DEBUG(1,("ignoring ftruncate %s to %jd", + fsp_str_dbg(fsp), (intmax_t)offset)); + /* OS X returns success but does nothing */ + return 0; } static int fruit_ftruncate_rsrc(struct vfs_handle_struct *handle, |