From 0acd93a032947c1795a117576f37f68139160fd0 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 23 Dec 2012 12:19:30 -0800 Subject: [PATCH] Ensure that action and macro files always allow comment directives. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Config.pm | 20 ++++++++++---------- Shorewall/Perl/Shorewall/Rules.pm | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 11e942d89..de0bcf261 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -497,11 +497,11 @@ my $max_format; # Max format value our $comment; # Current COMMENT my @comments; my $comments_allowed; -my $warningcount; -my $warningcount1; -my $warningcount2; +my $warningcount; +my $warningcount1; +my $warningcount2; -my $shorewall_dir; # Shorewall Directory; if non-empty, search here first for files. +my $shorewall_dir; # Shorewall Directory; if non-empty, search here first for files. our $debug; # Global debugging flag my $confess; # If true, use Carp to report errors with stack trace. @@ -514,9 +514,9 @@ our $Product; # $product with initial cap. our $sillyname; # Name of temporary filter chains for testing capabilities our $sillyname1; -my $iptables; # Path to iptables/ip6tables -my $tc; # Path to tc -my $ip; # Path to ip +my $iptables; # Path to iptables/ip6tables +my $tc; # Path to tc +my $ip; # Path to ip my $shell; # Type of shell that processed the params file @@ -2559,14 +2559,14 @@ EOF # The following two functions allow module clients to nest opens. This happens frequently # in the Rules module. # -sub push_open( $;$ ) { - my ( $file, $max ) = @_; +sub push_open( $;$$ ) { + my ( $file, $max , $ca) = @_; push @includestack, [ $currentfile, $currentfilename, $currentlinenumber, $ifstack, $file_format, $max_format ] if $currentfile; my @a = @includestack; push @openstack, \@a; @includestack = (); $currentfile = undef; - open_file( $file , $max, $comments_allowed ); + open_file( $file , $max, $comments_allowed || $ca ); } sub pop_open() { diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index c792d3f6f..5a56c6659 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -1472,7 +1472,7 @@ sub process_actions() { $targets{$_} = new_action( $_ , ACTION + BUILTIN, 1, 0 ) for @builtins; for my $file ( qw/actions.std actions/ ) { - open_file( $file, 2, 1 ); + open_file( $file, 2 ); while ( read_a_line( NORMAL_READ ) ) { my ( $action, $options ) = split_line 'action file' , { action => 0, options => 1 }; @@ -1552,7 +1552,7 @@ sub process_action($) { progress_message2 "$doing $actionfile for chain $chainref->{name}..."; - push_open $actionfile, 2; + push_open $actionfile, 2, 1; my $oldparms = push_action_params( $chainref, $param, $level, $tag ); @@ -1798,7 +1798,7 @@ sub process_inline ($$$$$$$$$$$$$$$$$$$$) { progress_message "..Expanding inline action $inlinefile..."; - push_open $inlinefile; + push_open $inlinefile, 2; while ( read_a_line( NORMAL_READ ) ) { my ( $mtarget,