From 376595057ba05eea8d9c6337d390374dec7749e0 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Tue, 12 Dec 2017 20:16:26 +0100 Subject: [PATCH] ids.cgi: Always write config files for enabled/disabled rule files If a single sid has been activated and then disabled without doing any other ruleset modifications only one of the oinkmaster files for enabled / disabled rules has been modified. In this case it was possible, that the same sid, was part of the file for enabled rules and part of the file for disabled rules at the same time. Signed-off-by: Stefan Schantl --- html/cgi-bin/ids.cgi | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 8a6e51b1d4..dcf821888b 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -182,42 +182,42 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'update'}) { } } - # Check if the enabled_sids array contains any sid's. - if (@enabled_sids) { - # Open enabled sid's file for writing. - open(FILE, ">$enabled_sids_file") or die "Could not write to $enabled_sids_file. $!\n"; + # Open enabled sid's file for writing. + open(FILE, ">$enabled_sids_file") or die "Could not write to $enabled_sids_file. $!\n"; - # Write header to file. - print FILE "#Autogenerated file. Any custom changes will be overwritten!\n"; + # Write header to file. + print FILE "#Autogenerated file. Any custom changes will be overwritten!\n"; + # Check if the enabled_sids array contains any sid's. + if (@enabled_sids) { # Loop through the array of enabled sids and write them to the file. foreach my $sid (@enabled_sids) { - print FILE "enable_sid $sid\n"; + print FILE "enablesid $sid\n"; } - - # Close file after writing. - close(FILE); } - # Check if the enabled_sids array contains any sid's. - if (@disabled_sids) { - # Open disabled sid's file for writing. - open(FILE, ">$disabled_sids_file") or die "Could not write to $disabled_sids_file. $!\n"; + # Close file after writing. + close(FILE); - # Write header to file. - print FILE "#Autogenerated file. Any custom changes will be overwritten!\n"; + # Open disabled sid's file for writing. + open(FILE, ">$disabled_sids_file") or die "Could not write to $disabled_sids_file. $!\n"; - # Loop through the array of disabled sids and write them to the file. - foreach my $sid (@disabled_sids) { - print FILE "disable_sid $sid\n"; - } + # Write header to file. + print FILE "#Autogenerated file. Any custom changes will be overwritten!\n"; - # Close file after writing. - close(FILE); - } + # Check if the enabled_sids array contains any sid's. + if (@disabled_sids) { + # Loop through the array of disabled sids and write them to the file. + foreach my $sid (@disabled_sids) { + print FILE "disablesid $sid\n"; + } + } + + # Close file after writing. + close(FILE); # Open file for used rulefiles. - open (FILE, ">$snortusedrulefilesfile") or die "Could not wirte to $snortusedrulefilesfile. $!\n"; + open (FILE, ">$snortusedrulefilesfile") or die "Could not write to $snortusedrulefilesfile. $!\n"; # Write header to file. print FILE "#Autogenerated file. Any custom changes will be overwritten!\n"; -- 2.39.5