Modify ↓
Opened 9 years ago
Closed 7 years ago
#13061 closed defect (fixed)
DirectoryAuth - expand_user_groups fails with group_nameattr = dn
| Reported by: | Martin Kofahl | Owned by: | bebbo |
|---|---|---|---|
| Priority: | normal | Component: | DirectoryAuthPlugin |
| Severity: | normal | Keywords: | patch |
| Cc: | Trac Release: | 1.0 |
Description
Having group_nameattr set to dn, a LDAP server may not return the dn twice and auth.py fails. Patch attached.
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 512, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 221, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/lib/python2.7/dist-packages/acct_mgr/web_ui.py", line 381, in process_request
if req.path_info.startswith('/login') and req.authname == 'anonymous':
File "/usr/lib/python2.7/dist-packages/trac/web/api.py", line 353, in __getattr__
value = self.callbacks[name](self)
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 136, in authenticate
authname = authenticator.authenticate(req)
File "/usr/lib/python2.7/dist-packages/acct_mgr/util.py", line 82, in wrap
return func(self, *args, **kwds)
File "/usr/lib/python2.7/dist-packages/acct_mgr/web_ui.py", line 338, in authenticate
user = self._remote_user(req)
File "/usr/lib/python2.7/dist-packages/acct_mgr/web_ui.py", line 684, in _remote_user
if acctmgr.check_password(user, password) == True:
File "/usr/lib/python2.7/dist-packages/acct_mgr/api.py", line 259, in check_password
valid = store.check_password(user, password)
File "build/bdist.linux-x86_64/egg/tracext/dirauth/auth.py", line 243, in check_password
usergroups = self._expand_user_groups(user, NOCACHE)
File "build/bdist.linux-x86_64/egg/tracext/dirauth/auth.py", line 381, in _expand_user_groups
group = entry[1][self.group_nameattr][0]
KeyError: u'dn'
Attachments (1)
Change History (6)
Changed 9 years ago by
| Attachment: | directoryauthplugin_auth.patch added |
|---|
comment:1 Changed 9 years ago by
comment:2 Changed 8 years ago by
| Keywords: | patch added |
|---|
comment:3 Changed 7 years ago by
- @L96: the case must match the ldap servers response. lowercase is not always true.
- @L407: use the constant GROUP_PREFIX
also add the group.
Now it's still working here.
comment:5 Changed 7 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note: See
TracTickets for help on using
tickets.



Remarks and discussion points on the extended patch:
group_validusershas to be lower-case right now. But comparing with.lower()incheck_password()might be somewhat more straightforward.group_nameattris set todn, a LDAP may return only one column._get_parent_groups()returns an extened list, so don't create a multidimensional array.@prepended.group_nameattris set todn, a LDAP may return only one column._get_parent_groups()returns an extened list, so don't create a multidimensional array.