collective / pas.plugins.ldap

Zope (and Plone) PAS Plugin providing users and groups from LDAP directory
http://pypi.python.org/pypi/pas.plugins.ldap
Other
13 stars 19 forks source link

use exact_match in getRolesForPrincipal/getPropertiesForUser #118

Closed mamico closed 11 months ago

mamico commented 11 months ago

This is probably an edge case, but it has happened and may happen to others.

If you have a local user or group named cekk and an ldap user named cekk@redturtle.it, the actual code looks up the properties of an inexistent cekk user in ldap, and eventually an error occurs with this trace

  Module pas.plugins.ldap.plugin, line 565, in getPropertiesForUser
  Module pas.plugins.ldap.sheet, line 40, in __init__
  Module pas.plugins.ldap.sheet, line 60, in _get_ldap_principal
  Module node.locking, line 30, in _locktree_decorator
  Module node.ext.ldap.ugm._api, line 536, in __getitem__
  Module node.utils, line 275, in wrapped
  Module node.ext.ldap._node, line 512, in search
  Module node.ext.ldap.session, line 44, in search
  Module node.ext.ldap.base, line 288, in search
  Module node.ext.ldap.base, line 263, in _search
  Module ldap.ldapobject, line 544, in result3
  Module ldap.ldapobject, line 554, in result4
  Module ldap.ldapobject, line 128, in _ldap_call
ldap.NO_SUCH_OBJECT: {'msgtype': 101, 'msgid': 2, 'result': 32, 'desc': 'No such object', 'ctrls': []}
rnixx commented 11 months ago

LGTM