]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Make a fake file's stat a valid regular file
authorVolker Lendecke <vl@samba.org>
Mon, 23 Oct 2023 14:40:55 +0000 (16:40 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 7 Nov 2023 12:46:37 +0000 (12:46 +0000)
We'll add strict checks to only open IFDIR and IFREG soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/filename.c

index 9f4ae7b5c815f8b23997004391374ac75e29353c..a37d0709d0f0f903aaef3a2336faa7d6aa59352d 100644 (file)
@@ -953,7 +953,10 @@ static NTSTATUS filename_convert_dirfsp_nosymlink(
                if (smb_fname == NULL) {
                        return NT_STATUS_NO_MEMORY;
                }
-               smb_fname->st = (SMB_STRUCT_STAT) { .st_ex_nlink = 1 };
+               smb_fname->st = (SMB_STRUCT_STAT){
+                       .st_ex_nlink = 1,
+                       .st_ex_mode = S_IFREG | 0644,
+               };
                smb_fname->st.st_ex_btime =
                        (struct timespec){0, SAMBA_UTIME_OMIT};
                smb_fname->st.st_ex_atime =