mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
dns: update tool changed for scavenging
Now that scavenging is implemented, the DNS update tool needs to be changed so that it always updates every name required by the DC. Otherwise, the records might be scavenged. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10812 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
86b61551b3
commit
8ef42d4dab
@ -23,6 +23,7 @@ from samba.credentials import Credentials
|
||||
from samba.auth import system_session
|
||||
from samba.samdb import SamDB
|
||||
import ldb
|
||||
import shutil, os
|
||||
|
||||
class SambaDnsUpdateTests(samba.tests.BlackboxTestCase):
|
||||
"""Blackbox test case for samba_dnsupdate."""
|
||||
@ -37,7 +38,10 @@ class SambaDnsUpdateTests(samba.tests.BlackboxTestCase):
|
||||
pass
|
||||
|
||||
def test_samba_dnsupate_no_change(self):
|
||||
out = self.check_output("samba_dnsupdate --verbose")
|
||||
try:
|
||||
out = self.check_output("samba_dnsupdate --verbose")
|
||||
except samba.tests.BlackboxProcessError as e:
|
||||
self.fail("Error calling samba_dnsupdate: %s" % e)
|
||||
self.assertTrue("No DNS updates needed" in out, out)
|
||||
|
||||
def test_samba_dnsupate_set_ip(self):
|
||||
@ -83,6 +87,9 @@ class SambaDnsUpdateTests(samba.tests.BlackboxTestCase):
|
||||
self.creds = Credentials()
|
||||
self.creds.guess(self.lp)
|
||||
self.session = system_session()
|
||||
uc_fn = self.lp.private_path('dns_update_cache')
|
||||
tmp_uc = uc_fn + '_tmp'
|
||||
shutil.copyfile(uc_fn, tmp_uc)
|
||||
|
||||
self.samdb = SamDB(session_info=self.session,
|
||||
credentials=self.creds,
|
||||
@ -97,13 +104,14 @@ class SambaDnsUpdateTests(samba.tests.BlackboxTestCase):
|
||||
self.samdb.get_config_basedn()),
|
||||
ldb.FLAG_MOD_ADD, "siteList")
|
||||
|
||||
out = self.check_output("samba_dnsupdate --verbose")
|
||||
self.assertTrue("No DNS updates needed" in out, out)
|
||||
dns_c = "samba_dnsupdate --verbose --use-file={}".format(tmp_uc)
|
||||
out = self.check_output(dns_c)
|
||||
self.assertFalse(site_name.lower() in out, out)
|
||||
|
||||
self.samdb.modify(m)
|
||||
|
||||
out = self.check_output("samba_dnsupdate --verbose --use-samba-tool"
|
||||
" --rpc-server-ip={}".format(self.server_ip))
|
||||
shutil.copyfile(uc_fn, tmp_uc)
|
||||
out = self.check_output(dns_c)
|
||||
|
||||
self.assertFalse("No DNS updates needed" in out, out)
|
||||
self.assertTrue(site_name.lower() in out, out)
|
||||
|
@ -65,3 +65,5 @@ samba.tests.dns.__main__.TestSimpleQueries.test_qtype_all_query\(rodc:local\)
|
||||
|
||||
# The SOA override should not pass against the RODC, it must not overstamp
|
||||
samba.tests.dns.__main__.TestSimpleQueries.test_one_SOA_query\(rodc:local\)
|
||||
.*samba.tests.blackbox.samba_dnsupdate.SambaDnsUpdateTests.test_samba_dnsupate_set_ip
|
||||
.*samba.tests.blackbox.samba_dnsupdate.SambaDnsUpdateTests.test_samba_dnsupate_no_change
|
||||
|
@ -847,15 +847,7 @@ for d in dns_list:
|
||||
rebuild_cache = True
|
||||
if opts.verbose:
|
||||
print "need cache add: %s" % d
|
||||
if opts.all_names:
|
||||
update_list.append(d)
|
||||
if opts.verbose:
|
||||
print "force update: %s" % d
|
||||
elif not check_dns_name(d):
|
||||
update_list.append(d)
|
||||
if opts.verbose:
|
||||
print "need update: %s" % d
|
||||
|
||||
update_list.append(d)
|
||||
|
||||
for c in cache_list:
|
||||
found = False
|
||||
|
Loading…
Reference in New Issue
Block a user