diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index be24854f89c..73e88add2c3 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -41,6 +41,10 @@ uint32_t ucf_flags_from_smb_request(struct smb_request *req) if (req->posix_pathnames) { ucf_flags |= UCF_POSIX_PATHNAMES; + + if (!req->sconn->using_smb2) { + ucf_flags |= UCF_LCOMP_LNK_OK; + } } if (req->flags2 & FLAGS2_DFS_PATHNAMES) { ucf_flags |= UCF_DFS_PATHNAME; @@ -1251,7 +1255,7 @@ static NTSTATUS filename_convert_dirfsp_nosymlink( * In SMB1 posix mode, if this is a symlink, * allow access to the name with a NULL smb_fname->fsp. */ - if (!conn->sconn->using_smb2 && posix) { + if (ucf_flags & UCF_LCOMP_LNK_OK) { SMB_ASSERT(smb_fname_rel->fsp == NULL); SMB_ASSERT(streamname == NULL); diff --git a/source3/smbd/smbd.h b/source3/smbd/smbd.h index 6cf2b64a5a1..1c98bea4334 100644 --- a/source3/smbd/smbd.h +++ b/source3/smbd/smbd.h @@ -84,6 +84,10 @@ struct trans_state { #define UCF_POSIX_PATHNAMES 0x00000008 /* #define UCF_UNIX_NAME_LOOKUP 0x00000010 is no longer used. */ #define UCF_PREP_CREATEFILE 0x00000020 +/* + * Return a non-fsp smb_fname for a symlink + */ +#define UCF_LCOMP_LNK_OK 0x00000040 /* * Use the same bit as FLAGS2_REPARSE_PATH * which means the same thing.