diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-04-10 08:07:07 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-04-10 08:07:07 -0300 |
commit | 8543a5bbe2037c9214f967806f417c7c4ba3b062 (patch) | |
tree | 8841722ca000796f3066d58f230059d89159eff6 /usr/local | |
parent | 87f611017953aadb5db66ded7d27724786b0d118 (diff) | |
download | pfsense-8543a5bbe2037c9214f967806f417c7c4ba3b062.zip pfsense-8543a5bbe2037c9214f967806f417c7c4ba3b062.tar.gz |
Prohibit adding aliases containing FQDNs in static routes. Fixes #2941
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/firewall_aliases_edit.php | 14 | ||||
-rwxr-xr-x | usr/local/www/system_routes_edit.php | 8 |
2 files changed, 22 insertions, 0 deletions
diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index ca5fd9e..a41770c 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -254,6 +254,15 @@ if ($_POST) { } } else { /* item is a normal alias type */ + $used_for_routes = 0; + if (isset($config['staticroutes']['route']) && is_array($config['staticroutes']['route'])) { + foreach($config['staticroutes']['route'] as $route) { + if ($route['network'] == $_POST['origname']) { + $used_for_routes = 1; + break; + } + } + } $wrongaliases = ""; for($x=0; $x<4999; $x++) { if($_POST["address{$x}"] <> "") { @@ -272,6 +281,11 @@ if ($_POST) { && !is_hostname($_POST["address{$x}"]) && !is_iprange($_POST["address{$x}"])) $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']); + if (($used_for_routes === 1) + && !is_ipaddr($_POST["address{$x}"]) + && !is_iprange($_POST["address{$x}"]) + && is_hostname($_POST["address{$x}"])) + $input_errors[] = gettext('This alias is used on a static route and cannot contain FQDNs.'); } if (is_iprange($_POST["address{$x}"])) { list($startip, $endip) = explode('-', $_POST["address{$x}"]); diff --git a/usr/local/www/system_routes_edit.php b/usr/local/www/system_routes_edit.php index cd85c4e..28649e0 100755 --- a/usr/local/www/system_routes_edit.php +++ b/usr/local/www/system_routes_edit.php @@ -125,7 +125,15 @@ if ($_POST) { } } elseif (is_alias($_POST['network'])) { $osn = $_POST['network']; + $fqdn_found = 0; foreach (filter_expand_alias_array($_POST['network']) as $tgt) { + if (!is_ipaddr($tgt) && is_hostname($tgt)) { + if ($fqdn_found === 0) { + $input_errors[] = sprintf(gettext("The alias (%s) has one or more FQDNs configured and cannot be used to configure a static route."), $_POST['network']); + $fqdn_found = 1; + } + continue; + } if (is_ipaddrv4($tgt)) $tgt .= "/32"; if (is_ipaddrv6($tgt)) |