s3:smb2_tcon: Add check to prevent non-DFS clients from connecting to an msdfs proxy.
authorRalph Wuerthner <ralph.wuerthner@de.ibm.com>
Thu, 29 Mar 2018 08:00:41 +0000 (10:00 +0200)
committerJeremy Allison <jra@samba.org>
Sat, 7 Apr 2018 03:05:22 +0000 (05:05 +0200)
Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr  7 05:05:22 CEST 2018 on sn-devel-144

source3/smbd/smb2_tcon.c

index 07e01cddd46365675246575c63eaa1de3f515bc0..ebd31602efcd8b2349f2e81fe2c1ac29e756e0eb 100644 (file)
@@ -270,6 +270,21 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
                return NT_STATUS_BAD_NETWORK_NAME;
        }
 
+       /* Handle non-DFS clients attempting connections to msdfs proxy */
+       if (lp_host_msdfs()) {
+               char *proxy = lp_msdfs_proxy(talloc_tos(), snum);
+
+               if ((proxy != NULL) && (*proxy != '\0')) {
+                       DBG_NOTICE("refusing connection to dfs proxy share "
+                                  "'%s' (pointing to %s)\n",
+                                  service,
+                                  proxy);
+                       TALLOC_FREE(proxy);
+                       return NT_STATUS_BAD_NETWORK_NAME;
+               }
+               TALLOC_FREE(proxy);
+       }
+
        if ((lp_smb_encrypt(snum) >= SMB_SIGNING_DESIRED) &&
            (conn->smb2.server.cipher != 0))
        {