# Prior copyright probably rmurray, troup, joey, jgg -- weasel 2008
# Copyright (c) 2009 Stephen Gran <steve@lobefin.net>
-# Copyright (c) 2008 Peter Palfrader <peter@palfrader.org>
+# Copyright (c) 2008,2009,2010 Peter Palfrader <peter@palfrader.org>
# Copyright (c) 2008 Joerg Jaspert <joerg@debian.org>
# Copyright (c) 2010 Helmut Grohne <helmut@subdivi.de>
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;
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('.'):