Hi,
> sorry, forgot to actually attach the patch. here it is.
May I propose a different patch and try that instead?
> greetings,
> jonas
> --- /usr/share/initramfs-tools/scripts/local-top/cryptroot 2008-01-29
> 11:43:07.000000000 +0100
> +++ /usr/share/initramfs-tools/scripts/local-top/cryptroot 2008-02-16
> 18:27:14.000000000 +0100
> @@ -43,6 +43,7 @@
> cryptlvm=""
> cryptkeyscript=""
> cryptkey="" # This is only used as an argument to an eventual keyscript
> + crypttries=3
>
> local IFS=" ,"
> for x in $cryptopts; do
> @@ -78,6 +79,11 @@
> cryptkey=${x#key=}
> fi
> ;;
> + tries=*)
> + if [ "${x#tries=}" -gt 0 ]; then
> + crypttries=${x#tries=}
> + fi
> + ;;
> esac
> done
I aggree with this until now.
> @@ -170,9 +176,9 @@
>
> # Prepare commands
> if /sbin/cryptsetup isLuks $cryptsource > /dev/null 2>&1; then
> - cryptcreate="/sbin/cryptsetup luksOpen $cryptsource
> $crypttarget"
> + cryptcreate="/sbin/cryptsetup -T $crypttries luksOpen
> $cryptsource $crypttarget"
> else
> - cryptcreate="/sbin/cryptsetup -c $cryptcipher -s $cryptsize -h
> $crypthash create $crypttarget $cryptsource"
> + cryptcreate="/sbin/cryptsetup -T $crypttries -c $cryptcipher -s
> $cryptsize -h $crypthash create $crypttarget $cryptsource"
> fi
> cryptremove="/sbin/cryptsetup remove $crypttarget"
> NEWROOT="/dev/mapper/$crypttarget"
The retry management basically happened below in the previous version:
Line 181:
count=0
while [ $count -lt 3]; do
I therefore suggest to reuse that management (or throw it away
completely), because your patch will only allow for multiples of 3 tries
this way.
My patch is attached (really, no second mail :-p). If you like to use
the trial management from cryptsetup, it would be great if you could
clean the cryptroot script and send me a new patch.
Helmut
--- cryptroot 2008-02-16 18:39:57.000000000 +0100
+++ cryptroot_helmut 2008-02-16 18:45:28.000000000 +0100
@@ -43,6 +43,7 @@
cryptlvm=""
cryptkeyscript=""
cryptkey="" # This is only used as an argument to an eventual keyscript
+ crypttries=3
local IFS=" ,"
for x in $cryptopts; do
@@ -78,6 +79,11 @@
cryptkey=${x#key=}
fi
;;
+ tries=*)
+ if [ "${x#tries=}" -gt 0 ]; then
+ crypttries=${x#tries=}
+ fi
+ ;;
esac
done
@@ -179,7 +185,7 @@
# Try to get a satisfactory password three times
count=0
- while [ $count -lt 3 ]; do
+ while [ $crypttries -le 0 -o $count -lt $crypttries ]; do
count=$(( $count + 1 ))
if [ -n "$cryptkeyscript" ]; then