Project

General

Profile

« Previous | Next » 

Revision 8543a5bb

Added by Renato Botelho over 12 years ago

Prohibit adding aliases containing FQDNs in static routes. Fixes #2941

View differences:

usr/local/www/firewall_aliases_edit.php
254 254
		}
255 255
	} else {
256 256
		/* item is a normal alias type */
257
		$used_for_routes = 0;
258
		if (isset($config['staticroutes']['route']) && is_array($config['staticroutes']['route'])) {
259
			foreach($config['staticroutes']['route'] as $route) {
260
				if ($route['network'] == $_POST['origname']) {
261
					$used_for_routes = 1;
262
					break;
263
				}
264
			}
265
		}
257 266
		$wrongaliases = "";
258 267
		for($x=0; $x<4999; $x++) {
259 268
			if($_POST["address{$x}"] <> "") {
......
272 281
					 && !is_hostname($_POST["address{$x}"])
273 282
					 && !is_iprange($_POST["address{$x}"]))
274 283
						$input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']);
284
					if (($used_for_routes === 1)
285
					 && !is_ipaddr($_POST["address{$x}"])
286
					 && !is_iprange($_POST["address{$x}"])
287
					 && is_hostname($_POST["address{$x}"]))
288
						$input_errors[] = gettext('This alias is used on a static route and cannot contain FQDNs.');
275 289
				}
276 290
				if (is_iprange($_POST["address{$x}"])) {
277 291
					list($startip, $endip) = explode('-', $_POST["address{$x}"]);

Also available in: Unified diff