summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/TypeChecker.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Vyatta/TypeChecker.pm b/lib/Vyatta/TypeChecker.pm
index e436e0c..27d9e03 100755
--- a/lib/Vyatta/TypeChecker.pm
+++ b/lib/Vyatta/TypeChecker.pm
@@ -68,7 +68,8 @@ 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
+ 'restrictive_filename' => \&validate_restrictive_filename,
+ 'no_bash_special' => \&validate_no_bash_special
);
sub validate_ipv4 {
@@ -274,6 +275,12 @@ sub validate_restrictive_filename {
return (($value =~ /^[-_.a-zA-Z0-9]+$/) ? 1 : 0);
}
+# validate that a string does not contain bash special chars
+sub validate_no_bash_special {
+ my $value = shift;
+ return (($value =~ /[;&"'`!\$><|]/) ? 0 : 1);
+}
+
sub validateType {
my ($type, $value, $quiet) = @_;
if (!defined($type) || !defined($value)) {