From: Stefan Schantl Date: Mon, 7 Mar 2022 16:52:36 +0000 (+0100) Subject: ids.cgi: Only read-in ignored hosts, if the ignore file exists. X-Git-Tag: v2.27-core165~15^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fad7d1c4c606ffcc1e86d94ea5ec2ab2cf4e2831;p=ipfire-2.x.git ids.cgi: Only read-in ignored hosts, if the ignore file exists. Otherwise the CGI will crash. Signed-off-by: Stefan Schantl Signed-off-by: Michael Tremer --- diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 27e61e9bb5..7227156671 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -103,7 +103,7 @@ if (($cgiparams{'WHITELIST'} eq $Lang::tr{'add'}) || ($cgiparams{'WHITELIST'} eq my $new_entry_remark = $cgiparams{'IGNORE_ENTRY_REMARK'}; # Read-in ignoredfile. - &General::readhasharray($IDS::ignored_file, \%ignored); + &General::readhasharray($IDS::ignored_file, \%ignored) if (-e $IDS::ignored_file); # Check if we should edit an existing entry and got an ID. if (($cgiparams{'WHITELIST'} eq $Lang::tr{'update'}) && ($cgiparams{'ID'})) { @@ -165,7 +165,7 @@ if (($cgiparams{'WHITELIST'} eq $Lang::tr{'add'}) || ($cgiparams{'WHITELIST'} eq undef($cgiparams{'ID'}); # Read-in ignoredfile. - &General::readhasharray($IDS::ignored_file, \%ignored); + &General::readhasharray($IDS::ignored_file, \%ignored) if (-e $IDS::ignored_file); # Grab the configured status of the corresponding entry. my $status = $ignored{$id}[2]; @@ -199,7 +199,7 @@ if (($cgiparams{'WHITELIST'} eq $Lang::tr{'add'}) || ($cgiparams{'WHITELIST'} eq my %ignored = (); # Read-in ignoredfile. - &General::readhasharray($IDS::ignored_file, \%ignored); + &General::readhasharray($IDS::ignored_file, \%ignored) if (-e $IDS::ignored_file); # Drop entry from the hash. delete($ignored{$cgiparams{'ID'}}); @@ -1071,7 +1071,7 @@ sub show_mainpage() { } # Read-in ignored hosts. - &General::readhasharray("$IDS::settingsdir/ignored", \%ignored); + &General::readhasharray("$IDS::ignored_file", \%ignored) if (-e $IDS::ignored_file); $checked{'ENABLE_IDS'}{'off'} = ''; $checked{'ENABLE_IDS'}{'on'} = '';