samba_dnsupdate: Mention contents of invalid line when encountering parsing error.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 12 Mar 2012 18:29:34 +0000 (19:29 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 13 Mar 2012 12:07:03 +0000 (13:07 +0100)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=8809

source4/scripting/bin/samba_dnsupdate

index 076bc328b79d181a8e95106222a2fa284edc27ff..d21496ca219341217d9bd5a521ccb56b18a1e730 100755 (executable)
@@ -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):