commit 361a1947003b05b03023f485e85ef6594e394203
parent 8ad87f22332800abb7c8c8e65a27b46423c01214
Author: Jaromil <jaromil@dyne.org>
Date: Wed, 29 May 2013 21:05:30 +0000
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)
Diffstat:
M | tomb | | | 15 | +++++++++------ |
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tomb b/tomb
@@ -600,12 +600,16 @@ get_lukskey() {
;;
esac
fi
+ res=`safe_filename tomb.open`
+ (( $? )) && { unset tombpass; die "error creating temp dir" }
+
print ${tombpass} | \
gpg --batch --passphrase-fd 0 --no-tty --no-options --status-fd 2 \
- -d "${keyfile}" 2> /dev/null
- ret=$?
- xxx "gpg decryption returns $ret"
+ -d "${keyfile}" 2>$res
unset tombpass
+ grep 'DECRYPTION_OKAY' $res
+ ret=$?; rm -f $res
+ xxx "get_lukskey returns $ret"
return $ret
}
@@ -983,10 +987,9 @@ lock_tomb_with_key() {
tombname=${tombfile%%\.*}
tombfile=${tombname}.tomb
- if ! [ -e ${tombdir}/${tombfile} ]; then
+ { test -f ${tombdir}/${tombfile} } || {
die "There is no tomb here. You have to it dig first."
- return 1
- fi
+ return 1 }
xxx "tomb found: ${tombdir}/${tombfile}"