s3: smbd: Files or directories can't be opened DELETE_ON_CLOSE without delete access.
authorJeremy Allison <jra@samba.org>
Wed, 28 Mar 2018 19:42:20 +0000 (12:42 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 29 Mar 2018 18:31:34 +0000 (20:31 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
source3/smbd/open.c

index be9e601bb1518dc07babdbcd8605f43c50263c4a..643e074f399a688c508d2e91e52e3aee0ec8da9e 100644 (file)
@@ -5120,6 +5120,18 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                goto fail;
        }
 
+       /*
+        * Files or directories can't be opened DELETE_ON_CLOSE without
+        * delete access.
+        * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358
+        */
+       if (create_options & FILE_DELETE_ON_CLOSE) {
+               if ((access_mask & DELETE_ACCESS) == 0) {
+                       status = NT_STATUS_INVALID_PARAMETER;
+                       goto fail;
+               }
+       }
+
        if ((conn->fs_capabilities & FILE_NAMED_STREAMS)
            && is_ntfs_stream_smb_fname(smb_fname)
            && (!(private_flags & NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE))) {