mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-23 14:08:45 +01:00
Don't quote variable values in ERROR/WARNING/INFO directives
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
889ca756a1
commit
33b4ee4d31
@ -2712,13 +2712,13 @@ sub directive_info( $$$$ ) {
|
|||||||
# Add quotes to the passed value if the passed 'first part' has an odd number of quotes
|
# 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
|
# Return an expression that concatenates $first, $val and $rest
|
||||||
#
|
#
|
||||||
sub join_parts( $$$ ) {
|
sub join_parts( $$$$ ) {
|
||||||
my ( $first, $val, $rest ) = @_;
|
my ( $first, $val, $rest, $just_expand ) = @_;
|
||||||
|
|
||||||
$val = '' unless defined $val;
|
$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 double quotes preceding the value
|
||||||
( ( $first =~ tr/'/'/ ) & 1 ) ) ); # There are an odd number of single quotes preceding the value
|
( ( $first =~ tr/'/'/ ) & 1 ) ) ); # There are an odd number of single quotes preceding the value
|
||||||
join( '', $first, $val, $rest );
|
join( '', $first, $val, $rest );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2771,7 +2771,7 @@ sub evaluate_expression( $$$$ ) {
|
|||||||
exists $capdesc{$var} ? have_capability( $var ) : '' );
|
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;
|
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2782,7 +2782,7 @@ sub evaluate_expression( $$$$ ) {
|
|||||||
$var = numeric_value( $var ) if $var =~ /^\d/;
|
$var = numeric_value( $var ) if $var =~ /^\d/;
|
||||||
$val = $var ? $actparams{$var} : $chain;
|
$val = $var ? $actparams{$var} : $chain;
|
||||||
$usedcaller = USEDCALLER if $var eq 'caller';
|
$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;
|
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user