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
This commit is contained in:
teastep 2007-06-20 18:58:44 +00:00
parent c7f68018a9
commit 3a29f37109
2 changed files with 32 additions and 5 deletions

View File

@ -369,6 +369,8 @@ sub add_rule($$)
{ {
my ($chainref, $rule) = @_; my ($chainref, $rule) = @_;
$iprangematch = 0;
if ( $chainref->{loopcount} || $chainref->{cmdcount} ) { if ( $chainref->{loopcount} || $chainref->{cmdcount} ) {
$rule .= " -m comment --comment \\\"$comment\\\"" if $comment; $rule .= " -m comment --comment \\\"$comment\\\"" if $comment;
add_command $chainref , qq(echo "-A $chainref->{name} $rule" >&3); add_command $chainref , qq(echo "-A $chainref->{name} $rule" >&3);
@ -377,8 +379,6 @@ sub add_rule($$)
push @{$chainref->{rules}}, $rule; push @{$chainref->{rules}}, $rule;
$chainref->{referenced} = 1; $chainref->{referenced} = 1;
} }
$iprangematch = 0;
} }
# #
@ -396,9 +396,10 @@ sub insert_rule($$$)
splice @{$chainref->{rules}}, $number - 1, 0, $rule; splice @{$chainref->{rules}}, $number - 1, 0, $rule;
$iprangematch = 0;
$chainref->{referenced} = 1; $chainref->{referenced} = 1;
$iprangematch = 0;
} }
# #

View File

@ -1,5 +1,31 @@
#! /usr/bin/perl -w #! /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 [ <directory> ]
#
# Where:
#
# <directory> is the directory where the 'protocols' and 'services' files are
# localed. If not specified, /etc is assumed.
#
use strict; use strict;
use lib '/usr/share/shorewall-perl'; use lib '/usr/share/shorewall-perl';
use Shorewall::Common; 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; ensure_config_path;