From 37e6783f417a176b264ef6506174c0bbfe74f405 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 14 Oct 2020 15:48:07 +0200 Subject: [PATCH] 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 --- source3/smbd/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.47.3