Hey,

On 05/11/2010 Kapil Hari Paranjape wrote:
> Package: cryptsetup
> Version: 2:1.1.3-3
> Severity: wishlist
> 
> Hello,
> 
> I have a system with LUKS encrypted swap which is sometimes resumed
> after hibernation.
> 
> Today I got bitten by the default "tries=3" when I mistyped my LUKS
> passphrase three times and the system booted corrupting the
> filesystem! (Nothing too bad though!)
> 
> I then found the "tries=0" possibility in crypttab which would
> prevent this from biting me again.
> 
> Unfortunately, the startup scripts /etc/init.d/cryptdisks* object to
> (issue a warning for) this value of "tries".
> 
> I was wondering why this was so and whether it can be a " -ge "
> instead of " -gt " in /lib/crypsetup/cryptdisks.functions".

Please give the attached patch a try, it should fix the issue.

greetings,
 jonas
--- tags/2:1.1.3-4/debian/cryptdisks.functions	2010-11-04 20:40:21.000000000 +0100
+++ /lib/cryptsetup/cryptdisks.functions	2010-12-16 17:35:29.000000000 +0100
@@ -122,7 +122,7 @@
 			fi
 			;;
 		tries)
-			if echo "$VALUE" | grep -q "^[[:digit:]]\+$" && [ "$VALUE" -gt 0 ]; then
+			if echo "$VALUE" | grep -q "^[[:digit:]]\+$" && [ "$VALUE" -ge 0 ]; then
 				TRIES="$VALUE"
 			else
 				log_warning_msg "$dst: option tries used with an incorrect argument - forced to $TRIES"
@@ -314,7 +314,7 @@
 
 	PARAMS="$PARAMS --key-file=$key"
 
-	while [ "$tried" -lt "$TRIES" ]; do
+	while [ "$tried" -lt "$TRIES" ] || [ "$TRIES" -eq "0" ]; do
 		if [ -n "$KEYSCRIPT" ]; then
 			if $KEYSCRIPT "$keyscriptarg" | cryptsetup $PARAMS luksOpen "$src" "${dst}_unformatted"; then
 				break
@@ -326,7 +326,7 @@
 		fi
 
 		tried=$(( $tried + 1 ))
-		if [ "$tried" -ge "$TRIES" ]; then
+		if [ "$tried" -ge "$TRIES" ] && [ "$TRIES" -ne "0" ]; then
 			return 1
 		fi
 	done

Attachment: signature.asc
Description: Digital signature

Reply via email to