Fix bug #8507 - smbd doesn't correctly honor the "force create mode" bits from a...
authorJeremy Allison <jra@samba.org>
Tue, 4 Oct 2011 23:40:58 +0000 (16:40 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 24 Oct 2011 17:16:56 +0000 (19:16 +0200)
Don't manipulate the new_dos_attributes bits until we know it's not a POSIX open.
(cherry picked from commit 2bdf5042dd14283ae195d442d20385ed158367ae)

source3/smbd/open.c

index 9048d6b74e9916ac020c4a7c86d4620de8699e5d..70e6b4f56ec50cd5f06d4ccb0c477ed8112dadce 100644 (file)
@@ -1344,12 +1344,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.
@@ -1383,6 +1377,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 aARCH to this as this mode is only used if the file is
                 * created new. */
                unx_mode = unix_mode(conn, new_dos_attributes | aARCH,