]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
ids.cgi: Read-in providers settings file when neccessary.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 23 Mar 2021 16:37:33 +0000 (17:37 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:22:58 +0000 (13:22 +0100)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index 739e48eaa29b0fee9e13c18bdc4d63ec2d671f49..668dc7bcbd94140b79c0087bd59f69d8a0208022 100644 (file)
@@ -52,9 +52,6 @@ my %ignored=();
 # the list of zones in an array.
 my @network_zones = &Network::get_available_network_zones();
 
-# Grab all used ruleset providers.
-&General::readhasharray($IDS::providers_settings_file, \%used_providers);
-
 # Check if openvpn is started and add it to the array of network zones.
 if ( -e "/var/run/openvpn.pid") {
        push(@network_zones, "ovpn");
@@ -670,6 +667,11 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'save'}) {
        }
 
 } elsif (($cgiparams{'PROVIDERS'} eq "$Lang::tr{'add'}") || ($cgiparams{'PROVIDERS'} eq "$Lang::tr{'update'}")) {
+       my %used_providers = ();
+
+       # Read-in providers settings file.
+       &General::readhasharray("$IDS::providers_settings_file", \%used_providers);
+
        # Assign some nice human-readable values.
        my $provider = $cgiparams{'PROVIDER'};
        my $subscription_code = $cgiparams{'SUBSCRIPTION_CODE'};
@@ -781,8 +783,9 @@ sub show_display_error_message() {
 ## Function to display the main IDS page.
 #
 sub show_mainpage() {
-       # Read-in idssettings .
+       # Read-in idssettings and provider settings.
        &General::readhash("$IDS::ids_settings_file", \%idssettings);
+       &General::readhasharray("$IDS::providers_settings_file", \%used_providers);
 
        # If no autoupdate intervall has been configured yet, set default value.
        unless(exists($idssettings{'AUTOUPDATE_INTERVAL'})) {
@@ -1368,8 +1371,12 @@ END
 ## Function to show section for add/edit a provider.
 #
 sub show_add_provider() {
+       my %used_providers = ();
        my @subscription_providers;
 
+       # Read -in providers settings file.
+       &General::readhasharray("$IDS::providers_settings_file", \%used_providers);
+
        # Get all supported ruleset providers.
        my @ruleset_providers = &IDS::get_ruleset_providers();