summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoreschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-05-02 23:17:30 +0000
committereschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-05-02 23:17:30 +0000
commit694da8ef6fb4646a52d0272aaacc8df5474680ae (patch)
treeeac1319a8bcaff96740726141457f1a77b49b8be /lib
parentacc1530ee84bab1e0288e64fba8a581002bdae16 (diff)
More error checking for capability names
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4810 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib')
-rw-r--r--lib/sbin/ConfigurationParser.pl21
1 files changed, 20 insertions, 1 deletions
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;
}