Don't quote variable values in ERROR/WARNING/INFO directives

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2017-01-23 09:00:18 -08:00
parent 889ca756a1
commit 33b4ee4d31
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10

View File

@ -2712,11 +2712,11 @@ sub directive_info( $$$$ ) {
# Add quotes to the passed value if the passed 'first part' has an odd number of quotes
# Return an expression that concatenates $first, $val and $rest
#
sub join_parts( $$$ ) {
my ( $first, $val, $rest ) = @_;
sub join_parts( $$$$ ) {
my ( $first, $val, $rest, $just_expand ) = @_;
$val = '' unless defined $val;
$val = "'$val'" unless ( $val =~ /^-?\d+$/ || # Value is numeric
$val = "'$val'" unless $just_expand || ( $val =~ /^-?\d+$/ || # Value is numeric
( ( ( $first =~ tr/"/"/ ) & 1 ) || # There are an odd number of double quotes preceding the value
( ( $first =~ tr/'/'/ ) & 1 ) ) ); # There are an odd number of single quotes preceding the value
join( '', $first, $val, $rest );
@ -2771,7 +2771,7 @@ sub evaluate_expression( $$$$ ) {
exists $capdesc{$var} ? have_capability( $var ) : '' );
}
$expression = join_parts( $first, $val, $rest );
$expression = join_parts( $first, $val, $rest, $just_expand );
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
}
@ -2782,7 +2782,7 @@ sub evaluate_expression( $$$$ ) {
$var = numeric_value( $var ) if $var =~ /^\d/;
$val = $var ? $actparams{$var} : $chain;
$usedcaller = USEDCALLER if $var eq 'caller';
$expression = join_parts( $first, $val, $rest );
$expression = join_parts( $first, $val, $rest , $just_expand );
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
}
}