# HG changeset patch # User nwp@mrrush.otago.ac.nz # Date 1186975583 -43200 # Node ID cf1e1a6eda3886d201308148a7e7ce3e934355d5 # Parent 5c7abdf6554e2908f78c6853625c7ce65cca84b2 imported patch fix-ldap-patch diff -r 5c7abdf6554e -r cf1e1a6eda38 MoinMoin/auth/ldap_login.py --- a/MoinMoin/auth/ldap_login.py Tue Aug 07 14:12:39 2007 +0200 +++ b/MoinMoin/auth/ldap_login.py Mon Aug 13 15:26:23 2007 +1200 @@ -70,13 +70,16 @@ def ldap_login(request, **kw): # you can use %(username)s here to get the stuff entered in the form: filterstr = cfg.ldap_filter % locals() + + attrs = [getattr(cfg,x) for x in ['ldap_email_attribute', + 'ldap_aliasname_attribute', + 'ldap_surname_attribute', + 'ldap_givenname_attribute' + ] if (hasattr(cfg,x) and getattr(cfg,x) != None)] + if verbose: request.log("LDAP: Searching %r" % filterstr) lusers = l.search_st(cfg.ldap_base, cfg.ldap_scope, filterstr.encode(coding), - attrlist=[cfg.ldap_email_attribute, - cfg.ldap_aliasname_attribute, - cfg.ldap_surname_attribute, - cfg.ldap_givenname_attribute, - ], timeout=cfg.ldap_timeout) + attrlist=attrs, timeout=cfg.ldap_timeout) # we remove entries with dn == None to get the real result list: lusers = [(dn, ldap_dict) for dn, ldap_dict in lusers if dn is not None] if verbose: