fix to key password verification

last minute bug slipped in: it doesn't recognizes correct passwords
in some strange situations where gnupg doesn't returns correctly
(for instance when a .gnupg dir is not found in home)
This commit is contained in:
Jaromil 2013-05-29 21:05:30 +00:00
parent 8ad87f2233
commit 361a194700

15
tomb
View File

@ -600,12 +600,16 @@ get_lukskey() {
;; ;;
esac esac
fi fi
res=`safe_filename tomb.open`
(( $? )) && { unset tombpass; die "error creating temp dir" }
print ${tombpass} | \ print ${tombpass} | \
gpg --batch --passphrase-fd 0 --no-tty --no-options --status-fd 2 \ gpg --batch --passphrase-fd 0 --no-tty --no-options --status-fd 2 \
-d "${keyfile}" 2> /dev/null -d "${keyfile}" 2>$res
ret=$?
xxx "gpg decryption returns $ret"
unset tombpass unset tombpass
grep 'DECRYPTION_OKAY' $res
ret=$?; rm -f $res
xxx "get_lukskey returns $ret"
return $ret return $ret
} }
@ -983,10 +987,9 @@ lock_tomb_with_key() {
tombname=${tombfile%%\.*} tombname=${tombfile%%\.*}
tombfile=${tombname}.tomb tombfile=${tombname}.tomb
if ! [ -e ${tombdir}/${tombfile} ]; then { test -f ${tombdir}/${tombfile} } || {
die "There is no tomb here. You have to it dig first." die "There is no tomb here. You have to it dig first."
return 1 return 1 }
fi
xxx "tomb found: ${tombdir}/${tombfile}" xxx "tomb found: ${tombdir}/${tombfile}"