diff options
-rw-r--r-- | debian/control | 4 | ||||
-rwxr-xr-x | etc/bash_completion.d/20vyatta-cfg | 2 | ||||
-rwxr-xr-x | scripts/VyattaTypeChecker.pm | 27 |
3 files changed, 31 insertions, 2 deletions
diff --git a/debian/control b/debian/control index 8714661..66c0ab8 100644 --- a/debian/control +++ b/debian/control @@ -7,13 +7,13 @@ Standards-Version: 3.7.2 Package: vyatta-cfg Architecture: any -Depends: bash (>= 3.1), - sed (>= 4.1.5), +Depends: sed (>= 4.1.5), perl (>= 5.8.8), procps (>= 1:3.2.7-3), vyatta-quagga | quagga, coreutils (>= 5.97-5.3), vyatta-op, + vyatta-bash, vyatta-config-migrate, dhcp3-client | vyatta-dhcp3-client, bsdutils (>=1:2.13), diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg index 7968cec..f979939 100755 --- a/etc/bash_completion.d/20vyatta-cfg +++ b/etc/bash_completion.d/20vyatta-cfg @@ -441,6 +441,8 @@ vyatta_parse_tmpl () if (( ${#vyatta_cfg_allowed[@]} == 0 )); then astr=$(eval "$acmd") + astr=${astr//</\\<} + astr=${astr//>/\\>} eval "ares=( $astr )" for (( i=0 ; i<${#ares[@]} ; i++ )); do if [[ "${ares[i]}" != \<*\> ]]; then diff --git a/scripts/VyattaTypeChecker.pm b/scripts/VyattaTypeChecker.pm index 2a7d0c9..f77664f 100755 --- a/scripts/VyattaTypeChecker.pm +++ b/scripts/VyattaTypeChecker.pm @@ -52,8 +52,11 @@ use strict; my %type_handler = ( 'ipv4' => \&validate_ipv4, 'ipv4net' => \&validate_ipv4net, + 'ipv4range' => \&validate_ipv4range, 'ipv4_negate' => \&validate_ipv4_negate, 'ipv4net_negate' => \&validate_ipv4net_negate, + 'ipv4range_negate' => \&validate_ipv4range_negate, + 'iptables4_addr' => \&validate_iptables4_addr, 'protocol' => \&validate_protocol, 'protocol_negate' => \&validate_protocol_negate, 'macaddr' => \&validate_macaddr, @@ -75,6 +78,14 @@ sub validate_ipv4net { return 1; } +sub validate_ipv4range { + $_ = shift; + return 0 if (!/^([^-]+)-([^-]+)$/); + my ($a1, $a2) = ($1, $2); + return 0 if (!validate_ipv4($a1) || !validate_ipv4($a2)); + return 1; +} + sub validate_ipv4_negate { my $value = shift; if ($value =~ m/^\!(.*)$/) { @@ -91,6 +102,22 @@ sub validate_ipv4net_negate { return validate_ipv4net($value); } +sub validate_ipv4range_negate { + my $value = shift; + if ($value =~ m/^\!(.*)$/) { + $value = $1; + } + return validate_ipv4range($value); +} + +sub validate_iptables4_addr { + my $value = shift; + return 0 if (!validate_ipv4_negate($value) + && !validate_ipv4net_negate($value) + && !validate_ipv4range_negate($value)); + return 1; +} + sub validate_protocol { my $value = shift; $value = lc $value; |