Tighten editing of SNAT/MASQ port ranges.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-11-02 19:30:18 -07:00
parent c376740329
commit f917670fbd
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10

View File

@ -472,7 +472,7 @@ sub validate_portpair1( $$ ) {
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 ':';
my @ports = split /-/, $portpair, 2;
@ -483,9 +483,10 @@ sub validate_portpair1( $$ ) {
if ( @ports == 2 ) {
$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 {
$what = 'port';
fatal_error 'Invalid port number (0)' unless $portpair;
}
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless