From: Ralph Boehme Date: Wed, 14 Oct 2020 13:48:07 +0000 (+0200) Subject: smbd: use vfs_stat() in dptr_ReadDirName() X-Git-Tag: samba-4.14.0rc1~324 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37e6783f417a176b264ef6506174c0bbfe74f405;p=thirdparty%2Fsamba.git smbd: use vfs_stat() in dptr_ReadDirName() 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 7c2dbb14056..6f70e192dae 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -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;