tomb

the crypto undertaker
git clone git://parazyd.org/tomb.git
Log | Files | Refs | README | LICENSE

commit 61362ce34e757beadd43468ef279d8b2e0dddc56
parent 28a52f5851babd78278bb63043884364ee65780a
Author: Jaromil <jaromil@dyne.org>
Date:   Tue, 11 Jun 2013 23:37:20 +0200

forge and create refuse to overwrite existing files

Diffstat:
Mtomb | 18+++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tomb b/tomb @@ -465,7 +465,7 @@ load_key() { tombfile=`basename $tombkey` fi fi - + tombkey=${tombdir}/${tombfile} xxx "load_key: `ls -lh ${tombkey}`" @@ -865,10 +865,13 @@ print "-----END PGP MESSAGE-----" forge_key() { _message "Commanded to forge key $1" - if ! [ $1 ]; then - _warning "no key name specified for creation" - return 1 - fi + { test "$1" = "" } && { + _warning "no key name specified for creation" + return 1 } + + { test -r "$1" } && { + _warning "Forging this key would overwrite an existing file. Operation aborted." + die "`ls -lh $1`" } # if swap is on, we remind the user about possible data leaks to disk if ! option_is_set -f && ! option_is_set --ignore-swap; then check_swap; fi @@ -1117,6 +1120,11 @@ create_tomb() { return 1 fi + + { test -r "$1" } && { + _warning "Creating this tomb would overwrite an existing file. Operation aborted." + die "`ls -lh $1`" } + dig_tomb ${=PARAM} { test $? = 0 } || { die "Failed to dig tomb, operation aborted." }