password-store

Simple password manager using gpg and ordinary unix directories
git clone https://git.zx2c4.com/password-store
Log | Files | Refs | README | LICENSE

commit 8446a40fbca8b092d28952edba163ed7df0be2a2
parent f97cf971d813bda250edaa3757c24ef1dc986309
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Thu, 14 Jun 2018 16:04:58 +0200

show: buffer output before displaying, in case decryption fails

For the line-choosing case, this is actually a big deal since we weren't
passing the error code back to the user either.

Diffstat:
Msrc/password-store.sh | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh @@ -357,15 +357,17 @@ cmd_show() { [[ $err -ne 0 || ( $qrcode -eq 1 && $clip -eq 1 ) ]] && die "Usage: $PROGRAM $COMMAND [--clip[=line-number],-c[line-number]] [--qrcode[=line-number],-q[line-number]] [pass-name]" + local pass local path="$1" local passfile="$PREFIX/$path.gpg" check_sneaky_paths "$path" if [[ -f $passfile ]]; then if [[ $clip -eq 0 && $qrcode -eq 0 ]]; then - $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $? + pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile")" || exit $? + echo "$pass" else [[ $selected_line =~ ^[0-9]+$ ]] || die "Clip location '$selected_line' is not a number." - local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +${selected_line} | head -n 1)" + pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +${selected_line} | head -n 1)" || exit $? [[ -n $pass ]] || die "There is no password to put on the clipboard at line ${selected_line}." if [[ $clip -eq 1 ]]; then clip "$pass" "$path"