]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use vfs_stat() in dptr_ReadDirName()
authorRalph Boehme <slow@samba.org>
Wed, 14 Oct 2020 13:48:07 +0000 (15:48 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:31 +0000 (09:08 +0000)
This is subtle: we inherit the smb_fname flags from the directory to its
directory entries while listing a directory. This means if were listing a
directory in POSIX context, we now treat all entries as POSIX paths and
correctly call lstat() on the entries instead of stat().

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

index 7c2dbb140569a0729a4c5cd4f0ac971380011a93..6f70e192daebe955c1f9ea6e3e115a7e14244e44 100644 (file)
@@ -493,10 +493,11 @@ static char *dptr_ReadDirName(TALLOC_CTX *ctx,
        /* Create an smb_filename with stream_name == NULL. */
        smb_fname_base = (struct smb_filename) {
                .base_name = pathreal,
+               .flags = dptr->dir_hnd->fsp->fsp_name->flags,
                .twrp = dptr->smb_dname->twrp,
        };
 
-       if (SMB_VFS_STAT(dptr->conn, &smb_fname_base) == 0) {
+       if (vfs_stat(dptr->conn, &smb_fname_base) == 0) {
                *pst = smb_fname_base.st;
                name = talloc_strdup(ctx, dptr->wcard);
                goto clean;