X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-mailgate;h=d8dfbffa7a9bdedafed885da94e5b2dfbff495ec;hb=551f36fe90550b1816227e8e1bf7d4080d5a5241;hp=99072228d69f6dcebb3594cc09b16b5525d6d082;hpb=5bb3f59ff8d33dc83544834d7f1e978d84f0bc7c;p=mirror%2Fuserdir-ldap.git diff --git a/ud-mailgate b/ud-mailgate index 9907222..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")