From 7b9021d5c868f54dc9deb8bcabaa98ed4a00bafb Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Mon, 25 May 2015 16:28:50 +0200 Subject: [PATCH] btrbk: allow "host:path" notation for command line arguments --- btrbk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/btrbk b/btrbk index 9c0395d..d3da66f 100755 --- a/btrbk +++ b/btrbk @@ -1399,12 +1399,17 @@ MAIN: # input validation foreach (@subvol_args) { s/\/+$//; # remove trailing slash - unless(/^(($ssh_prefix_match)?\/$file_match)$/) { # matches ssh statement or absolute file + if(/^(($ssh_prefix_match)?\/$file_match)$/) { # matches ssh statement or absolute file + $_ = $1; # untaint argument + } + elsif(/^(?$ip_addr_match|$host_name_match):\/(?$file_match)$/) { # convert "my.host.com:/my/path" to ssh url + $_ = "ssh://$+{host}/$+{file}"; + } + else { ERROR "Bad argument: not a subvolume declaration: $_"; HELP_MESSAGE(0); exit 1; } - $_ = $1; # untaint argument }