From 63cf95af3fc91bc3f92e053a08875106ef391eed Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Wed, 14 Apr 2021 20:18:47 +0200 Subject: [PATCH] ids.cgi: Introduce remove_provider(). This function is used to remove a configured provider by it's ID. Signed-off-by: Stefan Schantl --- html/cgi-bin/ids.cgi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 582b9aa681..b3a7d9f522 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -2062,6 +2062,24 @@ sub get_provider_name($) { return $provider_name; } +# +## Function to remove a provider by a given ID. +# +sub remove_provider($) { + my ($id) = @_; + + my %used_providers = (); + + # Read-in provider settings file. + &General::readhasharray($IDS::providers_settings_file, \%used_providers); + + # Drop entry from the hash. + delete($used_providers{$id}); + + # Write the changed hash to the provider settings file. + &General::writehasharray($IDS::providers_settings_file, \%used_providers); +} + # ## Private function to convert a given rulefile to a category name. ## ( No file extension anymore and if the name contained a dot, it -- 2.39.5