From: Jelmer Vernooij Date: Mon, 12 Mar 2012 18:29:34 +0000 (+0100) Subject: samba_dnsupdate: Mention contents of invalid line when encountering parsing error. X-Git-Tag: tdb-1.2.10~229 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=441c214dda2ca93980461c03115b094a1e606d4a;p=thirdparty%2Fsamba.git samba_dnsupdate: Mention contents of invalid line when encountering parsing error. Bug: https://bugzilla.samba.org/show_bug.cgi?id=8809 --- diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate index 076bc328b79..d21496ca219 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):