mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-23 06:38:53 +01:00
Expand variables in .conf except when upgrading
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
76aef6cb04
commit
b13014c9ab
@ -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 /^'.*'$/;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user