Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#12669 closed defect (fixed)

Replace use of deprecated encrypt method from passlib library

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2.1
Component: general Version:
Severity: normal Keywords: passlib windows
Cc: Branch:
Release Notes:

Replaced use of deprecated encrypt method from passlib library with hash.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

I noticed the following in the AppVeyor builds:

C:\projects\trac\trac\util\compat.py:36: DeprecationWarning: the method passlib.handlers.des_crypt.des_crypt.encrypt() is deprecated as of Passlib 1.7, and will be removed in Passlib 2.0, use .hash() instead.
  return des_crypt.encrypt(secret, salt=salt)

PasswordHash.encrypt() was renamed to PasswordHash.hash() in release 1.7 (Nov 2016).

Attachments (0)

Change History (6)

comment:1 by Ryan J Ollos, 8 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:2 by Ryan J Ollos, 8 years ago

Description: modified (diff)

comment:3 by Ryan J Ollos, 8 years ago

Proposed changes:

  • trac/util/compat.py

    diff --git a/trac/util/compat.py b/trac/util/compat.py
    index 3a0c126f6..0ec6f8c2a 100644
    a b except ImportError:  
    3434        crypt = None
    3535    else:
    3636        def crypt(secret, salt):
    37             return des_crypt.encrypt(secret, salt=salt)
     37            # encrypt method deprecated in favor of hash in passlib 1.7
     38            hash_method = des_crypt.hash if hasattr(des_crypt, 'hash') \
     39                                         else des_crypt.encrypt
     40            return hash_method(secret, salt=salt)
    3841
    3942# Import symbols previously defined here, kept around so that plugins importing
    4043# them don't suddenly stop working

Tested with Passlib 1.6 and 1.7 on Windows 7 x64.

comment:4 by Ryan J Ollos, 8 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.2-stable in r15400, merged to trunk in r15401.

comment:5 by Ryan J Ollos, 7 years ago

See also #12861.

comment:6 by Ryan J Ollos, 7 years ago

Additional documentation in 1.3/TracInstall@10.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.