SHA256
check config file permissions before sourcing
This commit is contained in:
@@ -264,6 +264,12 @@ while (( $# > 0 )); do
|
||||
done
|
||||
|
||||
|
||||
if [ -f "$cfgfile" ]; then
|
||||
perms=$(stat -c '%a' "$cfgfile")
|
||||
(( 8#$perms & 0022 )) && echo "Error: $cfgfile is writable by group or others!" >&2 && exit 202
|
||||
(( 8#$perms & 0007 )) && echo "Warning: $cfgfile is readable by others!" >&2
|
||||
fi
|
||||
|
||||
if $FULL_HELP; then
|
||||
[ -f "$cfgfile" ] && source "$cfgfile"
|
||||
PBC=${PBC:-/usr/local/bin/proxmox-backup-client}
|
||||
@@ -280,6 +286,8 @@ if [ "$action" == 'install' ]; then
|
||||
! command -v "$exe" >/dev/null && echo "Error: $exe executable not found!" >&2 && exit 200
|
||||
done
|
||||
else
|
||||
[ ! -f "$cfgfile" ] && echo "Error: $cfgfile: no such file" >&2 && exit 201
|
||||
[ ! -r "$cfgfile" ] && echo "Error: $cfgfile: not readable" >&2 && exit 201
|
||||
source "$cfgfile" || exit $?
|
||||
PBC=${PBC:-/usr/local/bin/proxmox-backup-client}
|
||||
[ ! -f "$PBC" ] && echo "Error: $PBC: no such file" >&2 && exit 200
|
||||
|
||||
Reference in New Issue
Block a user