[python-ldap] [BUG] KeyError on 'errno'
Matt Bosworth
matt at codetastic.com
Wed May 24 19:24:09 EDT 2017
Hi all,
It looks like this might be a regression that snuck back in over the last
couple weeks?
I just updated to the latest version of python-ldap (2.4.38),
django-auth-ldap (1.2.12), and django (1.11.1) and now successful LDAP
authentication raises an Exception (full stack trace below).
Rolling back to 2.4.37 fixes the issue.
Also, if I jump into python-ldap/ldapobject.py and change line 272 to
'pass' then things work.
Original line 272:
e.args[0]['info'] = strerror(e.args[0]['errno'])
Stack trace:
Environment:
Request Method: POST
Request URL: http://localhost:8000/login/
Django Version: 1.11.1
Python Version: 2.7.13
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_select2',
'session_security',
'bootstrapform',
'rt.utils',
'rt.main',
'rt.menus',
'rt.onset_survey',
'rt.onset_survey_collab',
'rt.tableau',
'rt.patient_filter',
'rt.prog_changes',
'rt.caseconf',
'rt.user_prefs',
'batt_watchlist',
'long_plot',
'custom_reports')
Installed Middleware:
('django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'session_security.middleware.SessionSecurityMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'rt.middleware.RequireLoginMiddleware')
Traceback:
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/core/handlers/exception.py"
in inner
41. response = get_response(request)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/core/handlers/base.py"
in _get_response
187. response = self.process_exception_by_middleware(e,
request)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/core/handlers/base.py"
in _get_response
185. response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/views/generic/base.py"
in view
68. return self.dispatch(request, *args, **kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/utils/decorators.py"
in _wrapper
67. return bound_func(*args, **kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/views/decorators/debug.py"
in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/utils/decorators.py"
in bound_func
63. return func.__get__(self, type(self))(*args2,
**kwargs2)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/utils/decorators.py"
in _wrapper
67. return bound_func(*args, **kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/utils/decorators.py"
in _wrapped_view
149. response = view_func(request, *args, **kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/utils/decorators.py"
in bound_func
63. return func.__get__(self, type(self))(*args2,
**kwargs2)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/utils/decorators.py"
in _wrapper
67. return bound_func(*args, **kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/views/decorators/cache.py"
in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/utils/decorators.py"
in bound_func
63. return func.__get__(self, type(self))(*args2,
**kwargs2)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/contrib/auth/views.py"
in dispatch
90. return super(LoginView, self).dispatch(request, *args,
**kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/views/generic/base.py"
in dispatch
88. return handler(request, *args, **kwargs)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/views/generic/edit.py"
in post
182. if form.is_valid():
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/forms/forms.py"
in is_valid
183. return self.is_bound and not self.errors
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/forms/forms.py"
in errors
175. self.full_clean()
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/forms/forms.py"
in full_clean
385. self._clean_form()
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/forms/forms.py"
in _clean_form
412. cleaned_data = self.clean()
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/contrib/auth/forms.py"
in clean
187. self.user_cache = authenticate(self.request,
username=username, password=password)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django/contrib/auth/__init__.py"
in authenticate
101. user = backend.authenticate(*args, **credentials)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django_auth_ldap/backend.py"
in authenticate
171. user = ldap_user.authenticate(password)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django_auth_ldap/backend.py"
in authenticate
345. self._check_requirements()
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django_auth_ldap/backend.py"
in _check_requirements
510. self._check_required_group()
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django_auth_ldap/backend.py"
in _check_required_group
523. result = required_group_dn.resolve(self)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django_auth_ldap/config.py"
in resolve
693. result = self.aggregator(self._resolve_children(ldap_user,
groups))
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django_auth_ldap/config.py"
in _resolve_children
721. yield groups.is_member_of(child)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django_auth_ldap/backend.py"
in is_member_of
848. is_member = self._group_type.is_member(self._ldap_user,
group_dn)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/django_auth_ldap/config.py"
in is_member
476. force_str(ldap_user.dn)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/ldap/ldapobject.py"
in compare_s
474. return self.compare_ext_s(dn,attr,value,None,None)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/ldap/ldapobject.py"
in compare_ext_s
463. resp_type, resp_data, resp_msgid, resp_ctrls =
self.result3(msgid,all=1,timeout=self.timeout)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/ldap/ldapobject.py"
in result3
682. resp_ctrl_classes=resp_ctrl_classes
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/ldap/ldapobject.py"
in result4
689. ldap_result =
self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop)
File
"/Users/bosworth/Documents/git/RtDjango/venv-py27/lib/python2.7/site-packages/ldap/ldapobject.py"
in _ldap_call
273. e.args[0]['info'] = strerror(e.args[0]['errno'])
Exception Type: KeyError at /login/
Exception Value: u'errno'
Hope this is useful!
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20170524/117dba8b/attachment.html>
More information about the python-ldap
mailing list