]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: check allocsize change request against current allocsize
authorRalph Boehme <slow@samba.org>
Mon, 10 Mar 2025 13:03:33 +0000 (14:03 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 27 Mar 2025 05:37:43 +0000 (05:37 +0000)
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 <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_trans2.c

index 7ec1af751dbb6307843788ba6e58cbb92daad5fb..bfaabaf5db7446a2517c56e3b13a148c3bc2afe9 100644 (file)
@@ -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);