Corrections to in-line actions.

- Avoid reference to uninitialized variable.
- Remove another vestage of multi-parameter macros.
- Correct a typo.
- Correct handling of SOURCE and DEST in an in-line action body.
- Correct a comment.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-11-27 12:56:14 -08:00
parent e2297f2582
commit e44acdc6af

View File

@ -592,7 +592,7 @@ sub policy_rules( $$$$$ ) {
( $inline, my $param ) = get_target_param( $inline ); ( $inline, my $param ) = get_target_param( $inline );
if ( $targets{$inline} == INLINE ) { if ( ( $targets{$inline} || 0 ) == INLINE ) {
# #
# Default action is an inline # Default action is an inline
# #
@ -1681,8 +1681,7 @@ sub process_macro ($$$$$$$$$$$$$$$$$$$) {
} }
if ( $mtarget =~ /^DEFAULTS?$/ ) { if ( $mtarget =~ /^DEFAULTS?$/ ) {
default_action_params( $macro, split_list( $msource, 'defaults' ) ); $param = $msource unless supplied $param;
( $param ) = get_action_params( 1 ) unless supplied $param;
next; next;
} }
@ -1761,7 +1760,7 @@ sub process_macro ($$$$$$$$$$$$$$$$$$$) {
} }
# #
# Expand a macro rule from the rules file # Expand an inline action rule from the rules file
# #
sub process_inline ($$$$$$$$$$$$$$$$$$$) { sub process_inline ($$$$$$$$$$$$$$$$$$$) {
my ($inline, $chainref, $target, $param, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper, $wildcard ) = @_; my ($inline, $chainref, $target, $param, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper, $wildcard ) = @_;
@ -2137,7 +2136,7 @@ sub process_rule1 ( $$$$$$$$$$$$$$$$$$ ) {
$source = $2; $source = $2;
} else { } else {
$sourcezone = $source; $sourcezone = $source;
$source = ALLIP; $source = $actiontype == INLINE ? '-' : ALLIP;
} }
if ( $dest =~ /^(.*?):(.*)/ ) { if ( $dest =~ /^(.*?):(.*)/ ) {
@ -2151,7 +2150,7 @@ sub process_rule1 ( $$$$$$$$$$$$$$$$$$ ) {
$destzone = '-'; $destzone = '-';
} else { } else {
$destzone = $dest; $destzone = $dest;
$dest = ALLIP; $dest = $actiontype == INLINE ? '-' : ALLIP;
} }
fatal_error "Missing source zone" if $sourcezone eq '-' || $sourcezone =~ /^:/; fatal_error "Missing source zone" if $sourcezone eq '-' || $sourcezone =~ /^:/;