s3: torture: Fix test SMB2-DFS-PATHS to pass against Windows server 2022.
authorJeremy Allison <jra@samba.org>
Tue, 27 Sep 2022 01:05:49 +0000 (18:05 -0700)
committerNoel Power <npower@samba.org>
Wed, 28 Sep 2022 18:36:35 +0000 (18:36 +0000)
There is only one difference between Windows 2022 and Windows 2008.

Opening an empty ("") DFS path succeeds in opening the share
root on Windows 2008 but fails with NT_STATUS_INVALID_PARAMETER
on Windows 2022. Allow the test to cope with both.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/torture/test_smb2.c

index 234b39fedec75d68b4b473cf7795f679c25f71d3..d3e9b4a6ad15a17fa1945c9a6bc2e3d31865aa4f 100644 (file)
@@ -4059,15 +4059,41 @@ bool run_smb2_dfs_paths(int dummy)
                return false;
        }
 
-       /* An "" (empty) server name should open and match the share root. */
-       ino_matched = smb2_inode_matches(cli,
-                                        dfs_root_share_name,
-                                        root_ino,
-                                        "");
-       if (!ino_matched) {
-               printf("%s:%d Failed to match ino number for %s\n",
+       /*
+        * An "" DFS empty server name should open and match the share root on
+        * Windows 2008. Windows 2022 returns NT_STATUS_INVALID_PARAMETER
+        * for a DFS empty server name.
+        */
+       status = get_smb2_inode(cli,
+                               "",
+                               &test_ino);
+       if (NT_STATUS_IS_OK(status)) {
+               /*
+                * Windows 2008 - open succeeded. Proceed to
+                * check ino number.
+                */
+               ino_matched = smb2_inode_matches(cli,
+                                                dfs_root_share_name,
+                                                root_ino,
+                                                "");
+               if (!ino_matched) {
+                       printf("%s:%d Failed to match ino number for %s\n",
+                               __FILE__,
+                               __LINE__,
+                               "");
+                       return false;
+               }
+       }
+       if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
+               /*
+                * For Windows 2022 we expect to fail with
+                * NT_STATUS_INVALID_PARAMETER. Anything else is
+                * unexpected.
+                */
+               printf("%s:%d Unexpected error (%s) getting ino number for %s\n",
                        __FILE__,
                        __LINE__,
+                       nt_errstr(status),
                        "");
                return false;
        }