From: Ralph Boehme Date: Tue, 12 Jan 2021 11:23:38 +0000 (+0100) Subject: smbd: inherit st_ex_mode to basename from stream name in create_file_unixpath() X-Git-Tag: samba-4.14.0rc1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=965c6d891103605dd23ba82f2a0cef1fc16ebc1c;p=thirdparty%2Fsamba.git smbd: inherit st_ex_mode to basename from stream name in create_file_unixpath() This ensures smb_fname_base knows if it's a file or directory. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index dbae6d85851..b82eb2f02b9 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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