diff options
Diffstat (limited to 'source4/dsdb/tests/python')
-rwxr-xr-x | source4/dsdb/tests/python/acl.py | 6 | ||||
-rwxr-xr-x | source4/dsdb/tests/python/ldap.py | 6 | ||||
-rw-r--r-- | source4/dsdb/tests/python/ldap_syntaxes.py | 9 | ||||
-rwxr-xr-x | source4/dsdb/tests/python/sec_descriptor.py | 6 |
4 files changed, 5 insertions, 22 deletions
diff --git a/source4/dsdb/tests/python/acl.py b/source4/dsdb/tests/python/acl.py index 9a0e754ccf..c540e7e2fe 100755 --- a/source4/dsdb/tests/python/acl.py +++ b/source4/dsdb/tests/python/acl.py @@ -59,15 +59,11 @@ creds.set_gensec_features(creds.get_gensec_features() | gensec.FEATURE_SEAL) class AclTests(samba.tests.TestCase): - def find_domain_sid(self, ldb): - res = ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE) - return ndr_unpack(security.dom_sid,res[0]["objectSid"][0]) - def setUp(self): super(AclTests, self).setUp() self.ldb_admin = ldb self.base_dn = ldb.domain_dn() - self.domain_sid = self.find_domain_sid(self.ldb_admin) + self.domain_sid = security.dom_sid(ldb.get_domain_sid()) self.user_pass = "samba123@" self.configuration_dn = self.ldb_admin.get_config_basedn().get_linearized() print "baseDN: %s" % self.base_dn diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index f11176b2a5..f23de8dbe6 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -62,10 +62,6 @@ creds = credopts.get_credentials(lp) class BasicTests(unittest.TestCase): - def find_domain_sid(self): - res = self.ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE) - return ndr_unpack( security.dom_sid,res[0]["objectSid"][0]) - def setUp(self): super(BasicTests, self).setUp() self.ldb = ldb @@ -73,7 +69,7 @@ class BasicTests(unittest.TestCase): self.base_dn = ldb.domain_dn() self.configuration_dn = ldb.get_config_basedn().get_linearized() self.schema_dn = ldb.get_schema_basedn().get_linearized() - self.domain_sid = self.find_domain_sid() + self.domain_sid = security.dom_sid(ldb.get_domain_sid()) print "baseDN: %s\n" % self.base_dn diff --git a/source4/dsdb/tests/python/ldap_syntaxes.py b/source4/dsdb/tests/python/ldap_syntaxes.py index f1f30c738d..54198d7fc4 100644 --- a/source4/dsdb/tests/python/ldap_syntaxes.py +++ b/source4/dsdb/tests/python/ldap_syntaxes.py @@ -51,10 +51,6 @@ creds = credopts.get_credentials(lp) class SyntaxTests(unittest.TestCase): - def _find_domain_sid(self): - res = self.ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE) - return ndr_unpack( security.dom_sid,res[0]["objectSid"][0]) - def setUp(self): super(SyntaxTests, self).setUp() self.ldb = ldb @@ -62,7 +58,6 @@ class SyntaxTests(unittest.TestCase): self.schema_dn = ldb.get_schema_basedn().get_linearized() self._setup_dn_string_test() self._setup_dn_binary_test() - self.domain_sid = self._find_domain_sid() def _setup_dn_string_test(self): """Testing DN+String syntax""" @@ -279,7 +274,7 @@ name: """ + object_name + """ # add object with SID instead of DN object_name4 = "obj-DN-String4" + time.strftime("%s", time.gmtime()) ldif = self._get_object_ldif(object_name4, self.dn_string_class_name, self.dn_string_class_ldap_display_name, - self.dn_string_attribute, ": S:5:ABCDE:<SID=%s>" % self.domain_sid) + self.dn_string_attribute, ": S:5:ABCDE:<SID=%s>" % self.ldb.get_domain_sid()) try: self.ldb.add_ldif(ldif) except LdbError, (num, _): @@ -365,7 +360,7 @@ name: """ + object_name + """ # add object with SID instead of DN object_name4 = "obj-DN-Binary4" + time.strftime("%s", time.gmtime()) ldif = self._get_object_ldif(object_name4, self.dn_binary_class_name, self.dn_binary_class_ldap_display_name, - self.dn_binary_attribute, ": B:4:1234:<SID=%s>" % self.domain_sid) + self.dn_binary_attribute, ": B:4:1234:<SID=%s>" % self.ldb.get_domain_sid()) try: self.ldb.add_ldif(ldif) except LdbError, (num, _): diff --git a/source4/dsdb/tests/python/sec_descriptor.py b/source4/dsdb/tests/python/sec_descriptor.py index 54e2444f3c..17fed0ecc8 100755 --- a/source4/dsdb/tests/python/sec_descriptor.py +++ b/source4/dsdb/tests/python/sec_descriptor.py @@ -60,10 +60,6 @@ creds.set_gensec_features(creds.get_gensec_features() | gensec.FEATURE_SEAL) class DescriptorTests(samba.tests.TestCase): - def find_domain_sid(self, ldb): - res = ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE) - return ndr_unpack( security.dom_sid,res[0]["objectSid"][0]) - def get_users_domain_dn(self, name): return "CN=%s,CN=Users,%s" % (name, self.base_dn) @@ -188,7 +184,7 @@ showInAdvancedViewOnly: TRUE self.base_dn = ldb.domain_dn() self.configuration_dn = self.ldb_admin.get_config_basedn().get_linearized() self.schema_dn = self.ldb_admin.get_schema_basedn().get_linearized() - self.domain_sid = self.find_domain_sid(self.ldb_admin) + self.domain_sid = security.dom_sid(self.ldb_admin.get_domain_sid()) print "baseDN: %s" % self.base_dn ################################################################################################ |