]> git.ipfire.org Git - people/pmueller/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>
Sun, 19 Dec 2021 12:23:45 +0000 (13:23 +0100)
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 1f8e09a6c839eb6d2b365f5dee63de40472212a2..77293c02018a4dc5301e74bcb88fafdc38c4e186 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'}");