diff options
author | Renato Botelho <renato@netgate.com> | 2017-01-24 10:21:46 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-01-24 10:21:46 -0200 |
commit | 773ad30c92d885c3c269b8ef43bd05a8ddd65b27 (patch) | |
tree | 2271acd5d60bcc42bf79092459c9dfcfeb468062 /src/usr/local | |
parent | 259013c5f1697735e04ccd502f799aadd83fb906 (diff) | |
parent | b101627a9d84b6aa9741686c774cf42040abdd0d (diff) | |
download | pfsense-773ad30c92d885c3c269b8ef43bd05a8ddd65b27.zip pfsense-773ad30c92d885c3c269b8ef43bd05a8ddd65b27.tar.gz |
Merge pull request #3421 from phil-davis/patch-4
Diffstat (limited to 'src/usr/local')
-rwxr-xr-x | src/usr/local/www/interfaces.php | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/src/usr/local/www/interfaces.php b/src/usr/local/www/interfaces.php index cf20766..eb150bb 100755 --- a/src/usr/local/www/interfaces.php +++ b/src/usr/local/www/interfaces.php @@ -488,36 +488,44 @@ if ($_POST['apply']) { unset($_POST['pppoe_resetdate']); unset($_POST['pppoe_pr_preset_val']); } - /* description unique? */ - foreach ($ifdescrs as $ifent => $ifdescr) { - if ($if != $ifent && (strcasecmp($ifdescr, $_POST['descr']) == 0)) { - $input_errors[] = gettext("An interface with the specified description already exists."); - break; + + /* input validation */ + $reqdfields = explode(" ", "descr"); + $reqdfieldsn = array(gettext("Description")); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); + + if (!$input_errors) { + /* description unique? */ + foreach ($ifdescrs as $ifent => $ifdescr) { + if ($if != $ifent && (strcasecmp($ifdescr, $_POST['descr']) == 0)) { + $input_errors[] = gettext("An interface with the specified description already exists."); + break; + } } - } - /* Is the description already used as an alias name? */ - if (is_array($config['aliases']['alias'])) { - foreach ($config['aliases']['alias'] as $alias) { - if (strcasecmp($alias['name'], $_POST['descr']) == 0) { - $input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."), $_POST['descr']); + /* Is the description already used as an alias name? */ + if (is_array($config['aliases']['alias'])) { + foreach ($config['aliases']['alias'] as $alias) { + if (strcasecmp($alias['name'], $_POST['descr']) == 0) { + $input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."), $_POST['descr']); + } } } - } - /* Is the description already used as an interface group name? */ - if (is_array($config['ifgroups']['ifgroupentry'])) { - foreach ($config['ifgroups']['ifgroupentry'] as $ifgroupentry) { - if (strcasecmp($ifgroupentry['ifname'], $_POST['descr']) == 0) { - $input_errors[] = sprintf(gettext("Sorry, an interface group with the name %s already exists."), $_POST['descr']); + /* Is the description already used as an interface group name? */ + if (is_array($config['ifgroups']['ifgroupentry'])) { + foreach ($config['ifgroups']['ifgroupentry'] as $ifgroupentry) { + if (strcasecmp($ifgroupentry['ifname'], $_POST['descr']) == 0) { + $input_errors[] = sprintf(gettext("Sorry, an interface group with the name %s already exists."), $_POST['descr']); + } } } - } - if (is_numeric($_POST['descr'])) { - $input_errors[] = gettext("The interface description cannot contain only numbers."); + if (is_numeric($_POST['descr'])) { + $input_errors[] = gettext("The interface description cannot contain only numbers."); + } } - /* input validation */ + if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable'])) { if (!preg_match("/^staticv4/", $_POST['type'])) { $input_errors[] = gettext("The DHCP Server is active " . |