From 694da8ef6fb4646a52d0272aaacc8df5474680ae Mon Sep 17 00:00:00 2001 From: eschnett Date: Wed, 2 May 2012 23:17:30 +0000 Subject: More error checking for capability names git-svn-id: http://svn.cactuscode.org/flesh/trunk@4810 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/sbin/ConfigurationParser.pl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sbin/ConfigurationParser.pl b/lib/sbin/ConfigurationParser.pl index 3454cb5d..c9e1dcb7 100644 --- a/lib/sbin/ConfigurationParser.pl +++ b/lib/sbin/ConfigurationParser.pl @@ -169,6 +169,18 @@ sub ParseConfigurationCCL { $lang = $script = ''; ($provides, $script, $lang, $options, $line_number) = &ParseProvidesBlock($line_number, \@data); + if ($provides !~ m{^[A-Za-z0-9_.]+$}) { + &CST_error (0, "Illegal capability name '$provides' line '$line' in + configure.ccl of thorn '$thorn'"); + } + if ($script !~ m{^[A-Za-z0-9_.]*$}) { + &CST_error (0, "Illegal script name '$script' line '$line' in configure +.ccl of thorn '$thorn'"); + } + if ($lang !~ m{^[A-Za-z0-9_.]*$}) { + &CST_error (0, "Illegal script language '$lang' line '$line' in configu +re.ccl of thorn '$thorn'"); + } $cfg->{"\U$thorn\E PROVIDES"} .= "$provides "; if($script) { @@ -205,11 +217,18 @@ sub ParseConfigurationCCL } elsif($line =~ m/^\s*REQUIRES\s*(.*)/i) { - $cfg->{"\U$thorn\E REQUIRES"} .= "$1 "; + my $cap = $1; + if ($cap !~ m{^[A-Za-z0-9_. ]+$}) { + &CST_error (0, "Illegal required capability '$cap' line '$line' in configure.ccl of thorn '$thorn'"); + } + $cfg->{"\U$thorn\E REQUIRES"} .= "$cap "; } elsif($line =~ m/^\s*OPTIONAL\s*/i) { ($optional, $define, $line_number) = &ParseOptionalBlock($filename, $line_number, \@data); + if ($optional !~ m{^[A-Za-z0-9_. ]+$}) { + &CST_error (0, "Illegal optional capability '$optional' line '$line' in configure.ccl of thorn '$thorn'"); + } $cfg->{"\U$thorn\E OPTIONAL"} .= "$optional "; $cfg->{"\U$thorn\E OPTIONAL \U$optional\E DEFINE"} = $define; } -- cgit v1.2.3