Tweak to host list processing

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6267 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-05-07 17:36:21 +00:00
parent 55e8ff29c7
commit 4ec96b6619
2 changed files with 7 additions and 5 deletions

View File

@ -114,11 +114,11 @@ sub validate_hosts_file()
#
# Now add a comma before '!'. Do it globally - add_group_to_zone() correctly checks for multiple exclusions
#
if ( substr($hosts, 0, 1 ) eq '!' ) {
$hosts = join( '', ALLIPv4 , ',', $hosts );
} else {
$hosts =~ s/!/,!/g
}
$hosts =~ s/!/,!/g;
#
# Take care of case where the hosts list begins with '!'
#
$hosts = join( '', ALLIPv4 , $hosts ) if substr($hosts, 0, 2 ) eq ',!';
add_group_to_zone( $zone, $type , $interface, [ split( ',', $hosts ) ] , $optionsref);

View File

@ -81,6 +81,8 @@ sub add_group_to_zone($$$$$)
$ifacezone = '' unless defined $ifacezone;
for my $host ( @$networks ) {
fatal_error "Invalid Host List" unless defined $host and $host ne '';
if ( substr( $host, 0, 1 ) eq '!' ) {
fatal_error "Only one exclusion allowed in a host list" if $switched;
$switched = 1;