summaryrefslogtreecommitdiffstats
path: root/source4/scripting/bin
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2014-10-07 15:35:34 +0200
committerAndrew Bartlett <abartlet@samba.org>2014-12-18 06:47:40 +0100
commite85ef1dbfef4b16c35cac80c0efc563d8cd1ba3e (patch)
tree6c41e7aea7262840cf6cb130067d35a5dc36594a /source4/scripting/bin
parent35495da4b840d3893124657c81427bfc2f78f9e2 (diff)
downloadsamba-e85ef1dbfef4b16c35cac80c0efc563d8cd1ba3e.tar.gz
samba-e85ef1dbfef4b16c35cac80c0efc563d8cd1ba3e.tar.xz
samba-e85ef1dbfef4b16c35cac80c0efc563d8cd1ba3e.zip
samba_dnsupdate: Always fill out the nameservers of a dns object.
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting/bin')
-rwxr-xr-xsource4/scripting/bin/samba_dnsupdate10
1 files changed, 7 insertions, 3 deletions
diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate
index c2ee3ecb7f..427b5dc869 100755
--- a/source4/scripting/bin/samba_dnsupdate
+++ b/source4/scripting/bin/samba_dnsupdate
@@ -139,6 +139,7 @@ class dnsobj(object):
self.existing_weight = None
self.type = list[0]
self.name = list[1]
+ self.nameservers = []
if self.type == 'SRV':
if len(list) < 4:
raise Exception("Invalid DNS entry %r" % string_form)
@@ -208,9 +209,12 @@ def check_dns_name(d):
resolver = dns.resolver.Resolver()
+ if d.nameservers != []:
+ resolver.nameservers = d.nameservers
+ else:
+ d.nameservers = resolver.nameservers
+
try:
- if getattr(d, 'nameservers', None):
- resolver.nameservers = list(d.nameservers)
ans = resolver.query(normalised_name, d.type)
except dns.exception.DNSException:
if opts.verbose:
@@ -357,7 +361,7 @@ def call_nsupdate(d, op="add"):
(tmp_fd, tmpfile) = tempfile.mkstemp()
f = os.fdopen(tmp_fd, 'w')
- if getattr(d, 'nameservers', None):
+ if d.nameservers != []:
f.write('server %s\n' % d.nameservers[0])
if d.type == "A":
f.write("update %s %s %u A %s\n" % (op, normalised_name, default_ttl, d.ip))