mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-12-23 02:28:58 +00:00
Fixes to GnuPG 1.4.11/1.4.12 result parsing
GnuPG 1 changes behaviour across 1.4.11 and 12 minor versions when it comes to --status-fd and messaging on stderr/stdout. This is a fix to make sure that gpg output is parsed correctly
This commit is contained in:
parent
7736cc97af
commit
9e820f3de6
18
tomb
18
tomb
@ -610,15 +610,31 @@ get_lukskey() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# fix for gpg 1.4.11 where the --status-* options don't work ;^/
|
||||||
|
gpgver=`gpg --version | awk '/^gpg/ {print $3}'`
|
||||||
|
if [ "$gpgver" = "1.4.11" ]; then
|
||||||
|
xxx "GnuPG is version 1.4.11 - adopting status fix"
|
||||||
|
|
||||||
|
print ${tombpass} | \
|
||||||
|
gpg --batch --passphrase-fd 0 --no-tty --no-options -d "${keyfile}"
|
||||||
|
unset tombpass
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
else # using status-file in gpg != 1.4.12
|
||||||
|
|
||||||
res=`safe_filename tomb.open`
|
res=`safe_filename tomb.open`
|
||||||
(( $? )) && { unset tombpass; die "error creating temp dir" }
|
{ test $? = 0 } || { unset tombpass; die "Fatal error creating temp file." }
|
||||||
|
|
||||||
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 \
|
||||||
|
--no-mdc-warning --no-permission-warning --no-secmem-warning \
|
||||||
-d "${keyfile}" 2>$res
|
-d "${keyfile}" 2>$res
|
||||||
unset tombpass
|
unset tombpass
|
||||||
grep 'DECRYPTION_OKAY' $res
|
grep 'DECRYPTION_OKAY' $res
|
||||||
ret=$?; rm -f $res
|
ret=$?; rm -f $res
|
||||||
|
|
||||||
|
fi
|
||||||
xxx "get_lukskey returns $ret"
|
xxx "get_lukskey returns $ret"
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user