Ensure that action extension scripts are always processed

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6213 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-05-03 16:02:24 +00:00
parent c5da826241
commit d1b9a71a3b

View File

@ -173,7 +173,10 @@ sub createlogactionchain( $$ ) {
$logactionchains{"$action:$level"} = $chainref = new_chain 'filter', '%' . $chain . $actionref->{actchain}++;
mark_referenced $chainref; # Just in case the action body is empty.
unless ( $targets{$action} & STANDARD ) {
my $file = find_file $chain;
if ( -f $file ) {
@ -188,20 +191,46 @@ sub createlogactionchain( $$ ) {
}
}
sub createsimpleactionchain( $ ) {
my $action = shift;
my $chainref = new_chain 'filter', $action;
$logactionchains{"$action:none"} = $chainref;
mark_referenced $chainref; # Just in case the action body is empty.
unless ( $targets{$action} & STANDARD ) {
my $file = find_file $action;
if ( -f $file ) {
progress_message "Processing $file...";
unless ( my $return = eval `cat $file` ) {
fatal_error "Couldn't parse $file: $@" if $@;
fatal_error "Couldn't do $file: $!" unless defined $return;
fatal_error "Couldn't run $file" unless $return;
}
}
}
}
#
# Create an action chain and run it's associated user exit
#
sub createactionchain( $ ) {
my ( $action , $level ) = split_action $_[0];
if ( $level ) {
my $chainref;
if ( $level ne '' ) {
if ( $level eq 'none' ) {
$logactionchains{"$action:none"} = new_chain 'filter', $action;
createsimpleactionchain $action;
} else {
createlogactionchain $action , $level;
}
} else {
$logactionchains{"$action:none"} = new_chain 'filter', $action;
createsimpleactionchain $action;
}
}
@ -345,7 +374,7 @@ sub process_actions2 () {
for my $target (keys %usedactions) {
my ($action, $level) = split_action $target;
my $actionref = $actions{$action};
die "Null Action Reference in process_actions2" unless $actionref;
fatal_error "Null Action Reference in process_actions2" unless $actionref;
for my $action1 ( keys %{$actionref->{requires}} ) {
my $action2 = merge_levels $target, $action1;
unless ( $usedactions{ $action2 } ) {
@ -386,8 +415,6 @@ sub process_action3( $$$$$ ) {
my $actionfile = find_file "action.$action";
my $standard = ( $actionfile =~ /^$globals{SHAREDIR}/ );
mark_referenced $chainref; # Just in case the action body is empty.
fatal_error "Missing Action File: $actionfile" unless -f $actionfile;
progress_message2 "Processing $actionfile for chain $chainref->{name}...";