Fix bug #8507 - smbd doesn't correctly honor the "force create mode" bits from a...
authorJeremy Allison <jra@samba.org>
Tue, 4 Oct 2011 21:46:00 +0000 (14:46 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 4 Oct 2011 23:19:17 +0000 (01:19 +0200)
Don't manipulate the new_dos_attributes bits until we know it's not a POSIX open.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Oct  5 01:19:17 CEST 2011 on sn-devel-104

source3/smbd/open.c

index 61d1a2e3ccc6346a800e3e75dff3423c2654848a..a44f15f0cc5a41b88ea2f2fb7c508f3a49e01f83 100644 (file)
@@ -1541,12 +1541,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 
        ZERO_STRUCT(id);
 
-       /* Windows allows a new file to be created and
-          silently removes a FILE_ATTRIBUTE_DIRECTORY
-          sent by the client. Do the same. */
-
-       new_dos_attributes &= ~FILE_ATTRIBUTE_DIRECTORY;
-
        if (conn->printer) {
                /*
                 * Printers are handled completely differently.
@@ -1580,6 +1574,12 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                unx_mode = (mode_t)(new_dos_attributes & ~FILE_FLAG_POSIX_SEMANTICS);
                new_dos_attributes = 0;
        } else {
+               /* Windows allows a new file to be created and
+                  silently removes a FILE_ATTRIBUTE_DIRECTORY
+                  sent by the client. Do the same. */
+
+               new_dos_attributes &= ~FILE_ATTRIBUTE_DIRECTORY;
+
                /* We add FILE_ATTRIBUTE_ARCHIVE to this as this mode is only used if the file is
                 * created new. */
                unx_mode = unix_mode(conn, new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE,