summaryrefslogtreecommitdiffstats
path: root/users.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-04-13 14:36:57 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-04-13 15:40:37 -1000
commita3c26e2a14577f6fe77c7085a46ab68cdf3ccb28 (patch)
tree2cc6f1e21555ef3cc1f5fcd6cf5916514243afa1 /users.py
parentfb36d999f378c7685516d82a19a33c383e649599 (diff)
downloadanaconda-a3c26e2a14577f6fe77c7085a46ab68cdf3ccb28.tar.gz
anaconda-a3c26e2a14577f6fe77c7085a46ab68cdf3ccb28.tar.xz
anaconda-a3c26e2a14577f6fe77c7085a46ab68cdf3ccb28.zip
Default to SHA512 password encoding algorithm.
If algo is None by the time we get to cryptPassword(), force the use of SHA512 for password encoding.
Diffstat (limited to 'users.py')
-rw-r--r--users.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/users.py b/users.py
index 4d2e1a5dd..a146aa214 100644
--- a/users.py
+++ b/users.py
@@ -63,13 +63,17 @@ directory = %(instPath)s/etc
# $5$ SHA256
# $6$ SHA512
def cryptPassword(password, algo=None):
- salts = {'md5': '$1$', 'sha256': '$5$', 'sha512': '$6$', None: ''}
- saltstr = salts[algo]
+ salts = {'md5': '$1$', 'sha256': '$5$', 'sha512': '$6$'}
saltlen = 2
+ if algo is None:
+ algo = 'sha512'
+
if algo == 'md5' or algo == 'sha256' or algo == 'sha512':
saltlen = 16
+ saltstr = salts[algo]
+
for i in range(saltlen):
saltstr = saltstr + random.choice (string.letters +
string.digits + './')