This is an automated email from the git hooks/post-receive script.
firstyear pushed a commit to branch master
in repository 389-ds-base.
commit 955510cd06cd6802699c332551f1e0a6c0879b2b
Author: William Brown <firstyear(a)redhat.com>
Date: Wed Nov 15 15:41:06 2017 +1000
Ticket 49453 - passwd.py to use pwdhash defaults.
Bug Description: pwdhash now uses the defaults from libslapd,
so we do not need to code this into passwd.py
Fix Description: Change the default args for passwd.py to
simplify the call.
https://pagure.io/389-ds-base/issue/49453
Author: wibrown
Review by: alisha17, spichugi (Thank you!)
---
src/lib389/lib389/passwd.py | 29 ++++++-----------------------
1 file changed, 6 insertions(+), 23 deletions(-)
diff --git a/src/lib389/lib389/passwd.py b/src/lib389/lib389/passwd.py
index f36d73e..e422735 100644
--- a/src/lib389/lib389/passwd.py
+++ b/src/lib389/lib389/passwd.py
@@ -15,37 +15,20 @@ import subprocess
import random
import string
import os
-import sys
-
-BESTSCHEME = 'SSHA512'
-MAJOR, MINOR, _, _, _ = sys.version_info
-
-# We need a dict of the schemes I think ....
-PWSCHEMES = [
- 'SHA1',
- 'SHA256',
- 'SHA512',
- 'SSHA',
- 'SSHA256',
- 'SSHA512',
-]
-
# How do we feed our prefix into this?
-def password_hash(pw, scheme=BESTSCHEME, bin_dir='/bin'):
+def password_hash(pw, scheme=None, bin_dir='/bin'):
# Check that the binary exists
- assert(scheme in PWSCHEMES)
pwdhashbin = os.path.join(bin_dir, 'pwdhash')
assert(os.path.isfile(pwdhashbin))
- h = subprocess.check_output([pwdhashbin, '-s', scheme, pw]).strip()
+ if scheme is None:
+ h = subprocess.check_output([pwdhashbin, pw]).strip()
+ else:
+ h = subprocess.check_output([pwdhashbin, '-s', scheme, pw]).strip()
return h.decode('utf-8')
def password_generate(length=64):
- pw = None
- if MAJOR >= 3:
- pw = [random.choice(string.ascii_letters) for x in range(length - 1)]
- else:
- pw = [random.choice(string.letters) for x in xrange(length - 1)]
+ pw = [random.choice(string.ascii_letters) for x in range(length - 1)]
pw.append('%s' % random.randint(0, 9))
return "".join(pw)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.