4569: Cannot login with German Umlaut

Misery

What version are you running?

2.5.12

What's the URL of the page containing the problem?

https://reviewboard/account/login/

What steps will reproduce the problem?

  1. Try to login
  2. Use a username with ö ä ü
  3. Login
  4. Got error 500

What is the expected output? What do you see instead?

Traceback (most recent call last):
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, callback_args, callback_kwargs)
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/views/decorators/debug.py", line 75, in sensitive_post_parameters_wrapper
return view(request, *args,
kwargs)
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
response = view_func(request,
args, kwargs)
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/views/decorators/cache.py", line 52, in _wrapped_view_func
response = view_func(request, *args,
kwargs)
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/contrib/auth/views.py", line 36, in login
if form.is_valid():
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/forms/forms.py", line 129, in is_valid
return self.is_bound and not bool(self.errors)
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/forms/forms.py", line 121, in errors
self.full_clean()
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/forms/forms.py", line 274, in full_clean
self._clean_form()
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/forms/forms.py", line 300, in _clean_form
self.cleaned_data = self.clean()
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/contrib/auth/forms.py", line 189, in clean
password=password)
File "/opt/reviewboard/dist/lib/python2.7/site-packages/django/contrib/auth/init.py", line 49, in authenticate
user = backend.authenticate(**credentials)
File "/opt/reviewboard/dist/lib/python2.7/site-packages/reviewboard/accounts/backends.py", line 980, in authenticate
bind_username = b'%s@%s' % (username_bytes, userdomain)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

What operating system are you using? What browser?

ArchLinux, Firefox 54.0.1

Please provide any additional information below.

I tried to add extra UTF-8 stuff to mod_wsgi to the VirtualHost in Apache. But this does nothing here.

    AddDefaultCharset UTF-8

    WSGIPassAuthorization On
    WSGIScriptAlias "/" "/opt/reviewboard/site/htdocs/reviewboard.wsgi/"
    WSGIDaemonProcess reviewboard python-path=/opt/reviewboard/dist/lib/python2.7/site-packages lang=en_US.UTF-8 locale=en_US.UTF-8
    WSGIProcessGroup reviewboard
Misery
#1 Misery

I added the following and it works:

diff --git a/reviewboard/accounts/backends.py b/reviewboard/accounts/backends.py
index aee1e64a5..d6e8a97bd 100644
--- a/reviewboard/accounts/backends.py
+++ b/reviewboard/accounts/backends.py
@@ -972,6 +972,9 @@ class ActiveDirectoryBackend(AuthBackend):
if isinstance(user_subdomain, six.text_type):
user_subdomain = user_subdomain.encode('utf-8')

  • if isinstance(userdomain, six.text_type):
  • userdomain = userdomain.encode('utf-8')
    +
    if isinstance(password, six.text_type):
    password = password.encode('utf-8')

@@ -983,7 +986,7 @@ class ActiveDirectoryBackend(AuthBackend):
con.simple_bind_s(bind_username, password)
user_data = self.search_ad(
con,
- filter_format('(&(objectClass=user)(sAMAccountName=%s))',
+ filter_format(b'(&(objectClass=user)(sAMAccountName=%s))',
(username_bytes,)),
userdomain)

Misery
#2 Misery

Ok, login works... but the umlaut is removed. Not really nice.

Misery
#3 Misery

Ok, if I increase the debug log it looks like the username is correct in log

--> User useröäütest@company.local is trying to log in via AD

But the username is still without the öäü.

chipx86
#4 chipx86
  • -New
    +Confirmed
  • +Release-2.5.x
  • +Component:Accounts
    +Unicode