From: Jeremy Allison Date: Mon, 8 Aug 2022 20:18:56 +0000 (-0700) Subject: s3: smbd: In filename_convert_dirfsp_nosymlink(), cope with an MS-DFS link as the... X-Git-Tag: talloc-2.4.0~1452 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d80bedc3c418b6839b1bde78ba8d3db06611be2a;p=thirdparty%2Fsamba.git s3: smbd: In filename_convert_dirfsp_nosymlink(), cope with an MS-DFS link as the terminal component. If the terminal component was an MSDFS link, openat_pathref_fsp_case_insensitive() will return NT_STATUS_OBJECT_NAME_NOT_FOUND with a VALID_STAT of a symlink. If this is the case, check if we actually found a terminal MS-DFS link at the end of the pathname and return NT_STATUS_PATH_NOT_COVERED. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15144 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 41144097362..3e7909a48c8 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -2635,6 +2635,19 @@ static NTSTATUS filename_convert_dirfsp_nosymlink( char *normalized = NULL; if (VALID_STAT(smb_fname_rel->st)) { + /* + * If we're on an MSDFS share, see if this is + * an MSDFS link. + */ + if (lp_host_msdfs() && + lp_msdfs_root(SNUM(conn)) && + S_ISLNK(smb_fname_rel->st.st_ex_mode) && + is_msdfs_link(smb_dirname->fsp, smb_fname_rel)) + { + status = NT_STATUS_PATH_NOT_COVERED; + goto fail; + } + #if defined(WITH_SMB1SERVER) /* * In SMB1 posix mode, if this is a symlink,