mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
IPv6 friendly functions
This commit is contained in:
@@ -69,14 +69,14 @@ return $_[0] =~ /^\d+$/ ? undef : $text{'acl_erate'};
|
||||
|
||||
sub check_ntp
|
||||
{
|
||||
return $_[0] =~ /^(\S+):(\d+)$/ && gethostbyname($1) ? undef
|
||||
return $_[0] =~ /^(\S+):(\d+)$/ && &to_ipaddress("$1") ? undef
|
||||
: $text{'acl_entp'};
|
||||
}
|
||||
|
||||
|
||||
sub valid_srcdest
|
||||
{
|
||||
return gethostbyname($_[0]) ||
|
||||
return &to_ipaddress($_[0]) ||
|
||||
($_[0] =~ /^([0-9\.]+)\/(\d+)$/ &&
|
||||
&check_ipaddress($1) && $2 > 0 && $2 <= 32) ||
|
||||
($_[0] =~ /^([0-9\.]+)\/([0-9\.]+)$/ &&
|
||||
|
||||
@@ -40,7 +40,7 @@ return $_[0] =~ /^\d+$/ ? undef : $text{'cache_esize'};
|
||||
|
||||
sub check_proxy
|
||||
{
|
||||
return $_[0] =~ /^(\S+):(\d+)$/ && gethostbyname($1) ?
|
||||
return $_[0] =~ /^(\S+):(\d+)$/ && &to_ipaddress($1) ?
|
||||
undef : $text{'cache_eproxy'};
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ $port = &find_value("Port", $conf);
|
||||
|
||||
# Validate inputs
|
||||
if ($in{'enabled'} == 1) {
|
||||
gethostbyname($in{'net'}) ||
|
||||
&to_ipaddress($in{'net'}) ||
|
||||
($in{'net'} =~ /^([0-9\.]+)\/(\d+)$/ &&
|
||||
&check_ipaddress($1) && $2 > 0 && $2 <= 32) ||
|
||||
&error($text{'iptables_enet'});
|
||||
|
||||
@@ -24,7 +24,7 @@ $conf = &get_config();
|
||||
|
||||
sub check_listen
|
||||
{
|
||||
return gethostbyname($_[0]) ? undef : $text{'net_ehost'};
|
||||
return &to_ipaddress($_[0]) ? undef : $text{'net_ehost'};
|
||||
}
|
||||
|
||||
sub check_port
|
||||
@@ -39,7 +39,8 @@ return $_[0] =~ /^[a-z]+(\d*)(:\d+)?$/ ? undef : $text{'net_eiface'};
|
||||
|
||||
sub check_proxy
|
||||
{
|
||||
return $_[0] =~ /^(\S+):(\d+)$/ && gethostbyname($1) ? undef : $text{'net_eproxy'};
|
||||
return $_[0] =~ /^(\S+):(\d+)$/ && &to_ipaddress($1) ?
|
||||
undef : $text{'net_eproxy'};
|
||||
}
|
||||
|
||||
sub check_ip
|
||||
|
||||
Reference in New Issue
Block a user