]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
torture/smb2: do not use client time in delayed timestamp updates test
authorAmir Goldstein <amir@ctera.com>
Tue, 14 Mar 2023 17:57:08 +0000 (19:57 +0200)
committerRalph Boehme <slow@samba.org>
Sat, 1 Apr 2023 06:23:36 +0000 (06:23 +0000)
Client time cannot be compared to server timestamp, because the clocks
on client and server may not be in sync.

Compare server timestamps, only to previous timestamps read from server.

Signed-off-by: Amir Goldstein <amir@ctera.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Apr  1 06:23:36 UTC 2023 on atb-devel-224

source4/torture/smb2/timestamps.c

index 33160b067652e50f6f3cad6c09e08f8c48758f11..f8fb676e44f7550d8a8a6b0afe7af10edf3a401d 100644 (file)
@@ -1064,8 +1064,6 @@ static bool test_delayed_2write(struct torture_context *tctx,
        NTTIME create_time;
        NTTIME write_time;
        NTTIME write_time2;
-       struct timespec now;
-       NTTIME send_close_time;
        NTTIME close_time;
        NTSTATUS status;
        bool ret = true;
@@ -1141,8 +1139,7 @@ static bool test_delayed_2write(struct torture_context *tctx,
        torture_comment(tctx, "Close file-handle 1\n");
        sleep(2);
 
-       now = timespec_current();
-       send_close_time = full_timespec_to_nt_time(&now);
+       torture_comment(tctx, "Check writetime has been updated\n");
 
        c = (struct smb2_close) {
                .in.file.handle = h1,
@@ -1155,7 +1152,7 @@ static bool test_delayed_2write(struct torture_context *tctx,
        ZERO_STRUCT(h1);
        close_time = c.out.write_time;
 
-       if (!(close_time > send_close_time)) {
+       if (!(close_time > write_time)) {
                ret = false;
                torture_fail_goto(tctx, done,
                                  "Write-time not updated (wrong!)\n");