summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2021-04-29 21:29:39 +0700
committerGitHub <noreply@github.com>2021-04-29 21:29:39 +0700
commitfa2b172512aa024a9853166528c9e6601fde94d8 (patch)
treeb3c15b76f93438939245e29d95b5d0f1a492de00
parente7bc6d49ff7be1654769f8f70c6027d067fd8233 (diff)
parent33d9f46552c93d4c4ccb244a475e8b41e18cfb50 (diff)
downloadvyatta-cfg-fa2b172512aa024a9853166528c9e6601fde94d8.tar.gz
vyatta-cfg-fa2b172512aa024a9853166528c9e6601fde94d8.zip
Merge pull request #38 from erkin/current
T3439: Fix false positives in URL scheme check
-rwxr-xr-xscripts/vyatta-save-config.pl10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/vyatta-save-config.pl b/scripts/vyatta-save-config.pl
index 39f1f9e..9c973d9 100755
--- a/scripts/vyatta-save-config.pl
+++ b/scripts/vyatta-save-config.pl
@@ -57,12 +57,16 @@ if ($save_file =~ /^[^\/]\w+:\//) {
if ($save_file =~ /^(\w+):\/\/\w/) {
$mode = 'url';
$proto = lc($1);
- if (grep { lc($proto) ne $_ } ("ftp", "tftp", "scp", "sftp")) {
- print "Invalid url protocol [$proto]\n";
+ if ($proto eq "scp") {}
+ elsif ($proto eq "sftp") {}
+ elsif ($proto eq "ftp") {}
+ elsif ($proto eq "tftp") {}
+ else {
+ print "Invalid URL protocol [$proto]\n";
exit 1;
}
} else {
- print "Invalid url [$save_file]\n";
+ print "Invalid URL [$save_file]\n";
exit 1;
}
}