summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorerkin <e.altunbas@vyos.io>2021-04-26 16:37:47 +0300
committererkin <e.altunbas@vyos.io>2021-04-26 16:37:47 +0300
commit33d9f46552c93d4c4ccb244a475e8b41e18cfb50 (patch)
treef8bd79e3a4f24586d67717daf266b66da075e2a7 /scripts
parent7bd3ecc65b120890eeb8137c85cdfcc2a15c712c (diff)
downloadvyatta-cfg-33d9f46552c93d4c4ccb244a475e8b41e18cfb50.tar.gz
vyatta-cfg-33d9f46552c93d4c4ccb244a475e8b41e18cfb50.zip
T3439: Fix false positives in URL scheme check
Diffstat (limited to 'scripts')
-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;
}
}