]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture/smb2: Fix torture test case smb2.acls.ACCESS_BASED
authorVinit Agnihotri <vagnihot@redhat.com>
Wed, 30 Jul 2025 04:46:05 +0000 (10:16 +0530)
committerAnoop C S <anoopcs@samba.org>
Wed, 13 Aug 2025 18:29:53 +0000 (18:29 +0000)
Currently this test case fails to run against windows target, as
it is hardcoded to use sharename as "hideunread".

This change enables this test case to be executed against windows,
by omitting use of hideunread share and relevant flags.

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Aug 13 18:29:53 UTC 2025 on atb-devel-224

source4/torture/smb2/acls.c

index ef1f70cb7260fbf7f611adfc8d85f7876774a9f2..65b4b0fe3639112385108bbbf29c7d05d017441e 100644 (file)
@@ -2201,12 +2201,16 @@ static bool test_access_based(struct torture_context *tctx,
        ZERO_STRUCT(fhandle);
        ZERO_STRUCT(dhandle);
 
-       if (!torture_smb2_con_share(tctx, "hideunread", &tree1)) {
-               torture_result(tctx, TORTURE_FAIL, "(%s) Unable to connect "
-                       "to share 'hideunread'\n",
-                       __location__);
-               ret = false;
-               goto done;
+       if (TARGET_IS_WINDOWS(tctx)) {
+               tree1 = tree;
+       } else {
+               if (!torture_smb2_con_share(tctx, "hideunread", &tree1)) {
+                       torture_result(tctx, TORTURE_FAIL, "(%s) Unable to connect "
+                               "to share 'hideunread'\n",
+                              __location__);
+                       ret = false;
+                       goto done;
+               }
        }
 
        flags = smb2cli_tcon_flags(tree1->smbXcli);
@@ -2216,7 +2220,8 @@ static bool test_access_based(struct torture_context *tctx,
 
        torture_comment(tctx, "TESTING ACCESS BASED ENUMERATION\n");
 
-       if ((flags & SMB2_SHAREFLAG_ACCESS_BASED_DIRECTORY_ENUM)==0) {
+       if (((flags & SMB2_SHAREFLAG_ACCESS_BASED_DIRECTORY_ENUM)==0) &&
+           (!TARGET_IS_WINDOWS(tctx))) {
                torture_result(tctx, TORTURE_FAIL, "(%s) No access enumeration "
                        "on share 'hideunread'\n",
                        __location__);
@@ -2346,8 +2351,12 @@ done:
                smb2_tdis(tree1);
                smb2_logoff(tree1->session);
        }
-       smb2_tdis(tree);
-       smb2_logoff(tree->session);
+
+       if (tree != tree1) {
+               smb2_tdis(tree);
+               smb2_logoff(tree->session);
+       }
+
        return ret;
 }