Modify

Opened 5 years ago

Closed 4 years ago

#6464 closed defect (duplicate)

[Patch] pwhash does not work with trac 0.11.6

Reported by: wichert@… Owned by: pacopablo
Priority: normal Component: AccountManagerPlugin
Severity: critical Keywords:
Cc: Trac Release: 0.11

Description

After upgrading to trac 0.11.6 and r7163 for AccountManagerPlugin I get this error:

  File "/srv/simplon/code.simplon.biz/trac/eggs/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 134, in authenticate
    authname = authenticator.authenticate(req)
  File "/srv/simplon/code.simplon.biz/trac/parts/svn-eggs/accountmanagerplugin/acct_mgr/web_ui.py", line 437, in wrap
    return func(self, *args, **kwds)
  File "/srv/simplon/code.simplon.biz/trac/parts/svn-eggs/accountmanagerplugin/acct_mgr/web_ui.py", line 447, in authenticate
    req.environ['REMOTE_USER'] = self._remote_user(req)
  File "/srv/simplon/code.simplon.biz/trac/parts/svn-eggs/accountmanagerplugin/acct_mgr/web_ui.py", line 474, in _remote_user
    if AccountManager(self.env).check_password(user, password):
  File "/srv/simplon/code.simplon.biz/trac/parts/svn-eggs/accountmanagerplugin/acct_mgr/api.py", line 140, in check_password
    valid = store.check_password(user, password)
  File "/srv/simplon/code.simplon.biz/trac/parts/svn-eggs/accountmanagerplugin/acct_mgr/db.py", line 76, in check_password
    return self.hash_method.check_hash(user, password, hash)
  File "/srv/simplon/code.simplon.biz/trac/parts/svn-eggs/accountmanagerplugin/acct_mgr/pwhash.py", line 52, in check_hash
    user,password,realm = _encode(user, password, self.realm)
  File "/srv/simplon/code.simplon.biz/trac/parts/svn-eggs/accountmanagerplugin/acct_mgr/pwhash.py", line 57, in _encode
    return [a.encode('utf-8') for a in args]
AttributeError: 'NoneType' object has no attribute 'encode'

I will attach the full traceback with context as an attachment.

Attachments (1)

traceback.txt (8.1 KB) - added by wichert@… 5 years ago.
Full traceback

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by wichert@…

Full traceback

comment:1 Changed 5 years ago by anonymous

The problems appears to be that the realm is now set to None, where it probably was an empty string before. For some reasong setting htdigest_realm in trac.ini did not work for me:

[account-manager]
force_passwd_change = true
hash_method = HtDigestHashMethod
htdigest_realm = 
password_file = /srv/simplon/etc/passwd
password_store = SessionStore

I ended up using this patch which gets things working again:

Index: pwhash.py
===================================================================
--- pwhash.py	(revision 7163)
+++ pwhash.py	(working copy)
@@ -45,7 +45,8 @@
     realm = Option('account-manager', 'htdigest_realm')
 
     def generate_hash(self, user, password):
-        user,password,realm = _encode(user, password, self.realm)
+        realm = self.realm or ''
+        user,password,realm = _encode(user, password, realm)
         return ':'.join([realm, htdigest(user, realm, password)])
 
     def check_hash(self, user, password, hash):

comment:2 Changed 5 years ago by anonymous

  • Summary changed from pwhash does not work with trac 0.11.6 to [Patch] pwhash does not work with trac 0.11.6

comment:3 Changed 4 years ago by pacopablo

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

This is a duplicate of #6329 and #6453

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from pacopablo. Next status will be '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.