summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-12-07 09:57:07 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-12-07 03:09:08 +0100
commit650bd5e718a603b3cbcd503db6fe4150d2cf8369 (patch)
treecf7ba4c676c84ae79407fa87b443471a5f781d26 /source4/scripting
parentd8f98933fd35bb10f064edaa1a4ac8d89c6e83bc (diff)
downloadsamba-650bd5e718a603b3cbcd503db6fe4150d2cf8369.tar.gz
samba-650bd5e718a603b3cbcd503db6fe4150d2cf8369.tar.bz2
samba-650bd5e718a603b3cbcd503db6fe4150d2cf8369.zip
s4-dnsupdate: Do not attempt to add the PDC names if we are not a PDC
Diffstat (limited to 'source4/scripting')
-rwxr-xr-xsource4/scripting/bin/samba_dnsupdate16
1 files changed, 11 insertions, 5 deletions
diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate
index aa307eeed4..86af6d859f 100755
--- a/source4/scripting/bin/samba_dnsupdate
+++ b/source4/scripting/bin/samba_dnsupdate
@@ -155,6 +155,10 @@ class dnsobj(object):
################################################
# parse a DNS line from
def parse_dns_line(line, sub_vars):
+ if line.startswith("SRV _ldap._tcp.pdc._msdcs.") and not samdb.am_pdc():
+ if opts.verbose:
+ print "Skipping PDC entry (%s) as we are not a PDC" % line
+ return None
subline = samba.substitute_var(line, sub_vars)
d = dnsobj(subline)
return d
@@ -249,13 +253,10 @@ def check_dns_name(d):
###########################################
# get the list of substitution vars
-def get_subst_vars():
+def get_subst_vars(samdb):
global lp, am_rodc
vars = {}
- samdb = SamDB(url=lp.samdb_url(), session_info=system_session(),
- lp=lp)
-
vars['DNSDOMAIN'] = samdb.domain_dns_name()
vars['DNSFOREST'] = samdb.forest_dns_name()
vars['HOSTNAME'] = samdb.host_dns_name()
@@ -425,8 +426,11 @@ os.environ['KRB5_CONFIG'] = krb5conf
file = open(dns_update_list, "r")
+samdb = SamDB(url=lp.samdb_url(), session_info=system_session(),
+ lp=lp)
+
# get the substitution dictionary
-sub_vars = get_subst_vars()
+sub_vars = get_subst_vars(samdb)
# build up a list of update commands to pass to nsupdate
update_list = []
@@ -440,6 +444,8 @@ for line in file:
if line == '' or line[0] == "#":
continue
d = parse_dns_line(line, sub_vars)
+ if d is None:
+ continue
if d.type == 'A' and len(IP4s) == 0:
continue
if d.type == 'AAAA' and len(IP6s) == 0: