]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ids.cgi: Fix check when changing the IDS to monitor mode or drop mode.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 13 Apr 2021 16:56:49 +0000 (18:56 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Tue, 3 Aug 2021 17:25:53 +0000 (19:25 +0200)
The test condition was wrong here and therefore oinkmaster never has
been executed when this setting has been changed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index ec20e5a09f2b3a9e48e059c88215a0f5352ee320..cb79f66d2d49b35af23567db9f3d0c5dbb2f4f94 100644 (file)
@@ -603,15 +603,15 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
        # Read-in current (old) IDS settings.
        &General::readhash("$IDS::ids_settings_file", \%oldidssettings);
 
+       # Get enabled providers.
+       my @enabled_providers = &IDS::get_enabled_providers();
+
        # Prevent form name from been stored in conf file.
        delete $cgiparams{'IDS'};
 
        # Check if the IDS should be enabled.
        if ($cgiparams{'ENABLE_IDS'} eq "on") {
-               # Get enabled providers.
-               my @enabled_providers = &IDS::get_enabled_providers();
-
-               # Check if any ruleset is available. Otherwise abort and display an error.
+               # Check if at least one provider is enabled. Otherwise abort and display an error.
                unless(@enabled_providers) {
                        $errormessage = $Lang::tr{'ids no enabled ruleset provider'};
                }
@@ -660,8 +660,8 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
 
        # Check if "MONITOR_TRAFFIC_ONLY" has been changed.
        if($cgiparams{'MONITOR_TRAFFIC_ONLY'} ne $oldidssettings{'MONITOR_TRAFFIC_ONLY'}) {
-               # Check if a ruleset exists.
-               if (%used_providers) {
+               # Check if at least one provider is enabled.
+               if (@enabled_providers) {
                        # Lock the webpage and print message.
                        &working_notice("$Lang::tr{'ids working'}");