From 9fdaa4bb4989cc5d402e7cda92931203969ce289 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Fri, 23 Apr 2010 16:02:59 -0700 Subject: support all valid multi-type types --- lib/Vyatta/TypeChecker.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Vyatta/TypeChecker.pm b/lib/Vyatta/TypeChecker.pm index c13ef4b..d6c470d 100755 --- a/lib/Vyatta/TypeChecker.pm +++ b/lib/Vyatta/TypeChecker.pm @@ -69,7 +69,9 @@ my %type_handler = ( 'hex32' => \&validate_hex_32_bits, 'ipv6_addr_param' => \&validate_ipv6_addr_param, 'restrictive_filename' => \&validate_restrictive_filename, - 'no_bash_special' => \&validate_no_bash_special + 'no_bash_special' => \&validate_no_bash_special, + 'u32' => \&validate_u32, + 'bool' => \&validate_bool ); sub validate_ipv4 { @@ -79,6 +81,16 @@ sub validate_ipv4 { return 1; } +sub validate_u32 { + my $val = shift; + return ($val =~ /^\d+$/ and $val < 2**32); +} + +sub validate_bool { + my $val = shift; + return ($val eq 'true' or $val eq 'false'); +} + sub validate_ipv4net { $_ = shift; return 0 if (!/^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/); -- cgit v1.2.3