From: Ralph Boehme Date: Mon, 10 Mar 2025 13:03:33 +0000 (+0100) Subject: smbd: check allocsize change request against current allocsize X-Git-Tag: tevent-0.17.0~504 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=560c7359cedc0286f75d4946e755f7925b9c4e45;p=thirdparty%2Fsamba.git smbd: check allocsize change request against current allocsize Cf MS-FSA 2.1.5.15.1 FileAllocationInformation: If Open.Stream.AllocationSize is equal to NewAllocationSize, the operation MUST return STATUS_SUCCESS. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index 7ec1af751db..bfaabaf5db7 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -4979,7 +4979,9 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn, } /* Only change if needed. */ - if (allocation_size != get_file_size_stat(&smb_fname->st)) { + if (allocation_size != + SMB_VFS_GET_ALLOC_SIZE(conn, new_fsp, &new_fsp->fsp_name->st)) + { if (vfs_allocate_file_space(fsp, allocation_size) == -1) { return map_nt_error_from_unix(errno); } @@ -5021,7 +5023,9 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn, } /* Only change if needed. */ - if (allocation_size != get_file_size_stat(&smb_fname->st)) { + if (allocation_size != + SMB_VFS_GET_ALLOC_SIZE(conn, new_fsp, &new_fsp->fsp_name->st)) + { if (vfs_allocate_file_space(new_fsp, allocation_size) == -1) { status = map_nt_error_from_unix(errno); close_file_free(req, &new_fsp, NORMAL_CLOSE);