ssh_filter_btrbk.sh: bugfix: ignore --restrict-path for "btrfs subvolume list"

btrbk now runs "btrfs subvolume list" from the mountpoint instead of
the volume path, which for some users is not below --restrict-path. As
the output of "btrfs subvolume list" is the same (complete btrfs tree
for the filesystem), it is ok to ignore the restrict-path here.
pull/208/merge
Axel Burri 2018-10-10 22:43:28 +02:00
parent f7ef5139de
commit 526e332b02
1 changed files with 5 additions and 5 deletions

View File

@ -14,6 +14,10 @@ allow_stream_buffer=1
allow_compress=1
compress_list="gzip|pigz|bzip2|pbzip2|xz|lzop|lz4"
# note that the backslash is NOT a metacharacter in a POSIX bracket expression!
option_match='-[a-zA-Z0-9=-]+' # matches short as well as long options
file_match='[0-9a-zA-Z_@+./-]*' # matches file path (equal to $file_match in btrbk)
log_cmd()
{
if [[ -n "$enable_log" ]]; then
@ -47,10 +51,6 @@ run_cmd()
reject_filtered_cmd()
{
# note that the backslash is NOT a metacharacter in a POSIX bracket expression!
option_match='-[a-zA-Z0-9=-]+' # matches short as well as long options
file_match='[0-9a-zA-Z_@+./-]*' # matches file path (equal to $file_match in btrbk)
if [[ -n "$restrict_path_list" ]]; then
# match any of restrict_path_list with or without trailing slash,
# or any file/directory (matching file_match) below restrict_path
@ -162,7 +162,7 @@ while [[ "$#" -ge 1 ]]; do
done
allow_cmd "${sudo_prefix}btrfs subvolume show"; # subvolume queries are always allowed
allow_cmd "${sudo_prefix}btrfs subvolume list"; # subvolume queries are always allowed
allow_exact_cmd "${sudo_prefix}btrfs subvolume list ${file_match}"; # subvolume queries are always allowed
allow_cmd "readlink" # used to resolve mountpoints
allow_exact_cmd "cat /proc/self/mountinfo" # used to resolve mountpoints
allow_exact_cmd "cat /proc/self/mounts" # legacy, for btrbk < 0.27.0