summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/App/BorgRestore.pm8
-rw-r--r--lib/App/BorgRestore/Borg.pm4
-rw-r--r--lib/App/BorgRestore/DB.pm14
-rw-r--r--lib/App/BorgRestore/Settings.pm6
4 files changed, 16 insertions, 16 deletions
diff --git a/lib/App/BorgRestore.pm b/lib/App/BorgRestore.pm
index 2ae0a09..8716bfb 100644
--- a/lib/App/BorgRestore.pm
+++ b/lib/App/BorgRestore.pm
@@ -6,7 +6,7 @@ our $VERSION = "3.3.0";
use App::BorgRestore::Borg;
use App::BorgRestore::DB;
-use App::BorgRestore::Helper;
+use App::BorgRestore::Helper qw(untaint);
use App::BorgRestore::PathTimeTable::DB;
use App::BorgRestore::PathTimeTable::Memory;
use App::BorgRestore::Settings;
@@ -327,8 +327,8 @@ process during method execution since this is required by C<`borg extract`>.
=cut
method restore($path, $archive, $destination) {
- $destination = App::BorgRestore::Helper::untaint($destination, qr(.*));
- $path = App::BorgRestore::Helper::untaint($path, qr(.*));
+ $destination = untaint($destination, qr(.*));
+ $path = untaint($path, qr(.*));
$log->infof("Restoring %s to %s from archive %s", $path, $destination, $archive->{archive});
@@ -342,7 +342,7 @@ method restore($path, $archive, $destination) {
my $workdir = pushd($destination, {untaint_pattern => qr{^(.*)$}});
my $final_destination = abs_path($basename);
- $final_destination = App::BorgRestore::Helper::untaint($final_destination, qr(.*));
+ $final_destination = untaint($final_destination, qr(.*));
$log->debugf("Removing %s", $final_destination);
File::Path::remove_tree($final_destination);
$self->{deps}->{borg}->restore($components_to_strip, $archive->{archive}, $path);
diff --git a/lib/App/BorgRestore/Borg.pm b/lib/App/BorgRestore/Borg.pm
index 24c0608..04ad89c 100644
--- a/lib/App/BorgRestore/Borg.pm
+++ b/lib/App/BorgRestore/Borg.pm
@@ -2,7 +2,7 @@ package App::BorgRestore::Borg;
use v5.14;
use strictures 2;
-use App::BorgRestore::Helper;
+use App::BorgRestore::Helper qw(untaint);
use autodie;
use Date::Parse;
@@ -116,7 +116,7 @@ method borg_list_time() {
method restore($components_to_strip, $archive_name, $path) {
$log->debugf("Restoring '%s' from archive %s, stripping %d components of the path", $path, $archive_name, $components_to_strip);
- $archive_name = App::BorgRestore::Helper::untaint($archive_name, qr(.*));
+ $archive_name = untaint($archive_name, qr(.*));
system(qw(borg extract -v --strip-components), $components_to_strip, $self->{borg_repo}."::".$archive_name, $path);
}
diff --git a/lib/App/BorgRestore/DB.pm b/lib/App/BorgRestore/DB.pm
index cb51ce1..50f5854 100644
--- a/lib/App/BorgRestore/DB.pm
+++ b/lib/App/BorgRestore/DB.pm
@@ -2,7 +2,7 @@ package App::BorgRestore::DB;
use v5.14;
use strictures 2;
-use App::BorgRestore::Helper;
+use App::BorgRestore::Helper qw(untaint);
use autodie;
use DBI;
@@ -76,7 +76,7 @@ method _migrate() {
# We trust all values here since they have already been
# sucessfully put into the DB previously. Thus they must be
# safe to deal with.
- $archive = App::BorgRestore::Helper::untaint($archive, qr(.*));
+ $archive = untaint($archive, qr(.*));
my $archive_id = $self->get_archive_id($archive);
$self->{dbh}->do("alter table `files` rename column `timestamp-$archive` to `$archive_id`");
}
@@ -126,7 +126,7 @@ method get_archive_row_count() {
method add_archive_name($archive) {
my $st = $self->{dbh}->prepare('insert into `archives` (`archive_name`) values (?);');
- $st->execute(App::BorgRestore::Helper::untaint($archive, qr(.*)));
+ $st->execute(untaint($archive, qr(.*)));
$self->_add_column_to_table("files", $archive);
}
@@ -168,20 +168,20 @@ method remove_archive($archive) {
}
my $st = $self->{dbh}->prepare('delete from `archives` where `archive_name` = ?;');
- $st->execute(App::BorgRestore::Helper::untaint($archive, qr(.*)));
+ $st->execute(untaint($archive, qr(.*)));
}
method get_archive_id($archive) {
my $st = $self->{dbh}->prepare("select `id` from `archives` where `archive_name` = ?;");
- $archive = App::BorgRestore::Helper::untaint($archive, qr(.*));
+ $archive = untaint($archive, qr(.*));
$st->execute($archive);
my $result = $st->fetchrow_hashref;
- return App::BorgRestore::Helper::untaint($result->{id}, qr(.*));
+ return untaint($result->{id}, qr(.*));
}
method get_archives_for_path($path) {
my $st = $self->{dbh}->prepare('select * from `files` where `path` = ?;');
- $st->execute(App::BorgRestore::Helper::untaint($path, qr(.*)));
+ $st->execute(untaint($path, qr(.*)));
my @ret;
diff --git a/lib/App/BorgRestore/Settings.pm b/lib/App/BorgRestore/Settings.pm
index bc4fbd0..a1d6bfd 100644
--- a/lib/App/BorgRestore/Settings.pm
+++ b/lib/App/BorgRestore/Settings.pm
@@ -2,7 +2,7 @@ package App::BorgRestore::Settings;
use v5.14;
use strictures 2;
-use App::BorgRestore::Helper;
+use App::BorgRestore::Helper qw(untaint);
use autodie;
use Function::Parameters;
@@ -158,7 +158,7 @@ method new_no_defaults($class: $deps = {}) {
."the path in the config file or ensure that the variables are set.";
}
- $cache_path_base = App::BorgRestore::Helper::untaint($cache_path_base, qr/.*/);
+ $cache_path_base = untaint($cache_path_base, qr/.*/);
return $self;
}
@@ -188,7 +188,7 @@ fun load_config_files() {
push @configfiles, "/etc/borg-restore.cfg";
for my $configfile (@configfiles) {
- $configfile = App::BorgRestore::Helper::untaint($configfile, qr/.*/);
+ $configfile = untaint($configfile, qr/.*/);
if (-e $configfile) {
unless (my $return = do $configfile) {
die "couldn't parse $configfile: $@" if $@;