Expand variables in .conf except when upgrading

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2017-03-11 11:21:07 -08:00
parent 76aef6cb04
commit b13014c9ab
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10

View File

@ -5445,9 +5445,11 @@ sub process_shorewall_conf( $$ ) {
# Don't expand shell variables or allow embedded scripting
#
while ( read_a_line( STRIP_COMMENTS | SUPPRESS_WHITESPACE | CHECK_GUNK ) ) {
if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*?)\s*$/ ) {
if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*)$/ ) {
my ($var, $val) = ($1, $2);
expand_variables( $val ) unless $update || $val =~ /^'.*'$/;
if ( exists $config{$var} ) {
if ( $eliminated{$var} && ! $update ) {
fatal_error "The $var configuration option has been superceded - please run '$product update'";
@ -5464,6 +5466,7 @@ sub process_shorewall_conf( $$ ) {
next;
}
$config{$var} = ( $val =~ /\"([^\"]*)\"$/ ? $1 : $val );
warning_message "Option $var=$val is deprecated"
@ -5484,7 +5487,8 @@ sub process_shorewall_conf( $$ ) {
#
# Now update the config file if asked
#
update_config_file( $annotate ) if $update;
if ( $update ) {
update_config_file( $annotate );
#
# Config file update requires that the option values not have
# Shell variables expanded. We do that now.
@ -5501,7 +5505,8 @@ sub process_shorewall_conf( $$ ) {
for ( values %config ) {
if ( supplied $_ ) {
expand_variables( $_ ) unless /^'(.+)'$/;
expand_variables( $_ ) unless /^'.*'$/;
}
}
}
}