add txt record support
authorStephen Gran <steve@lobefin.net>
Sun, 14 Mar 2010 13:54:46 +0000 (13:54 +0000)
committerStephen Gran <steve@lobefin.net>
Sun, 14 Mar 2010 13:54:46 +0000 (13:54 +0000)
Signed-off-by: Stephen Gran <steve@lobefin.net>
ud-mailgate

index 4aed080..443de15 100755 (executable)
@@ -376,12 +376,14 @@ def DoDNS(Str,Attrs,DnRecord):
    cnamerecord = re.match("^[-\w]+\s+IN\s+CNAME\s+([-\w.]+\.)$",Str,re.IGNORECASE)
    arecord     = re.match('^[-\w]+\s+IN\s+A\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$',Str,re.IGNORECASE)
    mxrecord    = re.match("^[-\w]+\s+IN\s+MX\s+(\d{1,3})\s+([-\w.]+\.)$",Str,re.IGNORECASE)
+   txtrecord   = re.match("^[-\w]+\s+IN\s+TXT\s+([-\d. a-z\t<>@]+)", Str, re.IGNORECASE)
    #aaaarecord  = re.match('^[-\w]+\s+IN\s+AAAA\s+((?:[0-9a-f]{1,4})(?::[0-9a-f]{1,4})*(?::(?:(?::[0-9a-f]{1,4})*|:))?)$',Str,re.IGNORECASE)
    aaaarecord  = re.match('^[-\w]+\s+IN\s+AAAA\s+([A-F0-9:]{2,39})$',Str,re.IGNORECASE)
 
    if cnamerecord == None and\
       arecord == None and\
       mxrecord == None and\
+      txtrecord == None and
       aaaarecord == None:
      return None;
 
@@ -419,6 +421,8 @@ def DoDNS(Str,Attrs,DnRecord):
 
    if cnamerecord != None:
      sanitized = "%s IN CNAME %s" % (hostname, cnamerecord.group(1))
+   elif txtrecord != None:
+      sanitized = "%s IN TXT %s" % (hostname, txtrecord.group(1))
    elif arecord != None:
      ipaddress = arecord.group(1)
      for quad in ipaddress.split('.'):