diff --git a/Shorewall-perl/Shorewall/Config.pm b/Shorewall-perl/Shorewall/Config.pm index 01f681159..3b655dccf 100644 --- a/Shorewall-perl/Shorewall/Config.pm +++ b/Shorewall-perl/Shorewall/Config.pm @@ -53,6 +53,7 @@ our @EXPORT = qw( propagateconfig append_file run_user_exit + run_user_exit1 generate_aux_config %config @@ -1179,6 +1180,28 @@ sub run_user_exit( $ ) { } } +sub run_user_exit1( $ ) { + my $file = find_file $_[0]; + + if ( -f $file ) { + progress_message "Processing $file..."; + # + # File may be empty -- in which case eval would fail + # + push_open $file; + + if ( read_a_line ) { + close_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"; + } + } + } +} + # # Generate the aux config file for Shorewall Lite # diff --git a/Shorewall-perl/Shorewall/Rules.pm b/Shorewall-perl/Shorewall/Rules.pm index 6a2ed7884..5f152b55f 100644 --- a/Shorewall-perl/Shorewall/Rules.pm +++ b/Shorewall-perl/Shorewall/Rules.pm @@ -513,7 +513,7 @@ sub add_common_rules() { new_standard_chain output_chain( $interface ); } - run_user_exit 'initdone'; + run_user_exit1 'initdone'; setup_blacklist; @@ -777,7 +777,7 @@ sub setup_mac_lists( $ ) { 'done' ); } - run_user_exit 'maclog'; + run_user_exit1 'maclog'; log_rule_limit $level, $chainref , $chain , $disposition, '', '', 'add', '' if $level ne ''; add_rule $chainref, "-j $target";