tests/krb5: Initialize variable
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 29 Sep 2023 00:27:39 +0000 (13:27 +1300)
committerJoseph Sutton <jsutton@samba.org>
Sun, 1 Oct 2023 22:45:38 +0000 (22:45 +0000)
This avoids the following exception:

Exception: Traceback (most recent call last):
  File "/samba/bin/python/samba/tests/krb5/kdc_tgs_tests.py", line 2500, in test_renew_pac_request_false
    tgt = self._modify_tgt(tgt, renewable=True)
  File "samba/bin/python/samba/tests/krb5/kdc_tgs_tests.py", line 3014, in _modify_tgt
    return self.modified_ticket(
  File "/samba/bin/python/samba/tests/krb5/raw_testcase.py", line 5694, in modified_ticket
    auth_data, new_pac,
UnboundLocalError: local variable 'new_pac' referenced before assignment

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

index ed4765d95da503f236c72d8886e37870231d9fdd..8e49dbb50436c44e92e8582ad5f546457377ff41 100644 (file)
@@ -5640,9 +5640,9 @@ class RawKerberosTest(TestCase):
         if expect_pac:
             self.assertIsNotNone(auth_data)
         if auth_data is not None:
+            new_pac = None
             if exclude_pac:
                 need_to_call_replace_pac = True
-                new_pac = None
             elif not modify_pac_fn and not update_pac_checksums:
                 need_to_call_replace_pac = False
             else: