mirror of
https://github.com/samba-team/samba.git
synced 2025-03-20 22:50:26 +03:00
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)
This commit is contained in:
parent
a52778ba42
commit
f85e4e6402
@ -3223,19 +3223,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) {
|
||||
DBG_WARNING("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);
|
||||
DBG_WARNING("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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user