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 90373f042e8ce679870c1868cb0957fb825d00d5
parent bffca1ee21a38f1e808fa83e5df2fcf0f808cb9f
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Fri,  5 Feb 2016 01:12:18 +0100

Handle removal of directories and passwords with the same name

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

diff --git a/src/password-store.sh b/src/password-store.sh @@ -490,11 +490,10 @@ cmd_delete() { local path="$1" check_sneaky_paths "$path" - local passfile="$PREFIX/${path%/}" - if [[ ! -d $passfile ]]; then - passfile="$PREFIX/$path.gpg" - [[ ! -f $passfile ]] && die "Error: $path is not in the password store." - fi + local passdir="$PREFIX/${path%/}" + local passfile="$PREFIX/$path.gpg" + [[ -f $passfile && -d $passdir && $path == */ || ! -f $passfile ]] && passfile="$passdir" + [[ ! -e $passfile ]] && die "Error: $path is not in the password store." [[ $force -eq 1 ]] || yesno "Are you sure you would like to delete $path?"