selftest: Adapt libsmbclient.readdirplus2 to unix extensions
authorVolker Lendecke <vl@samba.org>
Sun, 1 Mar 2020 17:41:15 +0000 (18:41 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 3 Mar 2020 17:48:38 +0000 (17:48 +0000)
A few lines above the mode check we created a file with mode
0666. With unix exensions we expect this back 1:1, without them the
server changes them on the fly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest/knownfail.d/libsmbclient
source4/torture/libsmbclient/libsmbclient.c

index 3f1ba03f3bf00c462f9857a564dc5a7842eb0831..43c3fb6774de093c4a104297ccb364b7a3cf436b 100644 (file)
@@ -1 +1,2 @@
-samba4.unix_ext.libsmbclient.readdirplus2.NT1.readdirplus2.*
+# We don't have SMB3 unix extensions yet
+samba4.unix_ext.libsmbclient.readdirplus2.SMB3.readdirplus2.*
index c1508680d99a87031a1d843916a06d2005dd888c..13bde24e9c0ac7c7172bf040de66f500fc056c39 100644 (file)
@@ -824,6 +824,9 @@ static bool torture_libsmbclient_readdirplus2(struct torture_context *tctx)
        struct stat st = {0};
        int ret;
        const char *smburl = torture_setting_string(tctx, "smburl", NULL);
+       bool unix_extensions = torture_setting_bool(
+               tctx, "unix_extensions", false);
+       mode_t expected_mode = 0;
 
        if (smburl == NULL) {
                torture_fail(tctx,
@@ -900,21 +903,26 @@ static bool torture_libsmbclient_readdirplus2(struct torture_context *tctx)
                                filename));
        }
 
-       /* Ensure mode is as expected. */
-       /*
-        * New file gets SMBC_FILE_MODE plus
-        * archive bit -> S_IXUSR
-        * !READONLY -> S_IWUSR.
-        */
+       if (unix_extensions) {
+               expected_mode = S_IFREG | 0666;
+       } else {
+               /*
+                * New file gets SMBC_FILE_MODE plus
+                * archive bit -> S_IXUSR
+                * !READONLY -> S_IWUSR.
+                */
+               expected_mode = SMBC_FILE_MODE|S_IXUSR|S_IWUSR;
+       }
+
        torture_assert_int_equal_goto(tctx,
                st2.st_mode,
-               SMBC_FILE_MODE|S_IXUSR|S_IWUSR,
+               expected_mode,
                success,
                done,
                talloc_asprintf(tctx,
                        "file %s st_mode should be 0%o, got 0%o'",
                        filename,
-                       SMBC_FILE_MODE|S_IXUSR|S_IWUSR,
+                       expected_mode,
                        (unsigned int)st2.st_mode));
 
        /* Ensure smbc_stat() gets the same data. */