summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-12-13 11:11:19 +0545
committerGitHub <noreply@github.com>2016-12-13 11:11:19 +0545
commit03444470be5c4c2d713873342acb04793c2aa561 (patch)
tree9f604b1721d44378249e2fc64bf267454e29d03a /src/usr
parentc165a17e0225f09afb4882d360ba086f629f2b77 (diff)
downloadpfsense-03444470be5c4c2d713873342acb04793c2aa561.zip
pfsense-03444470be5c4c2d713873342acb04793c2aa561.tar.gz
Improve input validation for services_dhcpv6_relay
Make the same imrovements as was done for services_dhcp_relay in commit https://github.com/pfsense/pfsense/commit/ac999f3b7894bd8d5fc35419a22cc2df39416e42
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/local/www/services_dhcpv6_relay.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/usr/local/www/services_dhcpv6_relay.php b/src/usr/local/www/services_dhcpv6_relay.php
index a80b529..2fd3bbe 100644
--- a/src/usr/local/www/services_dhcpv6_relay.php
+++ b/src/usr/local/www/services_dhcpv6_relay.php
@@ -39,6 +39,7 @@ if (empty($config['dhcrelay6']['interface'])) {
}
$pconfig['agentoption'] = isset($config['dhcrelay6']['agentoption']);
+$pconfig['server'] = $config['dhcrelay6']['server'];
$iflist = array_intersect_key(
get_configured_interface_with_descr(),
@@ -83,12 +84,11 @@ if ($_POST) {
if ($_POST['server']) {
foreach ($_POST['server'] as $checksrv => $srv) {
- if (!is_ipaddrv6($srv[0])) {
- $input_errors[] = gettext("A valid Destination Server IPv6 address must be specified.");
- }
-
-
if (!empty($srv[0])) { // Filter out any empties
+ if (!is_ipaddrv6($srv[0])) {
+ $input_errors[] = sprintf(gettext("Destination Server IP address %s is not a valid IPv6 address."), $srv[0]);
+ }
+
if (!empty($svrlist)) {
$svrlist .= ',';
}
@@ -96,9 +96,17 @@ if ($_POST) {
$svrlist .= $srv[0];
}
}
+
+ // Check that the user input something in one of the Destination Server fields
+ if (empty($svrlist)) {
+ $input_errors[] = gettext("At least one Destination Server IP address must be specified.");
+ }
}
}
+ // Now $svrlist is a comma separated list of servers ready to save to the config system
+ $pconfig['server'] = $svrlist;
+
if (!$input_errors) {
$config['dhcrelay6']['enable'] = $_POST['enable'] ? true : false;
$config['dhcrelay6']['interface'] = implode(",", $_POST['interface']);
@@ -113,8 +121,6 @@ if ($_POST) {
}
}
-$pconfig['server'] = $config['dhcrelay6']['server'];
-
$pgtitle = array(gettext("Services"), gettext("DHCPv6 Relay"));
$shortcut_section = "dhcp6";
include("head.inc");
OpenPOWER on IntegriCloud