Fix 'findgw'

This commit is contained in:
Tom Eastep 2009-06-29 08:14:53 -07:00
parent 355a515b1b
commit 9dbafc59d0
4 changed files with 36 additions and 7 deletions

View File

@ -101,7 +101,7 @@ EOF
copy1 $lib, emit "\n" if -f $lib; copy1 $lib, emit "\n" if -f $lib;
for my $exit qw/init isusable start tcclear started stop stopped clear refresh refreshed restored findgw/ { for my $exit qw/init start tcclear started stop stopped clear refresh refreshed restored/ {
emit "\nrun_${exit}_exit() {"; emit "\nrun_${exit}_exit() {";
push_indent; push_indent;
append_file $exit or emit 'true'; append_file $exit or emit 'true';
@ -109,6 +109,14 @@ EOF
emit '}'; emit '}';
} }
for my $exit qw/isusable findgw/ {
emit "\nrun_${exit}_exit() {";
push_indent;
append_file($exit, 1) or emit 'true';
pop_indent;
emit '}';
}
emit <<'EOF'; emit <<'EOF';
################################################################################ ################################################################################
# End user exit functions # End user exit functions

View File

@ -1051,6 +1051,8 @@ sub copy( $ ) {
sub copy1( $ ) { sub copy1( $ ) {
assert( $object_enabled ); assert( $object_enabled );
my $result = 0;
if ( $object ) { if ( $object ) {
my $file = $_[0]; my $file = $_[0];
@ -1076,6 +1078,7 @@ sub copy1( $ ) {
$do_indent = 0; $do_indent = 0;
print $object $_; print $object $_;
print $object "\n"; print $object "\n";
$result = 1;
next; next;
} }
@ -1087,12 +1090,16 @@ sub copy1( $ ) {
print $object $_; print $object $_;
print $object "\n"; print $object "\n";
$do_indent = ! ( $here_documents || /\\$/ ); $do_indent = ! ( $here_documents || /\\$/ );
$result = 1 unless $result || /^\s*$/ || /^\s*#/;
} }
close IF; close IF;
} }
$lastlineblank = 0; $lastlineblank = 0;
$result;
} }
# #
@ -2481,17 +2488,27 @@ sub propagateconfig() {
# #
# Add a shell script file to the output script -- Return true if the # Add a shell script file to the output script -- Return true if the
# file exists and is not in /usr/share/shorewall/. # file exists and is not in /usr/share/shorewall/ and is non-empty.
# #
sub append_file( $ ) { sub append_file( $;$ ) {
my $user_exit = find_file $_[0]; my $user_exit = find_file $_[0];
my $result = 0; my $result = 0;
unless ( $user_exit =~ /^($globals{SHAREDIR})/ ) { unless ( $user_exit =~ /^($globals{SHAREDIR})/ ) {
if ( -f $user_exit ) { if ( -f $user_exit ) {
$result = 1; if ( $_[1] ) {
save_progress_message "Processing $user_exit ..."; #
copy1 $user_exit; # Suppress progress message
#
$result = copy1 $user_exit;
} else {
#
# Include progress message -- Pretend progress_message call was in the file
#
$result = 1;
save_progress_message "Processing $user_exit ...";
copy1 $user_exit;
}
} }
} }

View File

@ -1,4 +1,4 @@
Changes in Shorewall 4.4.0-Beta3 qChanges in Shorewall 4.4.0-Beta3
1) Add new macros. 1) Add new macros.
@ -8,6 +8,8 @@ Changes in Shorewall 4.4.0-Beta3
4) Check for xt_LOG. 4) Check for xt_LOG.
5) Fix 'findgw'
Changes in Shorewall 4.4.0-Beta2 Changes in Shorewall 4.4.0-Beta2
1) The 'find_first_interface_address()' and 1) The 'find_first_interface_address()' and

View File

@ -130,6 +130,8 @@ Shorewall 4.4.0 Beta 3
shows the contents of the dynamic blacklist as in earlier shows the contents of the dynamic blacklist as in earlier
Shorewall releases. Shorewall releases.
3) The 'findgw' script produced an error if VERBOSITY > 0.
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
K N O W N P R O B L E M S R E M A I N I N G K N O W N P R O B L E M S R E M A I N I N G
---------------------------------------------------------------------------- ----------------------------------------------------------------------------