summaryrefslogtreecommitdiffstats
path: root/src/usr/local
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-04-28 13:31:26 +0545
committerPhil Davis <phil.davis@inf.org>2016-04-28 13:31:26 +0545
commite1f5381f4ecae20922a379b75820af1c9e57927e (patch)
treef86abba8af25828e1472393c0d41d17b1345ddc5 /src/usr/local
parenta120c849074acf6121665f47315bd477d0253af6 (diff)
downloadpfsense-e1f5381f4ecae20922a379b75820af1c9e57927e.zip
pfsense-e1f5381f4ecae20922a379b75820af1c9e57927e.tar.gz
Provide better messages for invalid alias name errors
Diffstat (limited to 'src/usr/local')
-rwxr-xr-xsrc/usr/local/www/firewall_aliases_edit.php12
-rwxr-xr-xsrc/usr/local/www/firewall_aliases_import.php4
-rw-r--r--src/usr/local/www/firewall_schedule_edit.php9
-rw-r--r--src/usr/local/www/system_gateway_groups_edit.php2
-rw-r--r--src/usr/local/www/system_gateways_edit.php2
5 files changed, 9 insertions, 20 deletions
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php
index 5d2ac60..f96ae3e 100755
--- a/src/usr/local/www/firewall_aliases_edit.php
+++ b/src/usr/local/www/firewall_aliases_edit.php
@@ -175,16 +175,10 @@ if ($_POST) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
- $x = is_validaliasname($_POST['name']);
- if (!isset($x)) {
- $input_errors[] = gettext("Reserved word used for alias name.");
- } else if ($_POST['type'] == "port" && (getservbyname($_POST['name'], "tcp") || getservbyname($_POST['name'], "udp"))) {
- $input_errors[] = gettext("Reserved word used for alias name.");
- } else {
- if (is_validaliasname($_POST['name']) == false) {
- $input_errors[] = sprintf(gettext("The alias name must be less than 32 characters long, may not consist of only numbers, may not consist of only underscores, and may only contain the following characters: %s"), 'a-z, A-Z, 0-9, _');
- }
+ if (!is_validaliasname($_POST['name'])) {
+ $input_errors[] = invalidaliasnamemsg($_POST['name']);
}
+
/* check for name conflicts */
foreach ($a_aliases as $key => $alias) {
if (($alias['name'] == $_POST['name']) && (empty($a_aliases[$id]) || ($key != $id))) {
diff --git a/src/usr/local/www/firewall_aliases_import.php b/src/usr/local/www/firewall_aliases_import.php
index 77b2adf..04c1617 100755
--- a/src/usr/local/www/firewall_aliases_import.php
+++ b/src/usr/local/www/firewall_aliases_import.php
@@ -94,8 +94,8 @@ if ($_POST['aliasimport'] != "") {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
- if (is_validaliasname($_POST['name']) == false) {
- $input_errors[] = sprintf(gettext("The alias name may only consist of the characters %s"), "a-z, A-Z, 0-9, _.");
+ if (!is_validaliasname($_POST['name'])) {
+ $input_errors[] = invalidaliasnamemsg($_POST['name']);
}
/* check for name duplicates */
diff --git a/src/usr/local/www/firewall_schedule_edit.php b/src/usr/local/www/firewall_schedule_edit.php
index 5ef540e..26470d8 100644
--- a/src/usr/local/www/firewall_schedule_edit.php
+++ b/src/usr/local/www/firewall_schedule_edit.php
@@ -125,13 +125,8 @@ if ($_POST) {
$input_errors[] = gettext("Schedule name cannot be blank.");
}
- $x = is_validaliasname($_POST['name']);
- if (!isset($x)) {
- $input_errors[] = gettext("Reserved word used for schedule name.");
- } else {
- if (is_validaliasname($_POST['name']) == false) {
- $input_errors[] = sprintf(gettext("The schedule name must be less than 32 characters long, may not consist of only numbers, may not consist of only underscores, and may only contain the following characters: %s"), 'a-z, A-Z, 0-9, _');
- }
+ if (!is_validaliasname($_POST['name'])) {
+ $input_errors[] = invalidaliasnamemsg($_POST['name'], gettext("schedule"));
}
/* check for name conflicts */
diff --git a/src/usr/local/www/system_gateway_groups_edit.php b/src/usr/local/www/system_gateway_groups_edit.php
index d130a69..f1a3045 100644
--- a/src/usr/local/www/system_gateway_groups_edit.php
+++ b/src/usr/local/www/system_gateway_groups_edit.php
@@ -115,7 +115,7 @@ if ($_POST) {
$input_errors[] = gettext("A valid gateway group name must be specified.");
}
if (!is_validaliasname($_POST['name'])) {
- $input_errors[] = gettext("The gateway name must not contain invalid characters.");
+ $input_errors[] = invalidaliasnamemsg($_POST['name'], gettext("gateway group"));
}
if (isset($_POST['name'])) {
diff --git a/src/usr/local/www/system_gateways_edit.php b/src/usr/local/www/system_gateways_edit.php
index f483979..cbbea08 100644
--- a/src/usr/local/www/system_gateways_edit.php
+++ b/src/usr/local/www/system_gateways_edit.php
@@ -147,7 +147,7 @@ if ($_POST) {
$input_errors[] = "A valid gateway name must be specified.";
}
if (!is_validaliasname($_POST['name'])) {
- $input_errors[] = gettext("The gateway name must not contain invalid characters.");
+ $input_errors[] = invalidaliasnamemsg($_POST['name'], gettext("gateway"));
} else if (isset($_POST['disabled'])) {
// We have a valid gateway name that the user wants to mark as disabled.
// Check if the gateway name is used in any gateway group.
OpenPOWER on IntegriCloud