From b5f6809593524e7e9aca1c09ff379e02a1cde61b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 8 Aug 2022 11:31:39 -0700 Subject: [PATCH] s3: smbd: Allow openat_pathref_dirfsp_nosymlink() to return NT_STATUS_PATH_NOT_COVERED for a DFS link on a DFS share. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15144 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/files.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 1cd146dedc7..72d1bc7d555 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -856,6 +856,18 @@ next: *unparsed = len - parsed; } } + /* + * If we're on an MSDFS share, see if this is + * an MSDFS link. + */ + if (lp_host_msdfs() && + lp_msdfs_root(SNUM(conn)) && + (substitute != NULL) && + strnequal(*substitute, "msdfs:", 6) && + is_msdfs_link(dirfsp, &rel_fname)) + { + status = NT_STATUS_PATH_NOT_COVERED; + } } else { DBG_DEBUG("readlink_talloc failed: %s\n", -- 2.47.3