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

Bug#656710: Found bug in lastpatch



Hi,

there was actually (alt least one) problem with my previous patch: if
the user typed in an empty first password, the question for the second
password would never be presented again. The attached new patch (against
the unpatched blockdev-keygen) should fix that.

Best regards,
Olaf
-- 
Olaf Mandel   <olaf@mandel.name>   <http://www.olaf.mandel.name/>
PGP key:      1024D/33398848 2002-09-19
Fingerprint:  0E33 BEA6 1A71 9C5E 62BD  FC0E 99A7 D2C6 3339 8848
--- partman-crypto-49/blockdev-keygen.orig	2012-01-20 20:11:31.603528151 +0100
+++ partman-crypto-49/blockdev-keygen	2012-01-21 11:29:40.473528152 +0100
@@ -31,25 +31,30 @@
 }
 
 get_passphrase () {
-	local pass_ok
+	local templ last_RET pass pass_ok
 
 	pass_ok=0
 	while [ $pass_ok -eq 0 ]; do
 		templ="partman-crypto/passphrase"
-		db_set $templ ""
-		db_fset $templ seen false
 		db_subst $templ DEVICE "$description"
 		db_input critical $templ
 
 		templ="partman-crypto/passphrase-again"
-		db_set $templ ""
-		db_fset $templ seen false
 		db_input critical $templ
 
 		db_go || return 1
 
-		db_get partman-crypto/passphrase || RET=''
+		templ="partman-crypto/passphrase"
+		db_get $templ || RET=''
 		pass=$RET
+		db_set $templ ""
+		db_fset $templ seen false
+
+		templ="partman-crypto/passphrase-again"
+		db_get $templ || RET=''
+		last_RET=$RET
+		db_set $templ ""
+		db_fset $templ seen false
 		if [ -z "$pass" ]; then
 			templ="partman-crypto/passphrase-empty"
 			db_fset $templ seen false
@@ -57,8 +62,7 @@
 			continue
 		fi
 
-		db_get partman-crypto/passphrase-again || RET=''
-		if [ "$pass" != "$RET" ]; then
+		if [ "$pass" != "$last_RET" ]; then
 			templ="partman-crypto/passphrase-mismatch"
 			db_fset $templ seen false
 			db_input critical $templ
@@ -67,14 +71,15 @@
 
 		if passphrase_is_weak "$pass"; then
 			templ="partman-crypto/weak_passphrase"
-			db_set $templ false
-			db_fset $templ seen false
 			db_subst $templ MINIMUM $minlen
 			db_input critical $templ || true
 			db_go || true
 			db_get $templ || RET=''
+			last_RET=$RET
+			db_set $templ false
+			db_fset $templ seen false
 
-			if [ "$RET" != true ]; then
+			if [ "$last_RET" != true ]; then
 				# user doesn't want to force weak passphrase
 				continue
 			fi
@@ -83,9 +88,6 @@
 		pass_ok=1
 	done
 
-	db_set partman-crypto/passphrase ""
-	db_set partman-crypto/passphrase-again ""
-
 	if [ $pass_ok -eq 1 ]; then
 		echo "$pass"
 	fi

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: