]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: torture: Add test to show an SMB1 DFS path of "\\x//\\/" crashes smbd.
authorJeremy Allison <jra@samba.org>
Wed, 26 Jul 2023 23:37:11 +0000 (16:37 -0700)
committerJule Anger <janger@samba.org>
Thu, 31 Aug 2023 08:40:09 +0000 (08:40 +0000)
Adds knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15419

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 2aa9ffa2f0fc79599efbfe0c37aac4ef5160f712)

selftest/knownfail.d/dfs_badpath [new file with mode: 0644]
source3/selftest/tests.py
source3/torture/proto.h
source3/torture/test_smb1_dfs.c
source3/torture/torture.c

diff --git a/selftest/knownfail.d/dfs_badpath b/selftest/knownfail.d/dfs_badpath
new file mode 100644 (file)
index 0000000..9fd16e9
--- /dev/null
@@ -0,0 +1 @@
+^samba3.smbtorture_s3.smb1.SMB1-DFS-BADPATH.smbtorture\(fileserver_smb1\)
index 809a2be631b1ecb27e35e7a5499a3d3bfd6c0833..0c834ed48b5e62e409e670ac9c8bd0ea953d0d19 100755 (executable)
@@ -388,6 +388,20 @@ plantestsuite("samba3.smbtorture_s3.smb1.SMB1-DFS-OPERATIONS",
                 '$PASSWORD',
                 smbtorture3,
                 "-mNT1"])
+#
+# SMB1-DFS-BADPATH needs to run against a special share msdfs-pathname-share
+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=15419
+#
+plantestsuite("samba3.smbtorture_s3.smb1.SMB1-DFS-BADPATH",
+                "fileserver_smb1",
+                [os.path.join(samba3srcdir,
+                              "script/tests/test_smbtorture_s3.sh"),
+                'SMB1-DFS-BADPATH',
+                '//$SERVER_IP/msdfs-pathname-share',
+                '$USERNAME',
+                '$PASSWORD',
+                smbtorture3,
+                "-mNT1"])
 
 #
 # SMB2-STREAM-ACL needs to run against a special share - vfs_wo_fruit
index 5e6d914c3da965867c1f4b7b70bfb9326041b402..5bfe4cc8e02c2e255415d130a4b5f135bd9f928e 100644 (file)
@@ -127,6 +127,7 @@ bool run_smb2_dfs_filename_leading_backslash(int dummy);
 bool run_smb1_dfs_paths(int dummy);
 bool run_smb1_dfs_search_paths(int dummy);
 bool run_smb1_dfs_operations(int dummy);
+bool run_smb1_dfs_check_badpath(int dummy);
 bool run_list_dir_async_test(int dummy);
 bool run_delete_on_close_non_empty(int dummy);
 bool run_delete_on_close_nonwrite_delete_yes_test(int dummy);
index 5dfa7b41b6efde62b997391d8ea31e730882a37d..6c8220844c12bc8c81e77b92509d1bf4771f9d33 100644 (file)
@@ -3814,6 +3814,26 @@ static bool test_smb1_chkpath(struct cli_state *cli)
        return retval;
 }
 
+/*
+ * Test BUG: https://bugzilla.samba.org/show_bug.cgi?id=15419
+ */
+
+static bool test_smb1_chkpath_bad(struct cli_state *cli)
+{
+       NTSTATUS status;
+
+       status = smb1_chkpath(cli, "\\x//\\/");
+       if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_NOT_FOUND)) {
+               printf("%s:%d SMB1chkpath of %s failed (%s)\n",
+                       __FILE__,
+                       __LINE__,
+                       "\\x//\\/",
+                       nt_errstr(status));
+               return false;
+       }
+       return true;
+}
+
 static NTSTATUS smb1_ctemp(struct cli_state *cli,
                           const char *path,
                           char **tmp_path)
@@ -4230,3 +4250,39 @@ bool run_smb1_dfs_operations(int dummy)
        (void)smb1_dfs_delete(cli, "\\BAD\\BAD\\file");
        return retval;
 }
+
+/*
+ * Test BUG: https://bugzilla.samba.org/show_bug.cgi?id=15419
+ */
+
+bool run_smb1_dfs_check_badpath(int dummy)
+{
+       struct cli_state *cli = NULL;
+       bool dfs_supported = false;
+
+       printf("Starting SMB1-DFS-CHECK-BADPATH\n");
+
+       if (!torture_init_connection(&cli)) {
+               return false;
+       }
+
+       if (!torture_open_connection(&cli, 0)) {
+               return false;
+       }
+
+       /* Ensure this is a DFS share. */
+       dfs_supported = smbXcli_conn_dfs_supported(cli->conn);
+       if (!dfs_supported) {
+               printf("Server %s does not support DFS\n",
+                       smbXcli_conn_remote_name(cli->conn));
+               return false;
+       }
+       dfs_supported = smbXcli_tcon_is_dfs_share(cli->smb1.tcon);
+       if (!dfs_supported) {
+               printf("Share %s does not support DFS\n",
+                       cli->share);
+               return false;
+       }
+
+       return test_smb1_chkpath_bad(cli);
+}
index 87ac0678526c5a02d05a6e59d661e9920c30b471..14a0347882b75d06d0eaf960565fe8933ff8d2f6 100644 (file)
@@ -15787,6 +15787,10 @@ static struct {
                .name  = "SMB1-DFS-OPERATIONS",
                .fn    = run_smb1_dfs_operations,
        },
+       {
+               .name  = "SMB1-DFS-BADPATH",
+               .fn    = run_smb1_dfs_check_badpath,
+       },
        {
                .name  = "CLEANUP1",
                .fn    = run_cleanup1,