From 36a074bb1a23df2bc6e4d6c6b6cfd7023e6ea58d Mon Sep 17 00:00:00 2001 From: Samuel Cabrero Date: Thu, 13 May 2021 17:01:47 +0200 Subject: [PATCH] s3: smbd: Skip calling SMB_VFS_FREADDIR_ATTR() for symlinks Signed-off-by: Samuel Cabrero --- source3/smbd/trans2.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 7977468bd95..2777124c8c6 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1784,12 +1784,20 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, } allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn, NULL, &smb_fname->st); - status = SMB_VFS_FREADDIR_ATTR(smb_fname->fsp, - ctx, - &readdir_attr_data); - if (!NT_STATUS_IS_OK(status)) { - if (!NT_STATUS_EQUAL(NT_STATUS_NOT_SUPPORTED, status)) { - return status; + /* + * Skip SMB_VFS_FREADDIR_ATTR if the directory entry is a symlink or + * a DFS symlink. + */ + if (smb_fname->fsp != NULL && + !(mode & FILE_ATTRIBUTE_REPARSE_POINT)) { + status = SMB_VFS_FREADDIR_ATTR(smb_fname->fsp, + ctx, + &readdir_attr_data); + if (!NT_STATUS_IS_OK(status)) { + if (!NT_STATUS_EQUAL(NT_STATUS_NOT_SUPPORTED, + status)) { + return status; + } } } -- 2.47.3