From: Stefan Schantl Date: Mon, 6 Apr 2020 12:34:21 +0000 (+0200) Subject: ids.cgi: Fix logic if suricata needs to be restarted. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1622e5c1f3781f1b6e370cb540ecabe17383acad;p=people%2Fpmueller%2Fipfire-2.x.git ids.cgi: Fix logic if suricata needs to be restarted. Signed-off-by: Stefan Schantl Signed-off-by: Arne Fitzenreiter --- diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index c3e5eefdbc..f76aade493 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -417,17 +417,17 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'save'}) { # Loop through the hash of idsrules. foreach my $rulefile(keys %idsrules) { + # Check if the state of the rulefile has been changed. + unless ($cgiparams{$rulefile} eq $idsrules{$rulefile}{'Rulefile'}{'State'}) { + # A restart of suricata is required to apply the changes of the used rulefiles. + $suricata_restart_required = 1; + } + # Check if the rulefile is enabled. if ($cgiparams{$rulefile} eq "on") { # Add rulefile to the array of enabled rulefiles. push(@enabled_rulefiles, $rulefile); - # Check if the state of the rulefile has been changed. - unless ($cgiparams{$rulefile} eq $idsrules{$rulefile}{'Rulefile'}{'State'}) { - # A restart of suricata is required to apply the changes of the used rulefiles. - $suricata_restart_required = 1; - } - # Drop item from cgiparams hash. delete $cgiparams{$rulefile}; }