Add input validation so users do not add gateways to local dns servers

This commit is contained in:
Seth Mos 2008-11-11 23:04:22 +00:00
parent 5aaf13c437
commit c98d28e12e

View File

@ -121,6 +121,21 @@ if ($_POST) {
$input_errors[] = "A valid TCP/IP port must be specified for the webConfigurator port.";
}
$direct_networks_list = explode(" ", get_direct_networks_list());
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
$dnsitem = "dns{$dnscounter}";
$dnsgwitem = "dns{$dnscounter}gwint";
if ($_POST[$dnsgwitem]) {
if(interface_has_gateway($_POST[$dnsgwitem])) {
foreach($direct_networks_list as $direct_network) {
if(ip_in_subnet($_POST[$dnsitem], $direct_network)) {
$input_errors[] = "You can not assign a gateway to DNS '{$_POST[$dnsitem]}' server which is on a directly connected network.";
}
}
}
}
}
$t = (int)$_POST['timeupdateinterval'];
if (($t < 0) || (($t > 0) && ($t < 6)) || ($t > 1440)) {
$input_errors[] = "The time update interval must be either 0 (disabled) or between 6 and 1440.";