summaryrefslogtreecommitdiffstats
path: root/etc/inc/util.inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r--etc/inc/util.inc18
1 files changed, 10 insertions, 8 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 169fb7d..498f14a 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -300,14 +300,16 @@ function is_validaliasname($name) {
/* returns true if $port is a valid TCP/UDP port */
function is_port($port) {
- if (getservbyname($port, "tcp") || getservbyname($port, "udp"))
- return true;
- if (!ctype_digit($port))
- return false;
- if ((intval($port) < 1) || (intval($port) > 65535))
- return false;
- else
- return true;
+ $tmpports = explode(":", $port);
+ foreach($tmpports as $tmpport) {
+ if (getservbyname($tmpport, "tcp") || getservbyname($tmpport, "udp"))
+ continue;
+ if (!ctype_digit($tmpport))
+ return false;
+ else if ((intval($port) < 1) || (intval($port) > 65535))
+ return false;
+ }
+ return true;
}
/* returns true if $portrange is a valid TCP/UDP portrange ("<port>:<port>") */
OpenPOWER on IntegriCloud