s3:smbd: add private option NTCREATEX_OPTIONS_PRIVATE_STREAM_BASEOPEN
authorRalph Boehme <slow@samba.org>
Sun, 27 May 2018 11:01:50 +0000 (13:01 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 12 Jul 2018 11:11:22 +0000 (13:11 +0200)
This will be used to mark basefile opens of streams opens. This is
needed to later implement a function that can determine if a file has
stream opens.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 37e7ff05ab9443c0330e68f5c701ffecedf2d738)

source3/include/smb.h
source3/smbd/open.c

index 24a73e57a3d97a392e7b91da871196622e81dd2e..df2cd2a3817d820548b30ba0125507aa1fff96f0 100644 (file)
@@ -420,6 +420,9 @@ Offset  Data                        length.
 /* Private options for printer support */
 #define NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE 0x0008
 
+/* Private option for streams support */
+#define NTCREATEX_OPTIONS_PRIVATE_STREAM_BASEOPEN 0x0010
+
 /* Flag for NT transact rename call. */
 #define RENAME_REPLACE_IF_EXISTS 1
 
index cd2f1c0baf9ed4bbeeb97a21b886531e44333c40..a47f4c9c091075eed98535679b7b2606cb8374aa 100644 (file)
@@ -5092,6 +5092,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
            && (!(private_flags & NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE))) {
                uint32_t base_create_disposition;
                struct smb_filename *smb_fname_base = NULL;
+               uint32_t base_privflags;
 
                if (create_options & FILE_DIRECTORY_FILE) {
                        status = NT_STATUS_NOT_A_DIRECTORY;
@@ -5142,13 +5143,17 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                        }
                }
 
+               base_privflags = NTCREATEX_OPTIONS_PRIVATE_STREAM_BASEOPEN;
+
                /* Open the base file. */
                status = create_file_unixpath(conn, NULL, smb_fname_base, 0,
                                              FILE_SHARE_READ
                                              | FILE_SHARE_WRITE
                                              | FILE_SHARE_DELETE,
                                              base_create_disposition,
-                                             0, 0, 0, NULL, 0, 0, NULL, NULL,
+                                             0, 0, 0, NULL, 0,
+                                             base_privflags,
+                                             NULL, NULL,
                                              &base_fsp, NULL);
                TALLOC_FREE(smb_fname_base);