]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: In filename_convert_dirfsp_nosymlink(), cope with an MS-DFS link as the...
authorJeremy Allison <jra@samba.org>
Mon, 8 Aug 2022 20:18:56 +0000 (13:18 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 12 Aug 2022 18:19:31 +0000 (18:19 +0000)
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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/filename.c

index 411440973627c314ca952095609ab17fe7730020..3e7909a48c8b01c55c88be8ac075943a5c087d6f 100644 (file)
@@ -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,