summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2014-08-01 22:14:29 +0200
committerDaniil Baturin <daniil@baturin.org>2014-08-01 22:14:29 +0200
commit84aaf425e93b1ff66a4c53df4426972cf26e1df1 (patch)
tree8f26cb7b0d416bd63bc5e269805e29e639d34e89
parent10db29a3d553948a938470932688fd883bf35dd9 (diff)
downloadvyatta-cfg-firewall-84aaf425e93b1ff66a4c53df4426972cf26e1df1.tar.gz
vyatta-cfg-firewall-84aaf425e93b1ff66a4c53df4426972cf26e1df1.zip
Bug #45: add port range validation script.
-rw-r--r--Makefile.am1
-rwxr-xr-xscripts/firewall/valid_port_range.pl5
2 files changed, 6 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 212b15a..dc0f6a9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,6 +14,7 @@ sbin_SCRIPTS += scripts/firewall/vyatta-firewall-trap.pl
sbin_SCRIPTS += scripts/firewall/firewall.init
sbin_SCRIPTS += scripts/firewall/vyatta-ipset.pl
sbin_SCRIPTS += scripts/firewall/vyatta-fw-global-state-policy.pl
+sbin_SCRIPTS += scripts/firewall/valid_port_range.pl
share_perl5_DATA = lib/Vyatta/IpTables/Rule.pm
share_perl5_DATA += lib/Vyatta/IpTables/AddressFilter.pm
diff --git a/scripts/firewall/valid_port_range.pl b/scripts/firewall/valid_port_range.pl
new file mode 100755
index 0000000..1f3b3fc
--- /dev/null
+++ b/scripts/firewall/valid_port_range.pl
@@ -0,0 +1,5 @@
+#!/usr/bin/env perl
+
+$arg = $ARGV[0];
+
+exit(1) unless $arg =~ /^!?((\d+|\d+-\d+|[a-zA-Z0-9\-]+),)*((\d+|\d+-\d+|[a-zA-Z0-9\-]+))$/;