From: Stefan Schantl Date: Fri, 2 Apr 2021 07:35:42 +0000 (+0200) Subject: ids.cgi: Add/Remove provider file include in oinkmaster providers X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2df9b5f714e3416f22104c4134ee0bcfa9b982db;p=people%2Fstevee%2Fipfire-2.x.git ids.cgi: Add/Remove provider file include in oinkmaster providers include file when toggeling a provider. Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index bd1f24de1f..58bd5a6f0d 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -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).