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:43:38 -0200
commit2326f3252a84c31f8d7ed2cefe289dfe0f496ac9 (patch)
treecb195a771452c821921856145fe37944e9dd4ce6 /src/usr/local/www/interfaces_groups_edit.php
parent7ec6e2831fe56514e90fcbd2beb5af52b7054ab6 (diff)
downloadpfsense-2326f3252a84c31f8d7ed2cefe289dfe0f496ac9.zip
pfsense-2326f3252a84c31f8d7ed2cefe289dfe0f496ac9.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 5b6e0bd..2847efc 100644
--- a/src/usr/local/www/interfaces_groups_edit.php
+++ b/src/usr/local/www/interfaces_groups_edit.php
@@ -67,8 +67,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) {
@@ -189,7 +197,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