Modify ↓
      
        Opened 16 years ago
Closed 16 years ago
#6464 closed defect (duplicate)
[Patch] pwhash does not work with trac 0.11.6
| Reported by: | Wichert Akkerman | Owned by: | John Hampton | 
|---|---|---|---|
| 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)
Change History (4)
Changed 16 years ago by
| Attachment: | traceback.txt added | 
|---|
comment:1 Changed 16 years ago by
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 16 years ago by
| Summary: | pwhash does not work with trac 0.11.6 → [Patch] pwhash does not work with trac 0.11.6 | 
|---|
comment:3 Changed 16 years ago by
| Resolution: | → duplicate | 
|---|---|
| Status: | new → closed | 
Note: See
        TracTickets for help on using
        tickets.
    


Full traceback