2924: Spaces in user names using LDAP

martins********@gmai***** (Google Code) (Is this you? Claim this profile.)
david
david
Feb. 5, 2014
What version are you running?
1.7.6

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

What steps will reproduce the problem?
1. Use LDAP for authentication
2. User Mask is sAMAccountName=%s
3. sAMAccountName contains a space
4. A user name with a space is added
5. Click 'Submitters'

What is the expected output? What do you see instead?
Something broke! (Error 500)

It appears something broke when you tried to go to here. This is either a bug in Review Board or a server configuration error. Please report this to your administrator. 

Server Log:
Internal Server Error: /reviewboard/users/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.6-py2.7.egg/reviewboard/accounts/decorators.py", line 22, in _check
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.6-py2.7.egg/reviewboard/reviews/views.py", line 798, in submitter_list
    return grid.render_to_response(template_name)
  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/datagrid/grids.py", line 763, in render_to_response
    self.load_state()
  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/datagrid/grids.py", line 590, in load_state
    self.precompute_objects()
  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/datagrid/grids.py", line 695, in precompute_objects
    for obj in object_list if obj is not None
  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/datagrid/grids.py", line 254, in render_cell
    url = self.link_func(obj, rendered_data)
  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/datagrid/grids.py", line 86, in <lambda>
    (lambda x, y: self.datagrid.link_to_object(x, y))
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.6-py2.7.egg/reviewboard/reviews/datagrids.py", line 742, in link_to_object
    args=[obj.username])
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.6-py2.7.egg/reviewboard/site/urlresolvers.py", line 36, in local_site_reverse
    *func_args, **func_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/urlresolvers.py", line 476, in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/urlresolvers.py", line 396, in _reverse_with_prefix
    "arguments '%s' not found." % (lookup_view_s, args, kwargs))
NoReverseMatch: Reverse for 'user' with arguments '(u'Foo Bar',)' and keyword arguments '{}' not found.

What operating system are you using? What browser?
Ubuntu 12.04
Firefox 18

Please provide any additional information below.
I don't know, if there is a work around for this issue. I cannot use uid, because this field does not exist in our directory.
david
#1 david
The django user model is only expected to use letters, digits, or @.+-_ characters. Sounds like we need to strip out spaces (and other non-matching characters) when creating users from auth backends.
  • +Component-Accounts
    +EasyFix
david
#2 david
Although... I'm not sure how auth would work then. Maybe we just assume that it'll be okay and fix our URL regexes to allow spaces.
david
#3 david
  • +PendingReview
  • -EasyFix
  • +david
david
#4 david
Fixed in master (fc95975). This will ship in 2.0 beta 3. Thanks!
  • -PendingReview
    +Fixed