From: Andrew Bartlett Date: Mon, 18 Apr 2016 02:58:10 +0000 (+1200) Subject: selftest: Use random OIDs from under the Samba OID arc X-Git-Tag: tdb-1.3.10~995 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5c6a97769c956f8cc1b3f0ff697e9dc5d0892587;p=thirdparty%2Fsamba.git selftest: Use random OIDs from under the Samba OID arc The urgent_replication.py test used the OID of uid, and this caused other tests to fail The other random OIDs should have been from under our arc, not under iso.member-body.us We split up the range a little to avoid some of the birthday paradox, in the tests that create multiple OIDs. Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam ") sambaopts = options.SambaOptions(parser) @@ -154,7 +155,7 @@ cn: test attributeSchema instanceType: 4 isSingleValued: FALSE showInAdvancedViewOnly: FALSE -attributeID: 0.9.2342.19200300.100.1.1 +attributeID: 1.3.6.1.4.1.7165.4.6.1.4.""" + str(random.randint(1,100000)) + """ attributeSyntax: 2.5.5.12 adminDisplayName: test attributeSchema adminDescription: test attributeSchema @@ -189,7 +190,7 @@ objectClass: classSchema cn: test classSchema instanceType: 4 subClassOf: top -governsID: 1.2.840.113556.1.5.999 +governsId: 1.3.6.1.4.1.7165.4.6.2.4.""" + str(random.randint(1,100000)) + """ rDNAttID: cn showInAdvancedViewOnly: TRUE adminDisplayName: test classSchema diff --git a/source4/setup/schema_samba4.ldif b/source4/setup/schema_samba4.ldif index 69aa363cc90..c331063301d 100644 --- a/source4/setup/schema_samba4.ldif +++ b/source4/setup/schema_samba4.ldif @@ -14,6 +14,17 @@ ## 1.3.6.1.4.1.7165.4.5.x - ldap extended matches +## 1.3.6.1.4.1.7165.4.6.1.x - SELFTEST random attributes +## 1.3.6.1.4.1.7165.4.6.1.1.x - ldap_syntaxes.py +## 1.3.6.1.4.1.7165.4.6.1.2.x - ldap_syntaxes.py +## 1.3.6.1.4.1.7165.4.6.1.4.x - urgent_replication.py + +## 1.3.6.1.4.1.7165.4.6.2.x - SELFTEST random classes +## 1.3.6.1.4.1.7165.4.6.2.1.x - ldap_syntaxes.py +## 1.3.6.1.4.1.7165.4.6.2.2.x - ldap_syntaxes.py +## 1.3.6.1.4.1.7165.4.6.2.3.x - sec_descriptor.py +## 1.3.6.1.4.1.7165.4.6.2.4.x - urgent_replication.py + ## 1.3.6.1.4.1.7165.4.255.x - mapped OIDs due to conflicts between AD and standards-track # # diff --git a/source4/torture/drs/python/repl_schema.py b/source4/torture/drs/python/repl_schema.py index aefeadb115e..23b2a398640 100644 --- a/source4/torture/drs/python/repl_schema.py +++ b/source4/torture/drs/python/repl_schema.py @@ -69,13 +69,14 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase): obj_dn = "CN=%s,%s" % (obj_name, self.schema_dn) return (obj_dn, obj_name, obj_ldn) - def _schema_new_class(self, ldb_ctx, base_name, attrs=None): + def _schema_new_class(self, ldb_ctx, base_name, base_int, attrs=None): (class_dn, class_name, class_ldn) = self._make_obj_names(base_name) rec = {"dn": class_dn, "objectClass": ["top", "classSchema"], "cn": class_name, "lDAPDisplayName": class_ldn, - "governsId": "1.2.840." + str(random.randint(1,100000)) + ".1.5.13", + "governsId": "1.3.6.1.4.1.7165.4.6.2." \ + + str((100000 * base_int) + random.randint(1,100000)) + ".1.5.13", "instanceType": "4", "objectClassCategory": "1", "subClassOf": "top", @@ -92,13 +93,14 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase): self._ldap_schemaUpdateNow(ldb_ctx) return (rec["lDAPDisplayName"], rec["dn"]) - def _schema_new_attr(self, ldb_ctx, base_name, attrs=None): + def _schema_new_attr(self, ldb_ctx, base_name, base_int, attrs=None): (attr_dn, attr_name, attr_ldn) = self._make_obj_names(base_name) rec = {"dn": attr_dn, "objectClass": ["top", "attributeSchema"], "cn": attr_name, "lDAPDisplayName": attr_ldn, - "attributeId": "1.2.841." + str(random.randint(1,100000)) + ".1.5.13", + "attributeId": "1.3.6.1.4.1.7165.4.6.1." \ + + str((100000 * base_int) + random.randint(1,100000)) + ".1.5.13", "attributeSyntax": "2.5.5.12", "omSyntax": "64", "instanceType": "4", @@ -133,7 +135,7 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase): def test_class(self): """Simple test for classSchema replication""" # add new classSchema object - (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, "cls-S") + (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, "cls-S", 0) # force replication from DC1 to DC2 self._net_drs_replicate(DC=self.dnsname_dc2, fromDC=self.dnsname_dc1, nc_dn=self.schema_dn) # check object is replicated @@ -147,7 +149,7 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase): c_ldn_last = None for i in range(1, 6): base_name = "cls-I-%02d" % i - (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, base_name) + (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, base_name, i) c_dn_list.append(c_dn) if c_ldn_last: # inherit from last class added @@ -170,14 +172,14 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase): This should check code path that searches for AttributeID_id in Schema cache""" # add new attributeSchema object - (a_ldn, a_dn) = self._schema_new_attr(self.ldb_dc1, "attr-A") + (a_ldn, a_dn) = self._schema_new_attr(self.ldb_dc1, "attr-A", 1) # add a base classSchema class so we can use our new # attribute in class definition in a sibling class - (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, "cls-A", + (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, "cls-A", 7, {"systemMayContain": a_ldn, "subClassOf": "classSchema"}) # add new classSchema object with value for a_ldb attribute - (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, "cls-B", + (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, "cls-B", 8, {"objectClass": ["top", "classSchema", c_ldn], a_ldn: "test_classWithCustomAttribute"}) # force replication from DC1 to DC2 @@ -189,7 +191,7 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase): def test_attribute(self): """Simple test for attributeSchema replication""" # add new attributeSchema object - (a_ldn, a_dn) = self._schema_new_attr(self.ldb_dc1, "attr-S") + (a_ldn, a_dn) = self._schema_new_attr(self.ldb_dc1, "attr-S", 2) # force replication from DC1 to DC2 self._net_drs_replicate(DC=self.dnsname_dc2, fromDC=self.dnsname_dc1, nc_dn=self.schema_dn) # check object is replicated @@ -201,9 +203,9 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase): and then check all objects are replicated correctly""" # add new classSchema object - (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, "cls-A") + (c_ldn, c_dn) = self._schema_new_class(self.ldb_dc1, "cls-A", 9) # add new attributeSchema object - (a_ldn, a_dn) = self._schema_new_attr(self.ldb_dc1, "attr-A") + (a_ldn, a_dn) = self._schema_new_attr(self.ldb_dc1, "attr-A", 3) # add attribute to the class we have m = Message.from_dict(self.ldb_dc1, diff --git a/source4/torture/drs/rpc/msds_intid.c b/source4/torture/drs/rpc/msds_intid.c index 9d84047f07f..13c9625cd4c 100644 --- a/source4/torture/drs/rpc/msds_intid.c +++ b/source4/torture/drs/rpc/msds_intid.c @@ -85,7 +85,7 @@ struct DsIntIdTestCtx { "objectClass: top\n" \ "objectClass: attributeSchema\n" \ "cn: msds-intid-%1$d\n" \ - "attributeID: 1.2.840.%1$d.1.5.9940\n" \ + "attributeID: 1.3.6.1.4.1.7165.4.6.1.%1$d.1.5.9940\n" \ "attributeSyntax: 2.5.5.10\n" \ "omSyntax: 4\n" \ "instanceType: 4\n" \