Opened 7 years ago

Closed 7 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


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

  File "/srv/simplon/", line 134, in authenticate
    authname = authenticator.authenticate(req)
  File "/srv/simplon/", line 437, in wrap
    return func(self, *args, **kwds)
  File "/srv/simplon/", line 447, in authenticate
    req.environ['REMOTE_USER'] = self._remote_user(req)
  File "/srv/simplon/", line 474, in _remote_user
    if AccountManager(self.env).check_password(user, password):
  File "/srv/simplon/", line 140, in check_password
    valid = store.check_password(user, password)
  File "/srv/simplon/", line 76, in check_password
    return self.hash_method.check_hash(user, password, hash)
  File "/srv/simplon/", line 52, in check_hash
    user,password,realm = _encode(user, password, self.realm)
  File "/srv/simplon/", 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 7 years ago.
Full traceback

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by wichert

Full traceback

comment:1 Changed 7 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:

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:

---	(revision 7163)
+++	(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 7 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 7 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

as closed The owner will remain pacopablo.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.