[PATCH 2/2] Default to SHA512 password encoding algorithm.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If algo is None by the time we get to cryptPassword(), force the use of
SHA512 for password encoding.
---
 users.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/users.py b/users.py
index 4d2e1a5..a146aa2 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 + './')
-- 
1.6.2.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux