]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python:tests: Allocate OID range for testing to avoid collisions
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 25 Aug 2022 08:21:01 +0000 (20:21 +1200)
committerRalph Boehme <slow@samba.org>
Thu, 25 Aug 2022 13:55:47 +0000 (13:55 +0000)
sid_strings.py used the same OID range as ldap_schema.py, which
occasionally led to test failures when the same OID was generated twice.
Using a different range, and making use of the expected RID if we have
it, should reduce the likelihood of collisions.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Aug 25 13:55:47 UTC 2022 on sn-devel-184

python/samba/tests/sid_strings.py
source4/setup/schema_samba4.ldif

index ece35c12bfcc2fe956a9f5b7eb2619e77f37578b..71b7756d235fb4e207d955df1c702936d146f933 100644 (file)
@@ -88,11 +88,17 @@ class SidStringTests(TestCase):
 
         class_dn = f'CN={class_name},{self.schema_dn}'
 
+        governs_id = f'1.3.6.1.4.1.7165.4.6.2.9.{random_suffix}'
+        if expected_sid is not None:
+            # Append the RID to our OID to ensure more uniqueness.
+            rid = expected_sid.rsplit('-', 1)[1]
+            governs_id += f'.{rid}'
+
         ldif = f'''
 dn: {class_dn}
 objectClass: classSchema
 cn: {class_name}
-governsId: 1.3.6.1.4.1.7165.4.6.2.6.3.{random_suffix}
+governsId: {governs_id}
 subClassOf: top
 possSuperiors: domainDNS
 defaultSecurityDescriptor: O:{code}
index 54f48bde20e655dca8632d2b58c6d2f4997c07cd..d3a1f1c9ad70cf90c10839d1d83a88669fe7f33d 100644 (file)
@@ -32,6 +32,7 @@
 ## 1.3.6.1.4.1.7165.4.6.2.6.x - ldap_schema.py
 ## 1.3.6.1.4.1.7165.4.6.2.7.x - dsdb_schema_info.py
 ## 1.3.6.1.4.1.7165.4.6.2.8.x - getnc_schema.py
+## 1.3.6.1.4.1.7165.4.6.2.9.x - sid_strings.py
 
 ## 1.3.6.1.4.1.7165.4.255.x - mapped OIDs due to conflicts between AD and standards-track
 #