X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-mailgate;h=ae86f6311cffaed92ab23faf5eab1d2116c4ead5;hb=77661e58f39415c6cee20e537d9a65afd7827ca7;hp=4aed08027cf255c0984c96b70990d2bae1e79380;hpb=0b086a5406ec0ccae9c660050af7c9f343cf89e6;p=mirror%2Fuserdir-ldap.git diff --git a/ud-mailgate b/ud-mailgate index 4aed080..ae86f63 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -376,18 +376,20 @@ 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\ - aaaarecord == None: + if cnamerecord is None and\ + arecord is None and\ + mxrecord is None and\ + txtrecord is None and\ + aaaarecord is None: return None; # Check if the name is already taken G = re.match('^([-\w+]+)\s',Str) - if G == None: + if G is None: raise UDFormatError, "Hostname not found although we already passed record syntax checks" hostname = G.group(1) @@ -417,19 +419,21 @@ def DoDNS(Str,Attrs,DnRecord): else: DNS[hostname] = 1 - if cnamerecord != None: + if cnamerecord is not None: sanitized = "%s IN CNAME %s" % (hostname, cnamerecord.group(1)) - elif arecord != None: + elif txtrecord is not None: + sanitized = "%s IN TXT %s" % (hostname, txtrecord.group(1)) + elif arecord is not None: ipaddress = arecord.group(1) for quad in ipaddress.split('.'): if not (int(quad) >=0 and int(quad) <= 255): return "Invalid quad %s in IP address %s in line %s" %(quad, ipaddress, Str) sanitized = "%s IN A %s"% (hostname, ipaddress) - elif mxrecord != None: + elif mxrecord is not None: priority = mxrecord.group(1) mx = mxrecord.group(2) sanitized = "%s IN MX %s %s" % (hostname, priority, mx) - elif aaaarecord != None: + elif aaaarecord is not None: ipv6address = aaaarecord.group(1) parts = ipv6address.split(':') if len(parts) > 8: