Use -r option to shortcut interactive tomb password popup

This commit is contained in:
Alexandre Pujol 2017-01-30 21:01:27 +00:00
parent 9ee0a1550e
commit 6c0d89cab1

13
tomb Normal file → Executable file
View File

@ -889,7 +889,12 @@ _load_key() {
[[ -z $keyfile ]] && { [[ -z $keyfile ]] && {
_failure "This operation requires a key file to be specified using the -k option." } _failure "This operation requires a key file to be specified using the -k option." }
if [[ $keyfile == "-" ]]; then if option_is_set -r; then
_verbose "load_key delegating password handling to GnuPG"
_message "Waiting for GnuPG to handle password authentication... "
TOMBKEYFILE=$keyfile
TOMBKEY="${mapfile[$TOMBKEYFILE]}"
elif [[ $keyfile == "-" ]]; then
_verbose "load_key reading from stdin." _verbose "load_key reading from stdin."
_message "Waiting for the key to be piped from stdin... " _message "Waiting for the key to be piped from stdin... "
TOMBKEYFILE=stdin TOMBKEYFILE=stdin
@ -1024,6 +1029,12 @@ ask_key_password() {
_verbose "no password needed, using secret bytes from stdin" _verbose "no password needed, using secret bytes from stdin"
return 0 } return 0 }
if option_is_set -r; then
_verbose "no password needed, using GPG key"
get_lukskey
return $?
fi
_message "A password is required to use key ::1 key::" $TOMBKEYFILE _message "A password is required to use key ::1 key::" $TOMBKEYFILE
passok=0 passok=0
tombpass="" tombpass=""