Test correctly for previous existing entries of linked rules otherwise some bad deletions might happen. Reported-by: http://forum.pfsense.org/index.php/topic,25091.0.html

This commit is contained in:
Ermal 2010-05-13 18:56:07 +00:00
parent 2b001b5d05
commit f83fa94292

View File

@ -316,7 +316,7 @@ if ($_POST) {
unset($natent['nosync']);
// If we used to have an associated filter rule, but no-longer should have one
if ($a_nat[$id]>0 && ( empty($natent['associated-rule-id']) || $natent['associated-rule-id'] != $a_nat[$id]['associated-rule-id'] ) ) {
if (!empty($a_nat[$id]) && ( empty($natent['associated-rule-id']) || $natent['associated-rule-id'] != $a_nat[$id]['associated-rule-id'] ) ) {
// Delete the previous rule
delete_id($a_nat[$id]['associated-rule-id'], $config['filter']['rule']);
mark_subsystem_dirty('filter');