Skip to content

Commit 579bcb9

Browse files
committed
fix: crash roundup-admin perftest password without rounds= argument.
If the rounds value is taken from the config file, it doesn't need to be parsed into an int.
1 parent eb334a1 commit 579bcb9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Fixed:
5656
manually if it is at 2 million. PBKDF2-SHA512 (PBKDF2S5) has been
5757
available since release 2.3, but it required a manual step to make
5858
it the default. (John Rouillard)
59+
- fixed a crash with roundup-admin perftest password when rounds not set
60+
on command line. (John Rouillard)
5961

6062
Features:
6163

roundup/admin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,7 @@ def do_perftest(self, args):
16331633
"""
16341634
from roundup.anypy.time_ import perf_counter
16351635

1636+
# default rounds from db.config is an int not str
16361637
props = {"rounds": self.db.config.PASSWORD_PBKDF2_DEFAULT_ROUNDS,
16371638
"scheme": password.Password.default_scheme}
16381639

@@ -1649,7 +1650,9 @@ def do_perftest(self, args):
16491650
if args[0] == "password":
16501651
try:
16511652
# convert 10,000,000 or 10.000.000 to 10000000
1652-
r = int(re.sub('[,.]', '', props['rounds']))
1653+
r = int(re.sub('[,.]', '', props['rounds'])) \
1654+
if not isinstance(props['rounds'], int) \
1655+
else props['rounds']
16531656
if r < 1000:
16541657
print(_("Invalid 'rounds'. Must be larger than 999."))
16551658
return

0 commit comments

Comments
 (0)