mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-08 08:44:05 +01:00
Tighten editing of SNAT/MASQ port ranges.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
c376740329
commit
f917670fbd
@ -472,7 +472,7 @@ sub validate_portpair1( $$ ) {
|
|||||||
|
|
||||||
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/-/-/ > 1;
|
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/-/-/ > 1;
|
||||||
|
|
||||||
$portpair = "0$portpair" if substr( $portpair, 0, 1 ) eq ':';
|
$portpair = "1$portpair" if substr( $portpair, 0, 1 ) eq ':';
|
||||||
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
|
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
|
||||||
|
|
||||||
my @ports = split /-/, $portpair, 2;
|
my @ports = split /-/, $portpair, 2;
|
||||||
@ -483,9 +483,10 @@ sub validate_portpair1( $$ ) {
|
|||||||
|
|
||||||
if ( @ports == 2 ) {
|
if ( @ports == 2 ) {
|
||||||
$what = 'port range';
|
$what = 'port range';
|
||||||
fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1];
|
fatal_error "Invalid port range ($portpair)" unless $ports[0] && $ports[0] < $ports[1];
|
||||||
} else {
|
} else {
|
||||||
$what = 'port';
|
$what = 'port';
|
||||||
|
fatal_error 'Invalid port number (0)' unless $portpair;
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
|
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
|
||||||
|
Loading…
Reference in New Issue
Block a user