mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-29 08:14:08 +00:00
better checks on file creation, both on dig and forge
This commit is contained in:
parent
dd91e124b4
commit
d8c5cd24d1
12
tomb
12
tomb
@ -1358,6 +1358,10 @@ dig_tomb() {
|
|||||||
|
|
||||||
# Ensure that file permissions are safe even if interrupted
|
# Ensure that file permissions are safe even if interrupted
|
||||||
touch $TOMBPATH
|
touch $TOMBPATH
|
||||||
|
[[ $? = 0 ]] || {
|
||||||
|
_warning "Error creating the tomb ::1 tomb path::" $TOMBPATH
|
||||||
|
_failure "Operation aborted."
|
||||||
|
}
|
||||||
chmod 0600 $TOMBPATH
|
chmod 0600 $TOMBPATH
|
||||||
|
|
||||||
_verbose "Data dump using ::1:: from /dev/urandom" ${DD[1]}
|
_verbose "Data dump using ::1:: from /dev/urandom" ${DD[1]}
|
||||||
@ -1410,6 +1414,12 @@ forge_key() {
|
|||||||
ls -lh $destkey
|
ls -lh $destkey
|
||||||
_failure "Forging this key would overwrite an existing file. Operation aborted." }
|
_failure "Forging this key would overwrite an existing file. Operation aborted." }
|
||||||
|
|
||||||
|
touch $destkey
|
||||||
|
[[ $? == 0 ]] || {
|
||||||
|
_warning "Cannot generate encryption key."
|
||||||
|
_failure "Operation aborted." }
|
||||||
|
chmod 0600 $destkey
|
||||||
|
|
||||||
# Update algorithm if it was passed on the command line with -o
|
# Update algorithm if it was passed on the command line with -o
|
||||||
{ option_is_set -o } && algopt="$(option_value -o)"
|
{ option_is_set -o } && algopt="$(option_value -o)"
|
||||||
[[ -n "$algopt" ]] && algo=$algopt
|
[[ -n "$algopt" ]] && algo=$algopt
|
||||||
@ -1439,8 +1449,6 @@ forge_key() {
|
|||||||
_success "Choose the password of your key: ::1 tomb key::" $TOMBKEYFILE
|
_success "Choose the password of your key: ::1 tomb key::" $TOMBKEYFILE
|
||||||
_message "(You can also change it later using 'tomb passwd'.)"
|
_message "(You can also change it later using 'tomb passwd'.)"
|
||||||
# _user_file $TOMBKEYFILE
|
# _user_file $TOMBKEYFILE
|
||||||
touch $TOMBKEYFILE
|
|
||||||
chmod 0600 $TOMBKEYFILE
|
|
||||||
|
|
||||||
tombname="$TOMBKEYFILE" # XXX ???
|
tombname="$TOMBKEYFILE" # XXX ???
|
||||||
# the gen_key() function takes care of the new key's encryption
|
# the gen_key() function takes care of the new key's encryption
|
||||||
|
Loading…
Reference in New Issue
Block a user