]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: inherit st_ex_mode to basename from stream name in create_file_unixpath()
authorRalph Boehme <slow@samba.org>
Tue, 12 Jan 2021 11:23:38 +0000 (12:23 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 14 Jan 2021 17:55:33 +0000 (17:55 +0000)
This ensures smb_fname_base knows if it's a file or directory.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index dbae6d85851633d8a7f5839b8505090d069f13e9..b82eb2f02b92ce2bcb346f137442e33f8e9a8b93 100644 (file)
@@ -5716,7 +5716,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                smb_fname_base = synthetic_smb_fname(talloc_tos(),
                                                smb_fname->base_name,
                                                NULL,
-                                               NULL,
+                                               &smb_fname->st,
                                                smb_fname->twrp,
                                                smb_fname->flags);
                if (smb_fname_base == NULL) {
@@ -5724,6 +5724,8 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                        goto fail;
                }
 
+               SET_STAT_INVALID(smb_fname_base->st);
+
                /*
                 * We may be creating the basefile as part of creating the
                 * stream, so it's legal if the basefile doesn't exist at this