diff options
author | Ermal <eri@pfsense.org> | 2011-09-03 20:07:15 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2011-09-03 20:07:15 +0000 |
commit | 2c102f579e66efcc164d13cde3e11255b516e006 (patch) | |
tree | 45322800489e1fd908e5466c0ce18024db25965d /config/snort/snort_rules_edit.php | |
parent | 3dece31000dc725d8d6d4d269186348511a25ffc (diff) | |
download | pfsense-packages-2c102f579e66efcc164d13cde3e11255b516e006.tar.gz pfsense-packages-2c102f579e66efcc164d13cde3e11255b516e006.tar.bz2 pfsense-packages-2c102f579e66efcc164d13cde3e11255b516e006.zip |
Correct toggle action behaviour on snort rules. Also a quick attempt to fix keeping local modification of disable/enable of rules.
Diffstat (limited to 'config/snort/snort_rules_edit.php')
-rw-r--r-- | config/snort/snort_rules_edit.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/config/snort/snort_rules_edit.php b/config/snort/snort_rules_edit.php index 7c31b017..266750fa 100644 --- a/config/snort/snort_rules_edit.php +++ b/config/snort/snort_rules_edit.php @@ -95,9 +95,25 @@ if ($_POST) { else $splitcontents[$lineid] = "# " . $_POST['code']; + //write disable/enable sid to config.xml + $sid = get_middle($splitcontents[$lineid], 'sid:', ';', 0); + if (is_numeric($sid)) { + // rule_sid_on registers + if (!empty($a_nat[$id]['rule_sid_on'])) + $a_nat[$id]['rule_sid_on'] = str_replace("||enablesid $sid", "", $a_nat[$id]['rule_sid_on']); + if (!empty($a_nat[$id]['rule_sid_on'])) + $a_nat[$id]['rule_sid_off'] = str_replace("||disablesid $sid", "", $a_nat[$id]['rule_sid_off']); + if ($_POST['highlight'] == "yes") + $a_nat[$id]['rule_sid_on'] = "||enablesid $sid" . $a_nat[$id]['rule_sid_on']; + else + $a_nat[$id]['rule_sid_off'] = "||disablesid $sid" . $a_nat[$id]['rule_sid_off']; + } + //write the new .rules file @file_put_contents($file, implode($delimiter, $splitcontents)); + write_config(); + echo "<script> opener.window.location.reload(); window.close(); </script>"; exit; } |