mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
ids.cgi: Add/Remove provider file include in oinkmaster providers
include file when toggeling a provider. Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
This commit is contained in:
@@ -789,6 +789,7 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
|
||||
#
|
||||
} elsif ($cgiparams{'PROVIDERS'} eq $Lang::tr{'toggle enable disable'}) {
|
||||
my %used_providers = ();
|
||||
my $provider_includes_action;
|
||||
|
||||
# Only go further, if an ID has been passed.
|
||||
if ($cgiparams{'ID'}) {
|
||||
@@ -804,11 +805,20 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
|
||||
# Grab the configured status of the corresponding entry.
|
||||
my $status = $used_providers{$id}[3];
|
||||
|
||||
# Grab the provider handle.
|
||||
my $provider_handle = $used_providers{$id}[0];
|
||||
|
||||
# Switch the status.
|
||||
if ($status eq "enabled") {
|
||||
$status = "disabled";
|
||||
|
||||
# Set the provider includes action to "remove" for removing the entry.
|
||||
$provider_includes_action = "remove";
|
||||
} else {
|
||||
$status = "enabled";
|
||||
|
||||
# Set the provider includes action to "add".
|
||||
$provider_includes_action = "add";
|
||||
}
|
||||
|
||||
# Modify the status of the existing entry.
|
||||
@@ -823,6 +833,10 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
|
||||
# Write the main providers include file.
|
||||
&IDS::write_main_used_rulefiles_file(@enabled_providers);
|
||||
|
||||
# Call function to alter the oinkmasters provider includes file and
|
||||
# add or remove the provider.
|
||||
&IDS::alter_oinkmaster_provider_includes_file($provider_includes_action, $provider_handle);
|
||||
|
||||
# Check if the IDS is running.
|
||||
if(&IDS::ids_is_running()) {
|
||||
# Gather the amount of enabled providers (elements in the array).
|
||||
|
||||
Reference in New Issue
Block a user