Expand shell variables in macro files; correct export of temp dir name

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5480 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-03-10 04:41:29 +00:00
parent e05de0dd42
commit 46a97b0a0a
2 changed files with 14 additions and 5 deletions

View File

@ -3435,6 +3435,12 @@ sub finish_section ( $ ) {
sub process_rule1 ( $$$$$$$$$ ); sub process_rule1 ( $$$$$$$$$ );
sub expand_shell_variables( $ ) {
my $line = $_[0];
$line = $1 . $ENV{$2} . $3 while $line =~ /^(.*?)\$([a-zA-Z]\w*\b)(.*)$/;
$line;
}
# #
# Expand a macro rule from the rules file # Expand a macro rule from the rules file
# #
@ -3451,7 +3457,8 @@ sub process_macro ( $$$$$$$$$$$ ) {
next if $line =~ /^\s*$/; next if $line =~ /^\s*$/;
$line =~ s/\s+/ /g; $line =~ s/\s+/ /g;
$line =~ s/#.*$//; $line =~ s/#.*$//;
$line = expand_shell_variables $line unless $macrofile =~ /^($env{SHAREDIR})/;
my ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser ) = split /\s+/, $line; my ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser ) = split /\s+/, $line;
$mtarget = merge_levels $target, $mtarget; $mtarget = merge_levels $target, $mtarget;
@ -4188,7 +4195,7 @@ sub process_action( $$$$$$$$$$ ) {
$action , $action ,
'' ); '' );
} }
# #
# Generate chain for non-builtin action invocation # Generate chain for non-builtin action invocation
# #
@ -4207,7 +4214,8 @@ sub process_action3( $$$$$ ) {
next if $line =~ /^\s*#/; next if $line =~ /^\s*#/;
next if $line =~ /^\s*$/; next if $line =~ /^\s*$/;
$line =~ s/\s+/ /g; $line =~ s/\s+/ /g;
$line =~ s/#.*$//; $line =~ s/#.*$//;
$line = expand_shell_variables $line unless $actionfile =~ /^($env{SHAREDIR})/;
my ($target, $source, $dest, $proto, $ports, $sports, $rate, $user , $extra ) = split /\s+/, $line; my ($target, $source, $dest, $proto, $ports, $sports, $rate, $user , $extra ) = split /\s+/, $line;
@ -4246,7 +4254,8 @@ sub process_action3( $$$$$ ) {
next if $line =~ /^\s*$/; next if $line =~ /^\s*$/;
$line =~ s/\s+/ /g; $line =~ s/\s+/ /g;
$line =~ s/#.*$//; $line =~ s/#.*$//;
$line = expand_shell_variables $line unless $actionfile =~ /^($env{SHAREDIR})/;
my ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser ) = split /\s+/, $line; my ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser ) = split /\s+/, $line;
if ( $mtarget =~ /^PARAM:?/ ) { if ( $mtarget =~ /^PARAM:?/ ) {

View File

@ -2174,7 +2174,7 @@ do_initialize() {
strip_file tos strip_file tos
strip_file_and_lib_load tunnels tunnels strip_file_and_lib_load tunnels tunnels
report_capabilities1 > $TMP_DIR/capabilities report_capabilities1 > $TMP_DIR/capabilities
export $TMP_DIR export TMP_DIR
fi fi
# #
# Clear $FW # Clear $FW