summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/interfaces_groups_edit.php
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-12-12 16:39:33 -0200
committerRenato Botelho <renato@netgate.com>2016-12-12 16:44:18 -0200
commit6af92afd1fbe589af28de2c31fe7b1b7763f81ec (patch)
tree29bc67e83fbd9e9163bb40d090746f488a22a81c /src/usr/local/www/interfaces_groups_edit.php
parentf6e519ec4b4eb21ed123e154a78aa763757a2ad8 (diff)
downloadpfsense-6af92afd1fbe589af28de2c31fe7b1b7763f81ec.zip
pfsense-6af92afd1fbe589af28de2c31fe7b1b7763f81ec.tar.gz
Update interface group name validation rules to match ifconfig
Diffstat (limited to 'src/usr/local/www/interfaces_groups_edit.php')
-rw-r--r--src/usr/local/www/interfaces_groups_edit.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/usr/local/www/interfaces_groups_edit.php b/src/usr/local/www/interfaces_groups_edit.php
index 214e31b..a7f69e2 100644
--- a/src/usr/local/www/interfaces_groups_edit.php
+++ b/src/usr/local/www/interfaces_groups_edit.php
@@ -99,8 +99,16 @@ if ($_POST) {
}
}
- if (preg_match("/([^a-zA-Z])+/", $_POST['ifname'], $match)) {
- $input_errors[] = gettext("Only letters A-Z are allowed as the group name.");
+ if (strlen($_POST['ifname']) > 16) {
+ $input_errors[] = gettext("Group name cannot have more than 16 characters.");
+ }
+
+ if (preg_match("/([^a-zA-Z0-9-_])+/", $_POST['ifname'])) {
+ $input_errors[] = gettext("Only letters (A-Z), digits (0-9), '-' and '_' are allowed as the group name.");
+ }
+
+ if (preg_match("/[0-9]$/", $_POST['ifname'])) {
+ $input_errors[] = gettext("Group name cannot end with digit.");
}
foreach ($interface_list_disabled as $gif => $gdescr) {
@@ -221,7 +229,7 @@ $section->addInput(new Form_Input(
'Group Name',
'text',
$pconfig['ifname'],
- ['placeholder' => 'Group Name']
+ ['placeholder' => 'Group Name', 'maxlength' => "16"]
))->setWidth(6)->setHelp('No numbers or spaces are allowed. '.
'Only characters: a-zA-Z');
OpenPOWER on IntegriCloud