Modify

Opened 7 years ago

Closed 4 years ago

#1922 closed defect (fixed)

[patch] ValueError with HttpAuthStore when entering invalid credentials

Reported by: retracile Owned by: hasienda
Priority: high Component: AccountManagerPlugin
Severity: normal Keywords: authentication HTTP
Cc: Trac Release: 0.11

Description

Attempting to login with an invalid user gives this traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 339, in send_error
    'text/html')
  File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 570, in render_template
    data = self.populate_data(req, data)
  File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 500, in populate_data
    d['chrome'].update(req.chrome)
  File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 167, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 379, in prepare_request
    for category, name, text in contributor.get_navigation_items(req):
  File "/usr/lib/python2.4/site-packages/trac/ticket/web_ui.py", line 127, in get_navigation_items
    if 'TICKET_CREATE' in req.perm:
  File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 167, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 272, in _get_perm
    return PermissionCache(self.env, self.authenticate(req))
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 154, in authenticate
    authname = authenticator.authenticate(req)
  File "/usr/lib/python2.4/site-packages/acct_mgr/web_ui.py", line 332, in wrap
    return func(self, *args, **kwds)
  File "/usr/lib/python2.4/site-packages/acct_mgr/web_ui.py", line 342, in authenticate
    req.environ['REMOTE_USER'] = self._remote_user(req)
  File "/usr/lib/python2.4/site-packages/acct_mgr/web_ui.py", line 371, in _remote_user
    if AccountManager(self.env).check_password(user, password):
  File "/usr/lib/python2.4/site-packages/acct_mgr/api.py", line 104, in check_password
    return self.password_store.check_password(user, password)
  File "/usr/lib/python2.4/site-packages/acct_mgr/http.py", line 30, in check_password
    HTTPDigestAuthHandler(mgr)).open(self.auth_url)
  File "/usr/lib/python2.4/urllib2.py", line 364, in open
    response = meth(req, response)
  File "/usr/lib/python2.4/urllib2.py", line 471, in http_response
    response = self.parent.error(
  File "/usr/lib/python2.4/urllib2.py", line 396, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.4/urllib2.py", line 741, in http_error_401
    host, req, headers)
  File "/usr/lib/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/urllib2.py", line 730, in retry_http_basic_auth
    return self.parent.open(req)
  File "/usr/lib/python2.4/urllib2.py", line 364, in open
    response = meth(req, response)
  File "/usr/lib/python2.4/urllib2.py", line 471, in http_response
    response = self.parent.error(
  File "/usr/lib/python2.4/urllib2.py", line 396, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.4/urllib2.py", line 916, in http_error_401
    host, req, headers)
  File "/usr/lib/python2.4/urllib2.py", line 807, in http_error_auth_reqed
    raise ValueError("AbstractDigestAuthHandler doesn't know "
ValueError: AbstractDigestAuthHandler doesn't know about Basic

Attachments (1)

accountmanagerplugin-ValueError-fix2.patch (598 bytes) - added by retracile 7 years ago.
And patch to fix it.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by retracile

And patch to fix it.

comment:1 Changed 6 years ago by mgood

  • Summary changed from ValueError: AbstractDigestAuthHandler doesn't know about Basic to ValueError with HttpAuthStore when entering invalid credentials

comment:2 Changed 5 years ago by anonymous

Almost the same error?

anything to do with the HttpAuthPlugin i'm using?

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/trac/web/api.py", line 377, in send_error
    'text/html')
  File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 725, in render_template
    req.chrome[type_].append(
  File "/usr/lib/python2.6/site-packages/trac/web/api.py", line 195, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 489, in prepare_request
    for category, name, text in contributor.get_navigation_items(req):
  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 375, in get_navigation_items
    if req.authname == 'anonymous':
  File "/usr/lib/python2.6/site-packages/trac/web/api.py", line 195, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 133, in authenticate
    authname = authenticator.authenticate(req)
  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 429, in wrap
    return func(self, *args, **kwds)
  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 439, in authenticate
    req.environ['REMOTE_USER'] = self._remote_user(req)
  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 466, in _remote_user
    if AccountManager(self.env).check_password(user, password):
  File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 140, in check_password
    valid = store.check_password(user, password)
  File "build/bdist.linux-i686/egg/acct_mgr/http.py", line 30, in check_password
    HTTPDigestAuthHandler(mgr)).open(self.auth_url)
  File "/usr/lib/python2.6/urllib2.py", line 375, in open
    protocol = req.get_type()
  File "/usr/lib/python2.6/urllib2.py", line 241, in get_type
    raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: 


comment:3 Changed 4 years ago by anonymous

  • Priority changed from normal to high

I see the same error.

comment:4 Changed 4 years ago by hasienda

  • Keywords authentication HTTP added
  • Owner changed from mgood to hasienda
  • Summary changed from ValueError with HttpAuthStore when entering invalid credentials to [patch] ValueError with HttpAuthStore when entering invalid credentials

Beware, that returning False would actively reject the request as invalid, while this shouldn't be the case, as far as I understand the report.

So None would be more appropriate, since it allows to check more alternative AuthStores, if available.

comment:5 Changed 4 years ago by hasienda

  • Resolution set to fixed
  • Status changed from new to closed

(In [9279]) AccountManagerPlugin: Handle invalid user in HttpAuthStore more gracefully, closes #1922.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.