fixed bug with adding ../ to categories.

This commit is contained in:
Dylan Araps 2019-02-25 22:44:56 +02:00
parent f3832497b5
commit 882ee31585
1 changed files with 6 additions and 3 deletions

9
pash
View File

@ -19,9 +19,6 @@ pw_add() {
[[ $password ]] || [[ $password ]] ||
die "Failed to generate a password." die "Failed to generate a password."
[[ $1 == */* ]] &&
{ mkdir -p "${1%/*}" || die "Couldn't create category '${1%/*}'.";}
"${gpg[0]}" -co "$1.gpg" <<< "$password" "${gpg[0]}" -co "$1.gpg" <<< "$password"
} }
@ -163,6 +160,12 @@ main() {
[[ $1 == [a]* && -f $2.gpg ]] && [[ $1 == [a]* && -f $2.gpg ]] &&
die "Pass file '$2' already exists." die "Pass file '$2' already exists."
[[ $2 == */* && $2 == *../* ]] &&
die "Category went out of bounds."
[[ $2 == */* ]] &&
{ mkdir -p "${1%/*}" || die "Couldn't create category '${1%/*}'.";}
umask 077 umask 077
case $1 in case $1 in