diff options
author | Phil Davis <phil.davis@inf.org> | 2017-02-01 09:59:45 +0545 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-02-01 07:46:26 -0200 |
commit | cf80bd5f4561b579073defcdd7c7ea8a45cacf57 (patch) | |
tree | 8e5472acb92140ff8cb4e119f19eae19976c40e3 | |
parent | 1767e1c64a3aa82880bffa925c7e922ecdbcf16a (diff) | |
download | pfsense-cf80bd5f4561b579073defcdd7c7ea8a45cacf57.zip pfsense-cf80bd5f4561b579073defcdd7c7ea8a45cacf57.tar.gz |
Redmine #7173 Do not allow pkg_ for If, IfGroup, Alias
(cherry picked from commit c9d93b62b0cc559d1ed4326212b6385cae2eb398)
-rw-r--r-- | src/usr/local/www/firewall_aliases_edit.php | 9 | ||||
-rw-r--r-- | src/usr/local/www/interfaces.php | 9 | ||||
-rw-r--r-- | src/usr/local/www/interfaces_groups_edit.php | 8 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index 20dca5f..4a8a93c 100644 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -194,6 +194,15 @@ if ($_POST) { } } + /* + * Packages (e.g. tinc) create interface groups, reserve this + * namespace pkg_ for them. + * One namespace is shared by Interfaces, Interface Groups and Aliases. + */ + if (substr($_POST['name'], 0, 4) == 'pkg_') { + $input_errors[] = gettext("The alias name cannot start with pkg_"); + } + /* check for name interface description conflicts */ foreach ($config['interfaces'] as $interface) { if (strcasecmp($interface['descr'], $_POST['name']) == 0) { diff --git a/src/usr/local/www/interfaces.php b/src/usr/local/www/interfaces.php index 0f33780..e5d2e7a 100644 --- a/src/usr/local/www/interfaces.php +++ b/src/usr/local/www/interfaces.php @@ -553,6 +553,15 @@ if ($_POST['apply']) { if (is_numeric($_POST['descr'])) { $input_errors[] = gettext("The interface description cannot contain only numbers."); } + + /* + * Packages (e.g. tinc) create interface groups, reserve this + * namespace pkg_ for them. + * One namespace is shared by Interfaces, Interface Groups and Aliases. + */ + if (substr($_POST['descr'], 0, 4) == 'pkg_') { + $input_errors[] = gettext("The interface description cannot start with pkg_"); + } } if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable'])) { diff --git a/src/usr/local/www/interfaces_groups_edit.php b/src/usr/local/www/interfaces_groups_edit.php index d215288..e8bbf4d 100644 --- a/src/usr/local/www/interfaces_groups_edit.php +++ b/src/usr/local/www/interfaces_groups_edit.php @@ -116,11 +116,11 @@ if ($_POST) { } /* - * Packages (e.g. tinc) creates interface groups, reserve this - * namespace pkg- for them + * Packages (e.g. tinc) create interface groups, reserve this + * namespace pkg_ for them */ - if (substr($_POST['ifname'], 0, 4) == 'pkg-') { - $input_errors[] = gettext("Group name cannot start with pkg-"); + if (substr($_POST['ifname'], 0, 4) == 'pkg_') { + $input_errors[] = gettext("Group name cannot start with pkg_"); } foreach ($interface_list_disabled as $gif => $gdescr) { |