Révision 9060f420
Ajouté par Renato Botelho il y a plus de 9 ans
etc/inc/util.inc | ||
---|---|---|
677 | 677 |
|
678 | 678 |
/* returns true if $port is a valid TCP/UDP port */ |
679 | 679 |
function is_port($port) { |
680 |
$tmpports = explode(":", $port); |
|
681 |
foreach($tmpports as $tmpport) { |
|
682 |
if (getservbyname($tmpport, "tcp") || getservbyname($tmpport, "udp")) |
|
683 |
continue; |
|
684 |
if (!ctype_digit($tmpport)) |
|
685 |
return false; |
|
686 |
else if ((intval($tmpport) < 1) || (intval($tmpport) > 65535)) |
|
687 |
return false; |
|
688 |
} |
|
680 |
if (getservbyname($port, "tcp") || getservbyname($port, "udp")) |
|
681 |
return true; |
|
682 |
if (!ctype_digit($port)) |
|
683 |
return false; |
|
684 |
else if ((intval($port) < 1) || (intval($port) > 65535)) |
|
685 |
return false; |
|
689 | 686 |
return true; |
690 | 687 |
} |
691 | 688 |
|
... | ... | |
1255 | 1252 |
|
1256 | 1253 |
if (isset($aliastable[$name])) |
1257 | 1254 |
return "\${$name}"; |
1258 |
else if (is_ipaddr($name) || is_subnet($name) || is_port($name)) |
|
1255 |
else if (is_ipaddr($name) || is_subnet($name) || is_port($name) || is_portrange($name))
|
|
1259 | 1256 |
return "{$name}"; |
1260 | 1257 |
else |
1261 | 1258 |
return null; |
Formats disponibles : Unified diff
Change is_port() to only validate a single port, we have is_portrange() for specific cases. Make necessary adjustments after check all is_port() calls. It fixes #3857