mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
dns: Use ldb.SCOPE_SUBTREE in ldap_get_records() routine in tests/dns.py
DNS records have the odd property that the DN can be reliably determined by the name only, so we do not need a subtree search. However by using a subtree search under the zone we can without trapping exceptions confirm if the record exists or not in the tests. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10812 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
parent
00002b8df9
commit
6bd2f82b9f
@ -969,9 +969,11 @@ class TestZones(DNSTest):
|
||||
return recs[0]
|
||||
|
||||
def ldap_get_records(self, name):
|
||||
dn = 'DC={},{}'.format(name, self.zone_dn)
|
||||
# The use of SCOPE_SUBTREE here avoids raising an exception in the
|
||||
# 0 results case for a test below.
|
||||
|
||||
expr = "(&(objectClass=dnsNode)(name={}))".format(name)
|
||||
return self.samdb.search(base=dn, scope=ldb.SCOPE_SUBTREE,
|
||||
return self.samdb.search(base=self.zone_dn, scope=ldb.SCOPE_SUBTREE,
|
||||
expression=expr, attrs=["*"])
|
||||
|
||||
def ldap_get_dns_records(self, name):
|
||||
|
Loading…
Reference in New Issue
Block a user