Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.
This repository was archived by the owner on May 6, 2020. It is now read-only.

LDAP authentication with incorrect password causes a 500 #1307

@hankjacobs

Description

@hankjacobs

I recently upgraded from 2.13.0 to 2.15.0. After upgrading, deis login with a valid LDAP user but an incorrect password started to fail with Error: Internal Server Error.

The following stack trace appears in the deis-controller logs:

ERROR:root:Uncaught Exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/ldap/ldapobject.py", line 265, in _ldap_call
    result = func(*args,**kwargs)
ldap.INVALID_CREDENTIALS: {'desc': 'Invalid credentials'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py", line 486, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/rest_framework/authtoken/views.py", line 17, in post
    serializer.is_valid(raise_exception=True)
  File "/usr/local/lib/python3.5/dist-packages/rest_framework/serializers.py", line 237, in is_valid
    self._validated_data = self.run_validation(self.initial_data)
  File "/usr/local/lib/python3.5/dist-packages/rest_framework/serializers.py", line 435, in run_validation
    value = self.validate(value)
  File "/usr/local/lib/python3.5/dist-packages/rest_framework/authtoken/serializers.py", line 16, in validate
    user = authenticate(username=username, password=password)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/__init__.py", line 100, in authenticate
    user = backend.authenticate(*args, **credentials)
  File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 171, in authenticate
    user = ldap_user.authenticate(password)
  File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 344, in authenticate
    self._authenticate_user_dn(password)
  File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 460, in _authenticate_user_dn
    self._bind_as(self.dn, password, sticky=sticky)
  File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 765, in _bind_as
    force_str(bind_password))
  File "/usr/local/lib/python3.5/dist-packages/ldap/ldapobject.py", line 386, in simple_bind_s
    resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(msgid,all=1,timeout=self.timeout)
  File "/usr/local/lib/python3.5/dist-packages/ldap/ldapobject.py", line 682, in result3
    resp_ctrl_classes=resp_ctrl_classes
  File "/usr/local/lib/python3.5/dist-packages/ldap/ldapobject.py", line 689, in result4
    ldap_result = self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop)
  File "/usr/local/lib/python3.5/dist-packages/ldap/ldapobject.py", line 273, in _ldap_call
    e.args[0]['info'] = strerror(e.args[0]['errno'])
KeyError: 'errno'
10.68.167.81 "POST /v2/auth/login/ HTTP/1.1" 500 25 "Deis Client v2.15.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions