LDAP users with non-ASCII characters in their name cause login page to crash when user lookup method is 'search' (MS AD)

Bug #1301251 reported by Morten Brekkevold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Network Administration Visualized
Fix Released
High
Morten Brekkevold
3.15
Fix Released
High
Morten Brekkevold
4.0
Fix Released
High
Morten Brekkevold

Bug Description

Traceback from Ålesund University College:

[Tue Apr 01 11:29:17 2014] [ERROR] [pid=18668 django.request] Internal Server Error: /index/login/
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/debug.py", line 69, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/nav/web/webfront/views.py", line 92, in login
    return do_login(request)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/debug.py", line 34, in sensitive_variables_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/nav/web/webfront/views.py", line 127, in do_login
    account = auth.authenticate(username, password)
  File "/usr/lib/pymodules/python2.7/nav/web/auth.py", line 95, in authenticate
    auth = ldapauth.authenticate(username, password)
  File "/usr/lib/pymodules/python2.7/nav/web/ldapauth.py", line 127, in authenticate
    user.bind(password)
  File "/usr/lib/pymodules/python2.7/nav/web/ldapauth.py", line 186, in bind
    self.ldap.simple_bind_s(user_dn.encode(encoding),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 18: ordinal not in range(128)

Analysis:

The code does not consider that the user search result from the
LDAP server is already encoded as UTF-8. Attempting to encode an already
encoded string will cause Python to attempt to decode it from ASCII to
unicode, before encoding that as UTF-8 again.

Changed in nav:
status: Confirmed → In Progress
Revision history for this message
Morten Brekkevold (mbrekkevold) wrote :
Changed in nav:
status: In Progress → Fix Committed
Changed in nav:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.