fixed bug with adding ../ to categories.
This commit is contained in:
parent
f3832497b5
commit
882ee31585
9
pash
9
pash
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user