Fix bug 9519 - Samba returns unexpected error on SMB posix open.
authorJeremy Allison <jra@samba.org>
Tue, 12 Feb 2013 18:48:09 +0000 (10:48 -0800)
committerKarolin Seeger <kseeger@samba.org>
Wed, 13 Feb 2013 20:13:52 +0000 (21:13 +0100)
Explicitly ignore bare O_EXCL flags instead of returning INVALID_PARAMETER.
That's what the Linux kernel does.

Signed-off-by: Jeremy Allison <jra@samba.org>
Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Wed Feb 13 21:13:52 CET 2013 on sn-devel-104

source3/smbd/trans2.c

index 6f3dc4e54c0945ee9d47a624a22691a9aa6abc0e..062af2583304711bb4815bde35f39df455db3cd6 100644 (file)
@@ -7411,12 +7411,19 @@ static NTSTATUS smb_posix_open(connection_struct *conn,
                        /* File exists open. File not exist create. */
                        create_disp = FILE_OPEN_IF;
                        break;
+               case SMB_O_EXCL:
+                       /* O_EXCL on its own without O_CREAT is undefined.
+                          We deliberately ignore it as some versions of
+                          Linux CIFSFS can send a bare O_EXCL on the
+                          wire which other filesystems in the kernel
+                          ignore. See bug 9519 for details. */
+
+                       /* Fallthrough. */
+
                case 0:
                        /* File exists open. File not exist fail. */
                        create_disp = FILE_OPEN;
                        break;
-               case SMB_O_EXCL:
-                       /* O_EXCL on its own without O_CREAT is undefined. */
                default:
                        DEBUG(5,("smb_posix_open: invalid create mode 0x%x\n",
                                (unsigned int)wire_open_mode ));