forked from extern/shorewall_code
More careful editing of the hosts file
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6738 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
fbccbb3368
commit
516f3d99ad
@ -34,6 +34,7 @@ our @EXPORT = qw( ALLIPv4
|
||||
|
||||
validate_address
|
||||
validate_net
|
||||
validate_host
|
||||
validate_range
|
||||
ip_range_explicit
|
||||
|
||||
@ -149,4 +150,14 @@ sub ip_range_explicit( $ ) {
|
||||
@result;
|
||||
}
|
||||
|
||||
sub validate_host( $ ) {
|
||||
my $host = $_[0];
|
||||
|
||||
if ( $host =~ /^(\d+\.\d+\.\d+\.\d+)-(\d+\.\d+\.\d+\.\d+)$/ ) {
|
||||
validate_range $1, $2;
|
||||
} else {
|
||||
validate_net( $host );
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -123,6 +123,12 @@ sub add_group_to_zone($$$$$)
|
||||
}
|
||||
}
|
||||
|
||||
if ( $host =~ /^\+/ ) {
|
||||
fatal_error "Invalid ipset name ($host)" unless $host =~ /^\+[a-zA-Z]\w*$/;
|
||||
} else {
|
||||
validate_host $host;
|
||||
}
|
||||
|
||||
push @$new, $switched ? "$interface:$host" : $host;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user