summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_aliases_edit.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-04-10 08:07:07 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-04-10 08:07:07 -0300
commit8543a5bbe2037c9214f967806f417c7c4ba3b062 (patch)
tree8841722ca000796f3066d58f230059d89159eff6 /usr/local/www/firewall_aliases_edit.php
parent87f611017953aadb5db66ded7d27724786b0d118 (diff)
downloadpfsense-8543a5bbe2037c9214f967806f417c7c4ba3b062.zip
pfsense-8543a5bbe2037c9214f967806f417c7c4ba3b062.tar.gz
Prohibit adding aliases containing FQDNs in static routes. Fixes #2941
Diffstat (limited to 'usr/local/www/firewall_aliases_edit.php')
-rwxr-xr-xusr/local/www/firewall_aliases_edit.php14
1 files changed, 14 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}"]);
OpenPOWER on IntegriCloud