Fix a couple of bugs found testing Bleve's configuration

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5702 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-03-26 20:10:59 +00:00
parent cf150dd591
commit d05e81330e
3 changed files with 16 additions and 14 deletions

View File

@ -33,7 +33,6 @@ use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( merge_levels our @EXPORT = qw( merge_levels
split_action
isolate_basic_target isolate_basic_target
add_requiredby add_requiredby
createlogactionchain createlogactionchain
@ -111,21 +110,12 @@ sub merge_levels ($$) {
$subordinate; $subordinate;
} }
#
# Return ( action, level[:tag] ) from passed full action
#
sub split_action ( $ ) {
my $action = $_[0];
my @a = split /:/ , $action;
fatal_error "Invalid ACTION $action in rule \"$line\"" if ( $action =~ /::/ ) || ( @a > 3 );
( shift @a, join ":", @a );
}
#
# Get Macro Name # Get Macro Name
# #
sub isolate_basic_target( $ ) { sub isolate_basic_target( $ ) {
( split '/' , $_[0] )[0]; my $result = ( split '/' , $_[0] )[0];
( split /:/, $result )[0];
} }
# #

View File

@ -33,6 +33,7 @@ use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( find_macro our @EXPORT = qw( find_macro
expand_shell_variables expand_shell_variables
split_action
substitute_action substitute_action
merge_macro_source_dest merge_macro_source_dest
merge_macro_column merge_macro_column
@ -67,6 +68,17 @@ sub expand_shell_variables( $ ) {
my $line = $_[0]; $line = $1 . ( $ENV{$2} || '' ) . $3 while $line =~ /^(.*?)\$([a-zA-Z]\w*)(.*)$/; $line; my $line = $_[0]; $line = $1 . ( $ENV{$2} || '' ) . $3 while $line =~ /^(.*?)\$([a-zA-Z]\w*)(.*)$/; $line;
} }
#
# Return ( action, level[:tag] ) from passed full action
#
sub split_action ( $ ) {
my $action = $_[0];
my @a = split /:/ , $action;
fatal_error "Invalid ACTION $action in rule \"$line\"" if ( $action =~ /::/ ) || ( @a > 3 );
( shift @a, join ":", @a );
}
#
# This function substitutes the second argument for the first part of the first argument up to the first colon (":") # This function substitutes the second argument for the first part of the first argument up to the first colon (":")
# #
# Example: # Example:

View File

@ -720,7 +720,7 @@ sub process_macro ( $$$$$$$$$$$ ) {
} }
my $action = isolate_basic_target $mtarget; my $action = isolate_basic_target $mtarget;
my $actiontype = $targets{$action}; my $actiontype = $targets{$action} || 0;
if ( $actiontype & ACTION ) { if ( $actiontype & ACTION ) {
unless ( $usedactions{$action} ) { unless ( $usedactions{$action} ) {