1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

Move handle based access check into handle code path.

This commit is contained in:
Jeremy Allison 2011-11-15 16:14:16 -08:00
parent dd504b1899
commit c27551b163

View File

@ -6626,16 +6626,16 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
allocation_size = smb_roundup(conn, allocation_size); allocation_size = smb_roundup(conn, allocation_size);
} }
if (fsp && !(fsp->access_mask & FILE_WRITE_DATA)) {
return NT_STATUS_ACCESS_DENIED;
}
DEBUG(10,("smb_set_file_allocation_info: file %s : setting new " DEBUG(10,("smb_set_file_allocation_info: file %s : setting new "
"allocation size to %.0f\n", smb_fname_str_dbg(smb_fname), "allocation size to %.0f\n", smb_fname_str_dbg(smb_fname),
(double)allocation_size)); (double)allocation_size));
if (fsp && fsp->fh->fd != -1) { if (fsp && fsp->fh->fd != -1) {
/* Open file handle. */ /* Open file handle. */
if (!(fsp->access_mask & FILE_WRITE_DATA)) {
return NT_STATUS_ACCESS_DENIED;
}
/* Only change if needed. */ /* Only change if needed. */
if (allocation_size != get_file_size_stat(&smb_fname->st)) { if (allocation_size != get_file_size_stat(&smb_fname->st)) {
if (vfs_allocate_file_space(fsp, allocation_size) == -1) { if (vfs_allocate_file_space(fsp, allocation_size) == -1) {