X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-mailgate;h=d8dfbffa7a9bdedafed885da94e5b2dfbff495ec;hb=734f08196ff3c48d9f7440bf8731f3cd72f128aa;hp=eb48d6016859c3856f66301e3970a8f43c7470d0;hpb=01c484437e1c41b686f9f22f55c2f8406efdc5c3;p=mirror%2Fuserdir-ldap.git diff --git a/ud-mailgate b/ud-mailgate index eb48d60..d8dfbff 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -222,7 +222,12 @@ def DoDNS(Str,Attrs,DnRecord): # Check for collisions global l; - Rec = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"dnsZoneEntry="+G[0]+" *",["uid"]); + # [JT 20070409 - search for both tab and space suffixed hostnames + # since we accept either. It'd probably be better to parse the + # incoming string in order to construct what we feed LDAP rather + # than just passing it through as is.] + filter = "(|(dnsZoneEntry=%s *)(dnsZoneEntry=%s *))" % (G[0], G[0]) + Rec = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,filter,["uid"]); for x in Rec: if GetAttr(x,"uid") != GetAttr(DnRecord,"uid"): return "DNS entry is already owned by " + GetAttr(x,"uid") @@ -251,7 +256,7 @@ def DoDNS(Str,Attrs,DnRecord): # Handle an RBL list (mailRBL, mailRHSBL, mailWhitelist) def DoRBL(Str,Attrs): - Match = re.compile('^mail(rbl|rhsbl|whitelist) ([\w.]+)$').match(string.lower(Str)) + Match = re.compile('^mail(rbl|rhsbl|whitelist) ([-a-z0-9.]+)$').match(string.lower(Str)) if Match == None: return None