Discussion:
cryptPassword() fix, #495288 fix
David Cantrell
2009-04-14 00:43:00 UTC
Permalink
Two fixes:
1) Make cryptPassword() use SHA512 if we get None for the algo to use.
2) Don't assume formatcb exists (#495288)
--
David Cantrell <***@redhat.com>
Red Hat, Inc. / Honolulu, HI
David Cantrell
2009-04-14 00:43:01 UTC
Permalink
We may not have formatcb in all cases, don't assume it exists.
---
iw/partition_ui_helpers_gui.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index 0b45e5f..c8cbdfd 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -331,7 +331,7 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
formatcb = None
fstypeCombo = None

- if not formatcb.get_active() and not origfs.migrate:
+ if format and not formatcb.get_active() and not origfs.migrate:
mountCombo.set_data("prevmountable", origfs.mountable)

# this gets added to the table a bit later on
--
1.6.2.2
David Cantrell
2009-04-14 00:59:15 UTC
Permalink
Post by David Cantrell
We may not have formatcb in all cases, don't assume it exists.
---
iw/partition_ui_helpers_gui.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index 0b45e5f..c8cbdfd 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -331,7 +331,7 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
formatcb = None
fstypeCombo = None
mountCombo.set_data("prevmountable", origfs.mountable)
# this gets added to the table a bit later on
Umm, 'format' should actually be 'formatcb'.

Typo or fat fingers, one of the two.
--
David Cantrell <***@redhat.com>
Red Hat / Honolulu, HI
David Cantrell
2009-04-14 00:43:02 UTC
Permalink
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
David Lehman
2009-04-14 01:34:21 UTC
Permalink
Post by David Cantrell
1) Make cryptPassword() use SHA512 if we get None for the algo to use.
2) Don't assume formatcb exists (#495288)
They both look good with the typo fix.

Loading...