Re: Unicode + ldap login traceback

2014-02-20 Thread David Trowbridge
Walt,

Thanks. We'll get this fixed for the next 1.7.x point release.

-David


On Wed, Feb 19, 2014 at 3:10 PM, Javins, Walt wrote:

>  Thanks David!
>
>
>
> I’ve filed the bug here:
>
>
>
> http://code.google.com/p/reviewboard/issues/detail?id=3256
>
>
>
> Let me know what else I can do to help out!
>
>
>
> Walt
>
>
>
> *From:* reviewboard@googlegroups.com [mailto:reviewboard@googlegroups.com]
> *On Behalf Of *David Trowbridge
> *Sent:* Wednesday, February 19, 2014 1:42 PM
> *To:* reviewboard
> *Subject:* Re: Unicode + ldap login traceback
>
>
>
> Walt,
>
>
>
> It looks like we need to do some encoding gymnastics because python-ldap
> doesn't handle unicode strings nicely. Would you mind filing a bug about
> this?
>
>
>
> Thanks,
>
> -David
>
>
>
> On Wed, Feb 19, 2014 at 11:30 AM, Javins, Walt 
> wrote:
>
> Hi RB Community,
>
>
>
> I recently had a individual contributor report that he was unable to login
> to our instance of reviewboard, and the server was giving a 500 error.
> When I checked the logs, I saw the following traceback:
>
>
>
> 2014-01-30 15:02:12,208 - DEBUG -  - User un...@company.com is trying to
> log in via AD
>
> 2014-01-30 15:02:12,209 - ERROR -  - Exception thrown for user
> AnonymousUser at http://codereview.company.com/account/login/
>
>
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in
> position 8: ordinal not in range(128)
>
> Traceback (most recent call last):
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/core/handlers/base.py",
> line 111, in get_response
>
> response = callback(request, *callback_args, **callback_kwargs)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/views/decorators/debug.py",
> line 75, in sensitive_post_parameters_wrapper
>
> return view(request, *args, **kwargs)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/utils/decorators.py",
> line 91, in _wrapped_view
>
> response = view_func(request, *args, **kwargs)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/views/decorators/cache.py",
> line 89, in _wrapped_view_func
>
> response = view_func(request, *args, **kwargs)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/contrib/auth/views.py",
> line 36, in login
>
> if form.is_valid():
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
> line 124, in is_valid
>
> return self.is_bound and not bool(self.errors)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
> line 115, in _get_errors
>
> self.full_clean()
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
> line 271, in full_clean
>
> self._clean_form()
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
> line 299, in _clean_form
>
> self.cleaned_data = self.clean()
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/contrib/auth/forms.py",
> line 167, in clean
>
> password=password)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/contrib/auth/__init__.py",
> line 45, in authenticate
>
> user = backend.authenticate(**credentials)
>
>   File
> "/usr/lib/python2.6/site-packages/ReviewBoard-1.7.21-py2.6.egg/reviewboard/accounts/backends.py",
> line 539, in authenticate
>
> con.simple_bind_s(bind_username, password)
>
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 206,
> in simple_bind_s
>
> msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
>
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 200,
> in simple_bind
>
> return
> self._ldap_call(self._l.simple_bind,who,cred,EncodeControlTuples(serverctrls),EncodeControlTuples(clientctrls))
>
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 96,
> in _ldap_call
>
> result = func(*args,**kwargs)
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in
> position 8: ordinal not in range(128)
>
>
>
> Upon talking to the user, he said he does have a unicode character in his
> password (but not username).  Furthermore he reported tha

RE: Unicode + ldap login traceback

2014-02-19 Thread Javins, Walt
Thanks David!

I’ve filed the bug here:

http://code.google.com/p/reviewboard/issues/detail?id=3256

Let me know what else I can do to help out!

Walt

From: reviewboard@googlegroups.com [mailto:reviewboard@googlegroups.com] On 
Behalf Of David Trowbridge
Sent: Wednesday, February 19, 2014 1:42 PM
To: reviewboard
Subject: Re: Unicode + ldap login traceback

Walt,

It looks like we need to do some encoding gymnastics because python-ldap 
doesn't handle unicode strings nicely. Would you mind filing a bug about this?

Thanks,
-David

On Wed, Feb 19, 2014 at 11:30 AM, Javins, Walt 
mailto:walt.jav...@isilon.com>> wrote:
Hi RB Community,

I recently had a individual contributor report that he was unable to login to 
our instance of reviewboard, and the server was giving a 500 error.  When I 
checked the logs, I saw the following traceback:

2014-01-30 15:02:12,208 - DEBUG -  - User 
un...@company.com<mailto:un...@company.com> is trying to log in via AD
2014-01-30 15:02:12,209 - ERROR -  - Exception thrown for user AnonymousUser at 
http://codereview.company.com/account/login/

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 8: 
ordinal not in range(128)
Traceback (most recent call last):
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/core/handlers/base.py",
 line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/views/decorators/debug.py",
 line 75, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/utils/decorators.py",
 line 91, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/views/decorators/cache.py",
 line 89, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/contrib/auth/views.py",
 line 36, in login
if form.is_valid():
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
 line 124, in is_valid
return self.is_bound and not bool(self.errors)
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
 line 115, in _get_errors
self.full_clean()
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
 line 271, in full_clean
self._clean_form()
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
 line 299, in _clean_form
self.cleaned_data = self.clean()
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/contrib/auth/forms.py",
 line 167, in clean
password=password)
  File 
"/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/contrib/auth/__init__.py",
 line 45, in authenticate
user = backend.authenticate(**credentials)
  File 
"/usr/lib/python2.6/site-packages/ReviewBoard-1.7.21-py2.6.egg/reviewboard/accounts/backends.py",
 line 539, in authenticate
con.simple_bind_s(bind_username, password)
  File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 206, in 
simple_bind_s
msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
  File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 200, in 
simple_bind
return 
self._ldap_call(self._l.simple_bind,who,cred,EncodeControlTuples(serverctrls),EncodeControlTuples(clientctrls))
  File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 96, in 
_ldap_call
result = func(*args,**kwargs)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 8: 
ordinal not in range(128)

Upon talking to the user, he said he does have a unicode character in his 
password (but not username).  Furthermore he reported that he hadn’t had 
trouble logging into any of the other numerous services that bind to  our AD 
via ldap (none of which are python/django).  This leads me to believe that 
somewhere in RB, django, or python’s ldap module there is some incorrect 
unicode handling of the password.

Has anyone else encountered a similar issue?

Does anyone have debugging tips that could help me track down exactly where in 
the source code the problem is?

My inclination is to somehow attach pdb to django so that I can traverse this 
stack trace and see exactly where any Unicode handling does/doesn’t happen in 
relation to the password field.  That would help narrow down if the issue lies 
with Review Board or one of the upstreams that it consumes.

Thanks for your time,
Walt


--
Get the Review Board Power Pack at http://www.reviewboard.org/powerpack/

Re: Unicode + ldap login traceback

2014-02-19 Thread David Trowbridge
Walt,

It looks like we need to do some encoding gymnastics because python-ldap
doesn't handle unicode strings nicely. Would you mind filing a bug about
this?

Thanks,
-David


On Wed, Feb 19, 2014 at 11:30 AM, Javins, Walt wrote:

>  Hi RB Community,
>
>
>
> I recently had a individual contributor report that he was unable to login
> to our instance of reviewboard, and the server was giving a 500 error.
> When I checked the logs, I saw the following traceback:
>
>
>
> 2014-01-30 15:02:12,208 - DEBUG -  - User un...@company.com is trying to
> log in via AD
>
> 2014-01-30 15:02:12,209 - ERROR -  - Exception thrown for user
> AnonymousUser at http://codereview.company.com/account/login/
>
>
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in
> position 8: ordinal not in range(128)
>
> Traceback (most recent call last):
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/core/handlers/base.py",
> line 111, in get_response
>
> response = callback(request, *callback_args, **callback_kwargs)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/views/decorators/debug.py",
> line 75, in sensitive_post_parameters_wrapper
>
> return view(request, *args, **kwargs)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/utils/decorators.py",
> line 91, in _wrapped_view
>
> response = view_func(request, *args, **kwargs)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/views/decorators/cache.py",
> line 89, in _wrapped_view_func
>
> response = view_func(request, *args, **kwargs)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/contrib/auth/views.py",
> line 36, in login
>
> if form.is_valid():
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
> line 124, in is_valid
>
> return self.is_bound and not bool(self.errors)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
> line 115, in _get_errors
>
> self.full_clean()
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
> line 271, in full_clean
>
> self._clean_form()
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/forms/forms.py",
> line 299, in _clean_form
>
> self.cleaned_data = self.clean()
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/contrib/auth/forms.py",
> line 167, in clean
>
> password=password)
>
>   File
> "/usr/lib/python2.6/site-packages/Django-1.4.10-py2.6.egg/django/contrib/auth/__init__.py",
> line 45, in authenticate
>
> user = backend.authenticate(**credentials)
>
>   File
> "/usr/lib/python2.6/site-packages/ReviewBoard-1.7.21-py2.6.egg/reviewboard/accounts/backends.py",
> line 539, in authenticate
>
> con.simple_bind_s(bind_username, password)
>
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 206,
> in simple_bind_s
>
> msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
>
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 200,
> in simple_bind
>
> return
> self._ldap_call(self._l.simple_bind,who,cred,EncodeControlTuples(serverctrls),EncodeControlTuples(clientctrls))
>
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 96,
> in _ldap_call
>
> result = func(*args,**kwargs)
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in
> position 8: ordinal not in range(128)
>
>
>
> Upon talking to the user, he said he does have a unicode character in his
> password (but not username).  Furthermore he reported that he hadn’t had
> trouble logging into any of the other numerous services that bind to  our
> AD via ldap (none of which are python/django).  This leads me to believe
> that somewhere in RB, django, or python’s ldap module there is some
> incorrect unicode handling of the password.
>
>
>
> Has anyone else encountered a similar issue?
>
>
>
> Does anyone have debugging tips that could help me track down exactly
> where in the source code the problem is?
>
>
>
> My inclination is to somehow attach pdb to django so that I can traverse
> this stack trace and see exactly where any Unicode handling does/doesn’t
> happen in relation to the password field.  That would help narrow down if
> the issue lies with Review Board or one of the upstreams that it consumes.
>
>
>
> Thanks for your time,
>
> Walt
>
>
>
>
>
> --
> Get the Review Board Power Pack at http://www.reviewboard.org/powerpack/
> ---
> Sign up for Review Board hosting at RBCommons: https://rbcommons.com/
> ---
> Happy user? Let us know at http://www.reviewboard.org/users/
> ---
> You received this message because you are subscribed to the Google Groups
> "reviewboard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> For more option