From 3a29f37109caf82897567fe17b1fd41062cc45b9 Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 20 Jun 2007 18:58:44 +0000 Subject: [PATCH] Add copyright to buildproto.pl; make common functions from Chains.pm return success git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6618 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Chains.pm | 7 ++++--- Shorewall-perl/buildproto.pl | 30 ++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Shorewall-perl/Shorewall/Chains.pm b/Shorewall-perl/Shorewall/Chains.pm index d89c1e31b..1c0bf7948 100644 --- a/Shorewall-perl/Shorewall/Chains.pm +++ b/Shorewall-perl/Shorewall/Chains.pm @@ -369,6 +369,8 @@ sub add_rule($$) { my ($chainref, $rule) = @_; + $iprangematch = 0; + if ( $chainref->{loopcount} || $chainref->{cmdcount} ) { $rule .= " -m comment --comment \\\"$comment\\\"" if $comment; add_command $chainref , qq(echo "-A $chainref->{name} $rule" >&3); @@ -377,8 +379,6 @@ sub add_rule($$) push @{$chainref->{rules}}, $rule; $chainref->{referenced} = 1; } - - $iprangematch = 0; } # @@ -396,9 +396,10 @@ sub insert_rule($$$) splice @{$chainref->{rules}}, $number - 1, 0, $rule; + $iprangematch = 0; + $chainref->{referenced} = 1; - $iprangematch = 0; } # diff --git a/Shorewall-perl/buildproto.pl b/Shorewall-perl/buildproto.pl index e49b2d8d8..f973c536f 100644 --- a/Shorewall-perl/buildproto.pl +++ b/Shorewall-perl/buildproto.pl @@ -1,5 +1,31 @@ #! /usr/bin/perl -w - +# +# Tool for building tables used to validate protocol and service names in Shorewall rules. +# +# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm] +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of Version 2 of the GNU General Public License +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA +# +# Usage: +# +# buildproto.pl [ ] +# +# Where: +# +# is the directory where the 'protocols' and 'services' files are +# localed. If not specified, /etc is assumed. +# use strict; use lib '/usr/share/shorewall-perl'; use Shorewall::Common; @@ -32,7 +58,7 @@ sub print_service( $$ ) { } } -set_shorewall_dir($ARGV[0] ? $ARGV[0] : '.'); +set_shorewall_dir($ARGV[0] ? $ARGV[0] : '/etc'); ensure_config_path;