diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-02-26 19:48:16 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-02-26 19:48:16 +0100 |
commit | 4f3d637eb1996cfdd9fff0c35b0a2c9e6a679e13 (patch) | |
tree | 659315a1a5846f4b04ec15dd2f41a7260cf08969 | |
parent | 8de34c192c04ce7325b3c151ef6e87642500c807 (diff) | |
download | bin-4f3d637eb1996cfdd9fff0c35b0a2c9e6a679e13.tar.gz bin-4f3d637eb1996cfdd9fff0c35b0a2c9e6a679e13.tar.xz |
borg-restore.pl: Allow + and : in archive names
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | borg-restore.pl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/borg-restore.pl b/borg-restore.pl index 3c8c0c1..0c52c9b 100755 --- a/borg-restore.pl +++ b/borg-restore.pl @@ -347,7 +347,7 @@ sub restore { $destination = Helper::untaint($destination, qr(.*)); $path = Helper::untaint($path, qr(.*)); - my $archive_name = Helper::untaint($archive->{archive}, qr([a-zA-Z0-9-]+)); + my $archive_name = Helper::untaint_archive_name($archive->{archive}); printf "Restoring %s to %s from archive %s\n", $path, $destination, $archive->{archive}; @@ -726,7 +726,7 @@ sub add_archive_name { my $self = shift; my $archive = shift; - $archive = Helper::untaint($archive, qr([a-zA-Z0-9-]+)); + $archive = Helper::untaint_archive_name($archive); my $st = $self->{dbh}->prepare('insert into `archives` (`archive_name`) values (?);'); $st->execute($archive); @@ -747,7 +747,7 @@ sub remove_archive { my $self = shift; my $archive = shift; - $archive = Helper::untaint($archive, qr([a-zA-Z0-9-]+)); + $archive = Helper::untaint_archive_name($archive); my $archive_id = $self->get_archive_id($archive); @@ -773,7 +773,7 @@ sub remove_archive { sub _prefix_archive_id { my $archive = shift; - $archive = Helper::untaint($archive, qr([a-zA-Z0-9-]+)); + $archive = Helper::untaint_archive_name($archive); return 'timestamp-'.$archive; } @@ -852,3 +852,8 @@ sub untaint { $data =~ m/^($regex)$/ or die "Failed to untaint: $data"; return $1; } + +sub untaint_archive_name { + my $archive = shift; + return Helper::untaint($archive, qr([a-zA-Z0-9-:+]+)); +} |