Project

General

Profile

« Previous | Next » 

Revision 29069aed

Added by Phil Davis over 8 years ago

Fix DNS Server Gateway Check

If I enter a DNS server IP address that is on a locally connected network, and choose a gateway for it, this code was supposed to give an error message. But no error was given because $_POST[$dnsgwitem] is actually the name of the gateway, but old line 197 called interface_has_gateway() which was expecting an interface to be passed.
Just get rid of the interface_has_gateway() test, and come into this foreach() whenever the users chooses a gateway that is not "none".
(cherry picked from commit d858795251b3eb2190cc16adaec13a4efee9955b)

View differences:

src/usr/local/www/system.php
225 225
	for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
226 226
		$dnsitem = "dns{$dnscounter}";
227 227
		$dnsgwitem = "dns{$dnscounter}gw";
228
		if ($_POST[$dnsgwitem]) {
229
			if (interface_has_gateway($_POST[$dnsgwitem])) {
230
				foreach ($direct_networks_list as $direct_network) {
231
					if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
232
						$input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsitem]);
233
					}
228
		if ($_POST[$dnsgwitem] && ($_POST[$dnsgwitem] <> "none")) {
229
			foreach ($direct_networks_list as $direct_network) {
230
				if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
231
					$input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsitem]);
234 232
				}
235 233
			}
236 234
		}

Also available in: Unified diff