X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-generate;h=b20e6bb1756f0cdb7d5b90fcc85638e8202f9ec0;hb=db36cbb61b95f316e9f9bc0d89aea2d3bef3dc54;hp=d556f8b325a67718142b5c7a8f1ed46d2430f769;hpb=3b19770f41e7c4bf7882c9ae3c1e41025bcf8ea9;p=mirror%2Fuserdir-ldap.git diff --git a/ud-generate b/ud-generate index d556f8b..b20e6bb 100755 --- a/ud-generate +++ b/ud-generate @@ -10,6 +10,8 @@ GroupIDMap = {}; Allowed = None; CurrentHost = ""; +EmailCheck = re.compile("^([^ <>@]+@[^ ,<>@]+)?$"); + def Sanitize(Str): return string.translate(Str,string.maketrans("\n\r\t","$$$")); @@ -254,6 +256,9 @@ def GenForward(l,File): if len(GetAttr(x,"emailforward")) > 200: continue; + # Check the forwarding address + if EmailCheck.match(GetAttr(x,"emailforward")) == None: + continue; Line = "%s: %s" % (GetAttr(x,"uid"),GetAttr(x,"emailforward")); Line = Sanitize(Line) + "\n"; F.write(Line); @@ -286,6 +291,10 @@ def GenAllForward(l,File): if len(Forward) > 200: continue; + # Check the forwarding address + if EmailCheck.match(Forward) == None: + continue; + User = GetAttr(x,"uid"); Fdb.write("+%d,%d:%s->%s\n"%(len(User),len(Forward),User,Forward)); Fdb.write("\n"); @@ -398,7 +407,7 @@ def GenDNS(l,File): F.write(Line); # Write some identication information - if string.lower(Split[2]) != "cname": + if string.lower(Split[2]) == "a": Line = "%s IN TXT \"%s\"\n"%(Split[0],EmailAddress(x)); for y in x[1]["keyfingerprint"]: Line = Line + "%s IN TXT \"PGP %s\"\n"%(Split[0],FormatPGPKey(y));