diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-01-12 09:19:20 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-01-12 09:19:20 +0000 |
commit | cd05327d57fac9c5e2455076a3045bfc47d80593 (patch) | |
tree | ade4e27fab3b173e74ec1887f8540288308cc21c /perl-install/network/drakfirewall.pm | |
parent | 939960b2b402b1651ebc1730c280cbc68d191352 (diff) | |
download | drakx-cd05327d57fac9c5e2455076a3045bfc47d80593.tar drakx-cd05327d57fac9c5e2455076a3045bfc47d80593.tar.gz drakx-cd05327d57fac9c5e2455076a3045bfc47d80593.tar.bz2 drakx-cd05327d57fac9c5e2455076a3045bfc47d80593.tar.xz drakx-cd05327d57fac9c5e2455076a3045bfc47d80593.zip |
allow a range of ports (anthill bug #267)
Diffstat (limited to 'perl-install/network/drakfirewall.pm')
-rw-r--r-- | perl-install/network/drakfirewall.pm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/perl-install/network/drakfirewall.pm b/perl-install/network/drakfirewall.pm index 428c855c2..aa0db51d9 100644 --- a/perl-install/network/drakfirewall.pm +++ b/perl-install/network/drakfirewall.pm @@ -68,8 +68,11 @@ sub port2server { sub check_ports_syntax { my ($ports) = @_; foreach (split ' ', $ports) { - my ($nb) = m!^(\d+)/(tcp|udp)$! or return $_; - 1 <= $nb && $nb <= 65535 or return $_; + my ($nb, $range, $nb2) = m!^(\d+)(:(\d+))?/(tcp|udp)$! or return $_; + foreach my $port ($nb, if_($range, $nb2)) { + 1 <= $port && $port <= 65535 or return $_; + } + $nb < $nb2 or return $_ if $range; } ''; } @@ -165,7 +168,9 @@ Have a look at /etc/services for information."), if (my $invalid_port = check_ports_syntax($unlisted)) { $in->ask_warn('', N("Invalid port given: %s. The proper format is \"port/tcp\" or \"port/udp\", -where port is between 1 and 65535.", $invalid_port)); +where port is between 1 and 65535. + +You can also give a range of ports (eg: 24300:24350/udp)", $invalid_port)); return 1; } }, |