mirror of
https://github.com/modoboa/modoboa.git
synced 2026-04-26 17:36:01 +03:00
[GH-ISSUE #1798] Error with LDAP authentication - TypeError: 'NoneType' object is not iterable #1417
Labels
No labels
bug
bug
dependencies
design
documentation
duplicate
enhancement
enhancement
enhancement
feedback-needed
help-needed
help-needed
installer
invalid
looking-for-sponsors
modoboa-contacts
new-ui
new-ui
pr
pull-request
pyconfr
python
question
security
stale
webmail
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-modoboa#1417
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @abonanni on GitHub (Dec 5, 2019).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1798
Impacted versions
Steps to reproduce
Configure an LDAP authentication backend and authenticate with a non existing database user (but existing in LDAP)
Current behavior
Une erreur interne est survenue.
You will find the log below :
Dec 5 14:07:05 modoboa django.request: ERROR Internal Server Error: /accounts/login/#012Traceback (most recent call last):#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner#012 response = get_response(request)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response#012 response = self.process_exception_by_middleware(e, request)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response#012 response = wrapped_callback(request, *callback_args, **callback_kwargs)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner#012 return func(*args, **kwargs)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner#012 return func(*args, **kwargs)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func#012 response = view_func(request, *args, **kwargs)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/core/views/auth.py", line 36, in dologin#012 password=form.cleaned_data["password"])#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 70, in authenticate#012 user = _authenticate_with_backend(backend, backend_path, request, credentials)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 116, in _authenticate_with_backend#012 return backend.authenticate(*args, **credentials)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/lib/authbackends.py", line 118, in authenticate#012 return super(LDAPBackend, self).authenticate(*args, **kwargs)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 150, in authenticate#012 user = self.authenticate_ldap_user(ldap_user, password)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 210, in authenticate_ldap_user#012 return ldap_user.authenticate(password)#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 350, in authenticate#012 self._get_or_create_user()#012 File "/srv/modoboa/env/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 591, in _get_or_create_user#012 self._user, built = self.backend.get_or_build_user(username, self)#012TypeError: 'NoneType' object is not iterableExpected behavior
Create user in database.
@abonanni commented on GitHub (Dec 5, 2019):
I've changed the search filter with :
(&(objectClass=user)(mail=%(user)s))instead of
(sAMAccountName=%(user)s)and it's better@tonioo commented on GitHub (Dec 17, 2019):
@abonanni what kind of username did you use to generate such an error? Was it an email address or an LDAP CN?
@abonanni commented on GitHub (Jan 3, 2020):
It was an LDAP CN, I want to use "sAMAccountName" to authenticate instead of email Address