From 441c214dda2ca93980461c03115b094a1e606d4a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 12 Mar 2012 19:29:34 +0100 Subject: samba_dnsupdate: Mention contents of invalid line when encountering parsing error. Bug: https://bugzilla.samba.org/show_bug.cgi?id=8809 --- source4/scripting/bin/samba_dnsupdate | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source4/scripting/bin/samba_dnsupdate') diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate index 076bc328b7..d21496ca21 100755 --- a/source4/scripting/bin/samba_dnsupdate +++ b/source4/scripting/bin/samba_dnsupdate @@ -125,6 +125,8 @@ class dnsobj(object): def __init__(self, string_form): list = string_form.split() + if len(list) < 3: + raise Exception("Invalid DNS entry %r" % string_form) self.dest = None self.port = None self.ip = None @@ -133,6 +135,8 @@ class dnsobj(object): self.type = list[0] self.name = list[1].lower() if self.type == 'SRV': + if len(list) < 4: + raise Exception("Invalid DNS entry %r" % string_form) self.dest = list[2].lower() self.port = list[3] elif self.type in ['A', 'AAAA']: @@ -159,8 +163,7 @@ def parse_dns_line(line, sub_vars): 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 + return dnsobj(subline) def hostname_match(h1, h2): -- cgit