]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Use consistent time between get_KerberosTime() calls
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 17 May 2023 23:03:40 +0000 (11:03 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 18 May 2023 04:53:30 +0000 (04:53 +0000)
Otherwise get_KerberosTime() calls time.time() itself, the value of
which can change between calls.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/krb5/raw_testcase.py

index fe64fa777ce4e977870f26db47573618381b2f6e..be725467c3077f0acacc34dbf95370a7ded5ef42 100644 (file)
@@ -4984,13 +4984,15 @@ class RawKerberosTest(TestCaseInTempDir):
             krb5pac.PAC_TYPE_KDC_CHECKSUM: krbtgt_key,
         }
 
+        current_time = time.time()
+
         # Set authtime and starttime to an hour in the past, to show that they
         # do not affect ticket rejection.
-        start_time = self.get_KerberosTime(offset=-60 * 60)
+        start_time = self.get_KerberosTime(epoch=current_time, offset=-60 * 60)
 
         # Set the endtime of the ticket relative to our current time, so that
         # the ticket has 'lifetime' seconds remaining to live.
-        end_time = self.get_KerberosTime(offset=lifetime)
+        end_time = self.get_KerberosTime(epoch=current_time, offset=lifetime)
 
         # Modify the times in the ticket.
         def modify_ticket_times(enc_part):