From a427a868d388513da7b5386ba36f1898d7048dd0 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 6 Jul 2014 18:13:43 +0200 Subject: Remove useless spaces in LDAP attribute values. --- lib/openldap | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/openldap b/lib/openldap index 0a8df96..7293b23 100644 --- a/lib/openldap +++ b/lib/openldap @@ -62,6 +62,7 @@ sasl_ext_re = re.compile( r"""(?P\sby\s+dn(?:\.exact)?)= (?Pcn=peercred,cn=external,cn=auth) (?P=quote)\s""" , re.VERBOSE ) +multispaces = re.compile( r"\s+" ) pwd_dict = {} def acl_sasl_ext(m): @@ -160,6 +161,11 @@ def flexibleSearch(module, l, dn, entry): # directory with disclose/search/write access. def processEntry(module, l, dn, entry): changed = False + + for x in indexedAttributes.intersection(entry.keys()): + # remove useless extra spaces in ACLs etc + entry[x] = map( partial(multispaces.sub, ' '), entry[x] ) + r = flexibleSearch( module, l, dn, entry ) if r is None: changed = True -- cgit v1.2.3