mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-01 23:45:53 +02:00
More cleanup of hosts file exclusion
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6118 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
e8934d79c9
commit
b27cc81582
@ -105,8 +105,15 @@ sub validate_hosts_file()
|
|||||||
$optionsref = \%options;
|
$optionsref = \%options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Looking for the '!' at the beginning of a list element is more straight-foward than looking for it in the middle.
|
||||||
|
#
|
||||||
|
# Be sure we don't have a ',!' in the original
|
||||||
|
#
|
||||||
fatal_error "Invalid hosts list" if $hosts =~ /,!/;
|
fatal_error "Invalid hosts list" if $hosts =~ /,!/;
|
||||||
|
#
|
||||||
|
# Now add a comma before '!'. Do it globally - add_group_to_zone() correctly checks for multiple exclusions
|
||||||
|
#
|
||||||
$hosts =~ s/!/,!/g;
|
$hosts =~ s/!/,!/g;
|
||||||
|
|
||||||
add_group_to_zone( $zone, $type , $interface, [ split ',', $hosts ] , $optionsref);
|
add_group_to_zone( $zone, $type , $interface, [ split ',', $hosts ] , $optionsref);
|
||||||
|
@ -81,10 +81,10 @@ sub add_group_to_zone($$$$$)
|
|||||||
$ifacezone = '' unless defined $ifacezone;
|
$ifacezone = '' unless defined $ifacezone;
|
||||||
|
|
||||||
for my $host ( @$networks ) {
|
for my $host ( @$networks ) {
|
||||||
if ( $host =~ /^!.*/ ) {
|
if ( substr( $host, 0, 1 ) eq '!' ) {
|
||||||
fatal_error "Invalid host group: @$networks" if $switched;
|
fatal_error "Only one exclusion allowed in a host list" if $switched;
|
||||||
$switched = 1;
|
$switched = 1;
|
||||||
$host =~ s/^!//;
|
$host = substr( $host, 1 );
|
||||||
$new = \@exclusions;
|
$new = \@exclusions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user