summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-27 21:07:17 -0700
committerAndrew Tridgell <tridge@samba.org>2010-09-27 22:55:05 -0700
commit6237d560275d7d19e46afe85cb9f19313359ea80 (patch)
tree178d8604d5969a967d68eda7f8db8f040656da45
parent7d380795b63c9b6e5196607960a35cfc90bdf1d9 (diff)
downloadsamba-6237d560275d7d19e46afe85cb9f19313359ea80.tar.gz
samba-6237d560275d7d19e46afe85cb9f19313359ea80.tar.bz2
samba-6237d560275d7d19e46afe85cb9f19313359ea80.zip
s4-dns: added --update-list option to samba_dnsupdate
this allows us to use it for RODC netlogon updates
-rwxr-xr-xsource4/scripting/bin/samba_dnsupdate22
1 files changed, 14 insertions, 8 deletions
diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate
index e2e303ca43..5ed46c326c 100755
--- a/source4/scripting/bin/samba_dnsupdate
+++ b/source4/scripting/bin/samba_dnsupdate
@@ -52,6 +52,7 @@ parser.add_option("--verbose", action="store_true")
parser.add_option("--all-names", action="store_true")
parser.add_option("--all-interfaces", action="store_true")
parser.add_option("--use-file", type="string", help="Use a file, rather than real DNS calls")
+parser.add_option("--update-list", type="string", help="Add DNS names from the given file")
creds = None
ccachename = None
@@ -107,14 +108,14 @@ class dnsobj(object):
self.existing_port = None
self.existing_weight = None
self.type = list[0]
- self.name = list[1]
+ self.name = list[1].lower()
if self.type == 'SRV':
- self.dest = list[2]
+ self.dest = list[2].lower()
self.port = list[3]
elif self.type == 'A':
self.ip = list[2] # usually $IP, which gets replaced
elif self.type == 'CNAME':
- self.dest = list[2]
+ self.dest = list[2].lower()
else:
print "Received unexpected DNS reply of type %s" % self.type
raise
@@ -227,17 +228,19 @@ def call_nsupdate(d):
fcntl.lockf(wfile, fcntl.LOCK_UN)
return
+ normalised_name = d.name.rstrip('.') + '.'
+
(tmp_fd, tmpfile) = tempfile.mkstemp()
f = os.fdopen(tmp_fd, 'w')
if d.type == "A":
- f.write("update add %s %u A %s\n" % (d.name, default_ttl, d.ip))
+ f.write("update add %s %u A %s\n" % (normalised_name, default_ttl, d.ip))
if d.type == "SRV":
if d.existing_port is not None:
- f.write("update delete %s SRV 0 %s %s %s\n" % (d.name, d.existing_weight,
+ f.write("update delete %s SRV 0 %s %s %s\n" % (normalised_name, d.existing_weight,
d.existing_port, d.dest))
- f.write("update add %s %u SRV 0 100 %s %s\n" % (d.name, default_ttl, d.port, d.dest))
+ f.write("update add %s %u SRV 0 100 %s %s\n" % (normalised_name, default_ttl, d.port, d.dest))
if d.type == "CNAME":
- f.write("update add %s %u CNAME %s\n" % (d.name, default_ttl, d.dest))
+ f.write("update add %s %u CNAME %s\n" % (normalised_name, default_ttl, d.dest))
if opts.verbose:
f.write("show\n")
f.write("send\n")
@@ -318,7 +321,10 @@ def call_rodc_update(d):
# get the list of DNS entries we should have
-dns_update_list = lp.private_path('dns_update_list')
+if opts.update_list:
+ dns_update_list = opts.update_list
+else:
+ dns_update_list = lp.private_path('dns_update_list')
# use our private krb5.conf to avoid problems with the wrong domain
# bind9 nsupdate wants the default domain set