Browse Source

PTR and MX need to add the origin to names that don't end in '.'

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1214 e5f2f494-b856-4b98-b285-d166d9295462
Evan Hunt 15 years ago
parent
commit
dcd678980b
1 changed files with 14 additions and 7 deletions
  1. 14 7
      src/lib/python/isc/auth/master.py

+ 14 - 7
src/lib/python/isc/auth/master.py

@@ -335,8 +335,8 @@ def two(record, curname):
 #########################################################################
 def reset():
     global defttl, origin
-    defttl = -1
-    origin=''
+    defttl = ''
+    origin = ''
 
 #########################################################################
 # openzone: open a zone master file, set initial origin, return descriptor
@@ -398,15 +398,22 @@ def zonedata(zone):
         if rrclass.upper() != 'IN':
             raise MasterFileError("CH and HS zones not supported")
 
-        # add origin to rdata if necessary
-        if rrtype.lower() in ('cname', 'dname', 'ns'):
+        if not ttl:
+            raise MasterFileError("No TTL specified; zone rejected")
+
+        # add origin to rdata containing names, if necessary
+        if rrtype.lower() in ('cname', 'dname', 'ns', 'ptr'):
             if not isname(rdata):
                 raise MasterFileError("Invalid " + rrtype + ": " + rdata)
             if rdata[-1] != '.':
                 rdata += '.' + origin
-
-        if (ttl == -1):
-            raise MasterFileError("No TTL specified; zone rejected")
+        if rrtype.lower() == 'mx':
+            mx = rdata.split()
+            if len(mx) != 2 or not isname(mx[1]):
+                raise MasterFileError("Invalid " + rrtype + ": " + rdata)
+            if mx[1][-1] != '.':
+                mx[1] += '.' + origin
+                rdata = ' '.join(mx)
 
         yield (name, ttl, rrclass, rrtype, rdata)