Re: Issue 2121 in reviewboard: post-review doesn't handle bad passwords nicely
Comment #4 on issue 2121 by chris.cl...@actian.com: post-review doesn't handle bad passwords nicely http://code.google.com/p/reviewboard/issues/detail?id=2121 This is the hack I'm using for older python machines: diff --git a/rbtools/postreview.py b/rbtools/postreview.py index df791aa..d8af51c 100755 --- a/rbtools/postreview.py +++ b/rbtools/postreview.py @@ -12,6 +12,11 @@ from optparse import OptionParser import datetime try: +from cStringIO import StringIO as FakeFile +except ImportError: +from StringIO import StringIO as FakeFile + +try: # setuptools from http://peak.telecommunity.com/ from pkg_resources import parse_version except ImportError: @@ -192,8 +197,18 @@ class ReviewBoardHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler): if not self._retried: self._retried = True self.retried = 0 -response = urllib2.HTTPBasicAuthHandler.retry_http_basic_auth( -self, *args, **kwargs) +try: +response = urllib2.HTTPBasicAuthHandler.retry_http_basic_auth( +self, *args, **kwargs) +except ValueError, e: +if e.args[0] == "AbstractDigestAuthHandler doesn't know about Basic" and sys.version_info >= (2, 4) and sys.version_info < (2, 5): +# Python 2.4 client and user gave bad username/password +# Hack to log a slightly more useful error message +# See http://code.google.com/p/reviewboard/issues/detail?id=2121 +print 'ERROR: Suspect incorrect username and/or password' +fileptr = FakeFile('') +raise urllib2.HTTPError(None, 401, None, None, fileptr) +raise if response.code != 401: self._retried = False -- You received this message because this project is configured to send all issue notifications to this address. You may adjust your notification preferences at: https://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "reviewboard-issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard-issues+unsubscr...@googlegroups.com. To post to this group, send email to reviewboard-issues@googlegroups.com. Visit this group at http://groups.google.com/group/reviewboard-issues?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Issue 2121 in reviewboard: post-review doesn't handle bad passwords nicely
Comment #3 on issue 2121 by chris.cl...@actian.com: post-review doesn't handle bad passwords nicely http://code.google.com/p/reviewboard/issues/detail?id=2121 This is the hack I'm using for older python machines: diff --git a/rbtools/postreview.py b/rbtools/postreview.py index df791aa..5323b9c 100755 --- a/rbtools/postreview.py +++ b/rbtools/postreview.py @@ -12,6 +12,11 @@ from optparse import OptionParser import datetime try: +from cStringIO import StringIO as FakeFile +except ImportError: +from StringIO import StringIO as FakeFile + +try: # setuptools from http://peak.telecommunity.com/ from pkg_resources import parse_version except ImportError: @@ -192,8 +197,19 @@ class ReviewBoardHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler): if not self._retried: self._retried = True self.retried = 0 -response = urllib2.HTTPBasicAuthHandler.retry_http_basic_auth( -self, *args, **kwargs) +try: +response = urllib2.HTTPBasicAuthHandler.retry_http_basic_auth( +self, *args, **kwargs) +except ValueError, e: +# more than likely Python 2.4 client and +# user used bad username/password +if e.args[0] == "AbstractDigestAuthHandler doesn't know about Basic" and sys.versio +# See http://code.google.com/p/reviewboard/issues/detail?id=2121 +# Hack to log a slightly more useful error message +print 'ERROR: Suspect incorrect username and/or password' +fileptr = FakeFile('') +raise urllib2.HTTPError(None, 401, None, None, fileptr) +raise if response.code != 401: self._retried = False -- You received this message because this project is configured to send all issue notifications to this address. You may adjust your notification preferences at: https://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "reviewboard-issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard-issues+unsubscr...@googlegroups.com. To post to this group, send email to reviewboard-issues@googlegroups.com. Visit this group at http://groups.google.com/group/reviewboard-issues?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Issue 2121 in reviewboard: post-review doesn't handle bad passwords nicely
Comment #2 on issue 2121 by mark.doliner: post-review doesn't handle bad passwords nicely http://code.google.com/p/reviewboard/issues/detail?id=2121 (for people Googling for this stack trace in the future) It's worth noting that this same stack trace is displayed if the site administrator failed to add the "WSGIPassAuthorization On" setting to the Apache config file for the site when upgrading from an older version of ReviewBoard. Without this flag the Authorization header isn't passed to ReviewBoard, and so the ReviewBoard server thinks the client isn't providing username and password. This happens with python 2.4, at least. With newer versions of python I'd expect the client to show the normal "incorrect password" error message. -- You received this message because you are subscribed to the Google Groups "reviewboard-issues" group. To post to this group, send email to reviewboard-issues@googlegroups.com. To unsubscribe from this group, send email to reviewboard-issues+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reviewboard-issues?hl=en.
Re: Issue 2121 in reviewboard: post-review doesn't handle bad passwords nicely
Updates: Status: Confirmed Labels: -Priority-Medium Priority-High Milestone-RBTools-Release1.0 Component-RBTools Comment #1 on issue 2121 by chip...@gmail.com: post-review doesn't handle bad passwords nicely http://code.google.com/p/reviewboard/issues/detail?id=2121 This problem seems to be specific to Python 2.4. We normally do the right thing. -- You received this message because you are subscribed to the Google Groups "reviewboard-issues" group. To post to this group, send email to reviewboard-issues@googlegroups.com. To unsubscribe from this group, send email to reviewboard-issues+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reviewboard-issues?hl=en.
Issue 2121 in reviewboard: post-review doesn't handle bad passwords nicely
Status: New Owner: Labels: Type-Enhancement Priority-Medium New issue 2121 by gtuc...@gmail.com: post-review doesn't handle bad passwords nicely http://code.google.com/p/reviewboard/issues/detail?id=2121 *NOTE: If you have a patch, please submit it to http://reviews.reviewboard.org/ What version are you running? RBTools 0.3.2 What's the URL of the page this enhancement relates to, if any? NA Describe the enhancement and the motivation for it. For end user tools (front end and CLI), errors should be informative and handled cleanly as not doing so creates noise for the admin. When an incorrect password is provided to post-review, instead of getting an error message, the user is given a traceback. A better user experience would catch the ValueError exception and give the user an error like "Login failed. Please check your password or contact your ReviewBoard administrator." What steps will reproduce the problem? 1. Remove $HOME/.post-review-cookies.txt 2. Create a change. 2. Execute post-review to post changes. 3. Enter an incorrect password. What operating system are you using? What browser? $ lsb_release -a LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: CentOS Description:CentOS release 5.2 (Final) Release:5.2 Codename: Final Please provide any additional information below. We're using LDAP for authentication. This is the traceback: """ Traceback (most recent call last): File "/usr/bin/post-review", line 7, in ? sys.exit( File "/usr/lib/python2.4/site-packages/RBTools-0.3.2-py2.4.egg/rbtools/postreview.py", line 3741, in main File "/usr/lib/python2.4/site-packages/RBTools-0.3.2-py2.4.egg/rbtools/postreview.py", line 434, in check_api_version File "/usr/lib/python2.4/site-packages/RBTools-0.3.2-py2.4.egg/rbtools/postreview.py", line 876, in api_get File "/usr/lib/python2.4/site-packages/RBTools-0.3.2-py2.4.egg/rbtools/postreview.py", line 846, in http_get File "/usr/lib64/python2.4/urllib2.py", line 130, in urlopen return _opener.open(url, data) File "/usr/lib64/python2.4/urllib2.py", line 364, in open response = meth(req, response) File "/usr/lib/python2.4/site-packages/RBTools-0.3.2-py2.4.egg/rbtools/postreview.py", line 317, in http_response File "/usr/lib64/python2.4/urllib2.py", line 396, in error result = self._call_chain(*args) File "/usr/lib64/python2.4/urllib2.py", line 337, in _call_chain result = func(*args) File "/usr/lib64/python2.4/urllib2.py", line 741, in http_error_401 host, req, headers) File "/usr/lib64/python2.4/urllib2.py", line 720, in http_error_auth_reqed return self.retry_http_basic_auth(host, req, realm) File "/usr/lib/python2.4/site-packages/RBTools-0.3.2-py2.4.egg/rbtools/postreview.py", line 339, in retry_http_basic_auth File "/usr/lib64/python2.4/urllib2.py", line 730, in retry_http_basic_auth return self.parent.open(req) File "/usr/lib64/python2.4/urllib2.py", line 364, in open response = meth(req, response) File "/usr/lib/python2.4/site-packages/RBTools-0.3.2-py2.4.egg/rbtools/postreview.py", line 317, in http_response File "/usr/lib64/python2.4/urllib2.py", line 396, in error result = self._call_chain(*args) File "/usr/lib64/python2.4/urllib2.py", line 337, in _call_chain result = func(*args) File "/usr/lib64/python2.4/urllib2.py", line 916, in http_error_401 host, req, headers) File "/usr/lib64/python2.4/urllib2.py", line 807, in http_error_auth_reqed raise ValueError("AbstractDigestAuthHandler doesn't know " ValueError: AbstractDigestAuthHandler doesn't know about Basic """ -- You received this message because you are subscribed to the Google Groups "reviewboard-issues" group. To post to this group, send email to reviewboard-issues@googlegroups.com. To unsubscribe from this group, send email to reviewboard-issues+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reviewboard-issues?hl=en.