s3:smbd: Ignore initial allocation size for directory creation
authorRalph Boehme <slow@samba.org>
Wed, 25 Nov 2015 14:23:26 +0000 (15:23 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 26 Jan 2016 20:28:19 +0000 (21:28 +0100)
We reject directory creation with an initial allocation size > 0 with
NT_STATUS_ACCESS_DENIED. Windows servers ignore the initial allocation
size on directories.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11684

Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 78ccbb07170c3e49a084d31434310f973e3d6158)

source3/smbd/open.c

index 2e0881871e8749687eca7f6fc00949b21c4ea94f..5dbb0a570a0d8acaed552049972f3be4b21ba9cd 100644 (file)
@@ -4705,15 +4705,11 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
 
        /* Save the requested allocation size. */
        if ((info == FILE_WAS_CREATED) || (info == FILE_WAS_OVERWRITTEN)) {
-               if (allocation_size
-                   && (allocation_size > fsp->fsp_name->st.st_ex_size)) {
+               if ((allocation_size > fsp->fsp_name->st.st_ex_size)
+                   && !(fsp->is_directory))
+               {
                        fsp->initial_allocation_size = smb_roundup(
                                fsp->conn, allocation_size);
-                       if (fsp->is_directory) {
-                               /* Can't set allocation size on a directory. */
-                               status = NT_STATUS_ACCESS_DENIED;
-                               goto fail;
-                       }
                        if (vfs_allocate_file_space(
                                    fsp, fsp->initial_allocation_size) == -1) {
                                status = NT_STATUS_DISK_FULL;