From 89ac71d38a4c49e1537e4afe2b34b2457d9817a7 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 1 Feb 2017 09:42:52 +0545 Subject: Fix #7183 Do not allow Interface Groups with the same name I should stop trying bad stuff, there seem to be so many holes to find in the validation :) --- src/usr/local/www/interfaces_groups_edit.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/usr/local/www/interfaces_groups_edit.php') diff --git a/src/usr/local/www/interfaces_groups_edit.php b/src/usr/local/www/interfaces_groups_edit.php index fcf9b3d..434de73 100644 --- a/src/usr/local/www/interfaces_groups_edit.php +++ b/src/usr/local/www/interfaces_groups_edit.php @@ -69,11 +69,9 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); if (!$input_errors) { - if (!isset($id)) { - foreach ($a_ifgroups as $groupentry) { - if ($groupentry['ifname'] == $_POST['ifname']) { - $input_errors[] = gettext("Group name already exists!"); - } + foreach ($a_ifgroups as $groupid => $groupentry) { + if ((!isset($id) || ($groupid != $id)) && ($groupentry['ifname'] == $_POST['ifname'])) { + $input_errors[] = gettext("Group name already exists!"); } } -- cgit v1.1