diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2009-06-12 14:22:20 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2009-06-12 14:22:20 -0700 |
commit | 4a970ca6e4442741870b72e93ea70cf19d8ad928 (patch) | |
tree | bc969cee0dd31cc5599151d47ea25165916af88e /lib/Vyatta | |
parent | 7fee20a430a05b934b00d025bccb4281792ccb3d (diff) | |
download | vyatta-cfg-4a970ca6e4442741870b72e93ea70cf19d8ad928.tar.gz vyatta-cfg-4a970ca6e4442741870b72e93ea70cf19d8ad928.zip |
add "restrictive_filename" to TypeChecker
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-x | lib/Vyatta/TypeChecker.pm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Vyatta/TypeChecker.pm b/lib/Vyatta/TypeChecker.pm index b249613..e436e0c 100755 --- a/lib/Vyatta/TypeChecker.pm +++ b/lib/Vyatta/TypeChecker.pm @@ -68,6 +68,7 @@ my %type_handler = ( 'hex16' => \&validate_hex_16_bits, 'hex32' => \&validate_hex_32_bits, 'ipv6_addr_param' => \&validate_ipv6_addr_param, + 'restrictive_filename' => \&validate_restrictive_filename ); sub validate_ipv4 { @@ -267,6 +268,12 @@ sub validate_ipv6_addr_param { } } +# validate a restrictive filename +sub validate_restrictive_filename { + my $value = shift; + return (($value =~ /^[-_.a-zA-Z0-9]+$/) ? 1 : 0); +} + sub validateType { my ($type, $value, $quiet) = @_; if (!defined($type) || !defined($value)) { |