def test_get_dc_with_domain_guid(self): """Ensure that we do not reject requests supplied with a NULL GUID""" null_guid = GUID() response = self._call_get_dc_name(domain=self.realm, domain_guid=null_guid, flags=netlogon.DS_RETURN_DNS_NAME) self.assertTrue(response.dc_unc is not None) self.assertTrue(response.dc_unc.startswith('\\\\')) self.assertTrue(response.dc_address is not None) self.assertTrue(response.dc_address.startswith('\\\\')) self.assertEqual(response.domain_name.lower(), self.realm.lower())
def setUp(self): super(SchemaInfoTestCase, self).setUp() # connect SamDB if we haven't yet if self.sam_db is None: ldb_url = "ldap://%s" % samba.tests.env_get_var_value("DC_SERVER") SchemaInfoTestCase.sam_db = samba.tests.connect_samdb(ldb_url) # fetch rootDSE res = self.sam_db.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"]) self.assertEquals(len(res), 1) self.schema_dn = res[0]["schemaNamingContext"][0] self.base_dn = res[0]["defaultNamingContext"][0] self.forest_level = int(res[0]["forestFunctionality"][0]) # get DC invocation_id self.invocation_id = GUID(self.sam_db.get_invocation_id())
def test_get_dc_over_winbind_domain_guid(self): """Ensure that we do not reject requests supplied with a NULL GUID""" if self.trust_realm is None: return null_guid = GUID() try: response_trust = self._call_get_dc_name(domain=self.trust_realm, domain_guid=null_guid, flags=netlogon.DS_RETURN_DNS_NAME) except WERRORError as e: self.fail("Unable to get NULL domain GUID result: " + str(e)) self.assertTrue(response_trust.dc_unc is not None) self.assertTrue(response_trust.dc_unc.startswith('\\\\')) self.assertTrue(response_trust.dc_address is not None) self.assertTrue(response_trust.dc_address.startswith('\\\\')) self.assertEqual(response_trust.domain_name.lower(), self.trust_realm.lower())