Allow arbitrary $n variables when IGNOREUNKNOWNVARIABLES=Yes

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-02-10 07:51:35 -08:00
parent cadf2747fe
commit f9dc89dc61

View File

@ -2932,13 +2932,14 @@ sub expand_variables( \$ ) {
if ( $var =~ /^\d+$/ ) { if ( $var =~ /^\d+$/ ) {
fatal_error "Action parameters (\$$var) may only be referenced within the body of an action" unless $chain; fatal_error "Action parameters (\$$var) may only be referenced within the body of an action" unless $chain;
unless ( $config{IGNOREUNKNOWNVARIABLES} ) { if ( $config{IGNOREUNKNOWNVARIABLES} ) {
fatal_error "Invalid action parameter (\$$var)" if ( length( $var ) > 1 && $var =~ /^0/ );
} else {
fatal_error "Undefined parameter (\$$var)" unless ( defined $actparms{$var} && fatal_error "Undefined parameter (\$$var)" unless ( defined $actparms{$var} &&
( length( $var ) == 1 || ( length( $var ) == 1 ||
$var !~ /^0/ ) ); $var !~ /^0/ ) );
} }
fatal_error "Invalid action parameter (\$$var)" if ( ! defined $actparms{$var} ) || ( length( $var ) > 1 && $var =~ /^0/ );
$val = $var ? $actparms{$var} : $actparms{0}->{name}; $val = $var ? $actparms{$var} : $actparms{0}->{name};
} elsif ( exists $variables{$var} ) { } elsif ( exists $variables{$var} ) {
$val = $variables{$var}; $val = $variables{$var};