#8918 closed defect (fixed)
Wrong key name in source code, auth.py line 165
Reported by: | Owned by: | John Hampton | |
---|---|---|---|
Priority: | normal | Component: | DirectoryAuthPlugin |
Severity: | critical | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description (last modified by )
There is an error in the source code, auth.py, line 165. I believe the line should read:
for e in attrs['proxyAddress'''es'''']:
Currently, I am getting a KeyError since the attribute from Active Directory should be proxyAddresses not proxyAddress.
Error log: Traceback (most recent call last): File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\api.py", line 440, in send_error data, 'text/html') File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\chrome.py", line 833, in render_template data = self.populate_data(req, data) File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\chrome.py", line 744, in populate_data 'context': req and Context.from_request(req) or None, File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\mimeview\api.py", line 156, in from_request perm = req.perm File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\api.py", line 216, in __getattr__ value = self.callbacks[name](self) File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\main.py", line 293, in _get_perm if isinstance(req.session, FakeSession): File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\api.py", line 216, in __getattr__ value = self.callbacks[name](self) File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\main.py", line 300, in _get_session return Session(self.env, req) File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\session.py", line 192, in __init__ if req.authname == 'anonymous': File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\api.py", line 216, in __getattr__ value = self.callbacks[name](self) File "c:\docume~1\ccs~2.gis\locals~1\temp\easy_install-riokcd\Trac-0.12.2-py2.5-win32.egg.tmp\trac\web\main.py", line 159, in authenticate authname = authenticator.authenticate(req) File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 490, in wrap return func(self, *args, **kwds) File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 500, in authenticate user = self._remote_user(req) File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 706, in _remote_user if acctmgr.check_password(user, password) == True: File "build\bdist.win32\egg\acct_mgr\api.py", line 284, in check_password valid = store.check_password(user, password) File "build\bdist.win32\egg\tracext\adauth\auth.py", line 86, in check_password dn = self._get_user_dn(user) File "build\bdist.win32\egg\tracext\adauth\auth.py", line 144, in _get_user_dn if self.has_user(user): File "build\bdist.win32\egg\tracext\adauth\auth.py", line 81, in has_user users = self.get_users() File "build\bdist.win32\egg\tracext\adauth\auth.py", line 50, in get_users userinfo = [self._get_userinfo(u[1]) for u in users] File "build\bdist.win32\egg\tracext\adauth\auth.py", line 165, in _get_userinfo for e in attrs['proxyAddress']: KeyError: 'proxyAddress'
Attachments (0)
Change History (4)
comment:2 Changed 13 years ago by
comment:3 Changed 13 years ago by
Using trunk in Trac 0.12, I got a similar error showing that a list (listType) was returned, not the expected dictionary (dictType).
File "/usr/local/lib/python2.6/dist-packages/TracActiveDirectoryAuth-0.2.2-py2.6.egg/tracext/adauth/auth.py", line 173, in _get_userinfo username = attrs['sAMAccountName'][0].lower() TypeError: list indices must be integers, not str
I fixed it by adding an auth_group to filter out the "ldap://ForestDnsZones..." that were being returned by my DC as a list in Python and messing up the _get_userinfo() call. I'm not familiar enough with Python to write a filter on this so the default behavior works without defining auth_group.
comment:4 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
the sAMAccountName issue has been resolved in #9218 and pushed to 0.3 .. not sure about the ProxyAddress issue .. I see the code .. and it does look wrong .. but I don't know which is valid 'ProxyAddress' or 'ProxyAddresses' .. I assume the latter per comments above .. and will include that in 0.3
comment:5 Changed 12 years ago by
Description: | modified (diff) |
---|
I got the same error and changed the proxyAddress to proxyAddresses and got a different error that doesn't really make sense. I am on version 0.12.