]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Skip loop iteration if attribute has no values
authorJo Sutton <josutton@catalyst.net.nz>
Fri, 19 Apr 2024 00:57:50 +0000 (12:57 +1200)
committerJo Sutton <jsutton@samba.org>
Sun, 21 Apr 2024 22:10:35 +0000 (22:10 +0000)
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/krb5/kdc_base_test.py

index 11ad210dc418e1e6cb15e178938cd55857f84146..a2525a4299cb01b67dbfb2a6e3f494585f10426c 100644 (file)
@@ -1161,10 +1161,11 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest):
         keys = {}
 
         for attr in attributes:
+            if not attr.value_ctr.num_values:
+                continue
+
             if attr.attid == drsuapi.DRSUAPI_ATTID_supplementalCredentials:
                 net_ctx.replicate_decrypt(bind, attr, rid)
-                if attr.value_ctr.num_values == 0:
-                    continue
                 attr_val = attr.value_ctr.values[0].blob
 
                 spl = ndr_unpack(drsblobs.supplementalCredentialsBlob,
@@ -1182,9 +1183,8 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest):
                                 keys[keytype] = key.value.hex()
             elif attr.attid == drsuapi.DRSUAPI_ATTID_unicodePwd:
                 net_ctx.replicate_decrypt(bind, attr, rid)
-                if attr.value_ctr.num_values > 0:
-                    pwd = attr.value_ctr.values[0].blob
-                    keys[kcrypto.Enctype.RC4] = pwd.hex()
+                pwd = attr.value_ctr.values[0].blob
+                keys[kcrypto.Enctype.RC4] = pwd.hex()
 
         if expected_etypes is None:
             expected_etypes = self.get_default_enctypes(creds)