[python-ldap] python-ldap doesn't raise invalid_credentials exception, instead results in KeyError
Sebastian Utzerath
sebastian at utzerath.eu
Wed Apr 26 10:22:49 EDT 2017
Hi all,
we want to provide LDAP authentication for a Django app (Weblate). We use
django-auth-ldap (v1.2.11) which requires python-ldap (v2.4.35).
In our app, the login works correctly when I enter valid user credentials.
But as soon as I enter invalid credentials, we receive a KeyError
Exception. I know that python-ldap is meant to make errors appear as
exceptions, but please have a look at this:
---
File
"/var/www/weblate/env/local/lib/python2.7/site-packages/ldap/ldapobject.py"
in _ldap_call
116. e.args[0]['info'] = strerror(e.args[0]['errno'])
Exception Type: KeyError at /accounts/login/
Exception Value: 'errno'
---
The local vars inside of _ldap_call are:
---
args: (1, 1, -1, 0, 0, 0)
diagnostic_message_success: None
e: INVALID_CREDENTIALS({'desc': 'Invalid credentials'},)
func: <built-in method result4 of LDAP object at 0x7f57d38ba350>
kwargs: {}
self: <ldap.ldapobject.SimpleLDAPObject instance at 0x7f57d37f0638>
---
I've pasted the full stack trace here:
https://github.com/WeblateOrg/weblate/issues/1460
Could it be that we don't receive an INVALID_CREDENTIALS exception as
expected, but python-ldap may have issues extracting the error message?
Can you help me to understand why python-ldap is extracting
e.args[0]['errno'] or which options we may need to set to skip this?
Thank you very much in advance for any help!
Kind regards,
Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20170426/89bfa424/attachment.html>
More information about the python-ldap
mailing list