]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbtorture: In run_smb1_dfs_paths() ensure we're actually reading and testing...
authorJeremy Allison <jra@samba.org>
Wed, 7 Sep 2022 22:15:38 +0000 (15:15 -0700)
committerNoel Power <npower@samba.org>
Mon, 12 Sep 2022 16:21:23 +0000 (16:21 +0000)
Ensures crtime of the root of the share and a newly created
file crtime are different. Should help avoid mistakes like the
error fixed by the previous commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Sep 12 16:21:23 UTC 2022 on sn-devel-184

source3/torture/test_smb1_dfs.c

index d8b7552935f64f44527c26c0e4b11f11c61e2178..1acea318e37561a9c25ee239655efd1d45f5c602 100644 (file)
@@ -1587,6 +1587,7 @@ bool run_smb1_dfs_paths(int dummy)
        bool crtime_matched = false;
        bool retval = false;
        bool ok = false;
+       bool equal = false;
        unsigned int i;
        uint16_t fnum = (uint16_t)-1;
 
@@ -1846,6 +1847,21 @@ bool run_smb1_dfs_paths(int dummy)
                goto err;
        }
 
+       /*
+        * This crtime must be different from the root_crtime.
+        * This checks we're actually correctly reading crtimes
+        * from the filesystem.
+        */
+       equal = (timespec_compare(&test_crtime, &root_crtime) == 0);
+       if (equal) {
+               printf("%s:%d Error. crtime of %s must differ from "
+                       "root_crtime\n",
+                       __FILE__,
+                       __LINE__,
+                       "BAD\\BAD\\file");
+               goto err;
+       }
+
        /*
         * Test different SMB1 renames
         * and hard links.