From: troup <> Date: Mon, 9 Apr 2007 20:42:03 +0000 (+0000) Subject: When checking for collisons in ud-mailgate, check for both tab and space suffixed... X-Git-Tag: debian_userdir-ldap_0-3-14~13 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=551f36fe90550b1816227e8e1bf7d4080d5a5241 When checking for collisons in ud-mailgate, check for both tab and space suffixed hostnames since we accept either as input. --- 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")