mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
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>
This commit is contained in:
parent
e5588b463e
commit
e94b17715e
@ -2820,6 +2820,23 @@ static ssize_t fruit_pwrite(vfs_handle_struct *handle,
|
|||||||
}
|
}
|
||||||
memcpy(ad_entry(ad, ADEID_FINDERI),
|
memcpy(ad_entry(ad, ADEID_FINDERI),
|
||||||
&ai->afpi_FinderInfo[0], ADEDLEN_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) {
|
||||||
|
DBG_WARNING("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);
|
rc = ad_write(ad, name);
|
||||||
} else {
|
} else {
|
||||||
len = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n,
|
len = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user