From patchwork Mon Mar 7 16:52:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 5320 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4KC4JY31Kdz3xgV for ; Mon, 7 Mar 2022 16:52:45 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4KC4JX3t7xzf0; Mon, 7 Mar 2022 16:52:44 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4KC4JX3K5Nz2yj9; Mon, 7 Mar 2022 16:52:44 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4KC4JW2kxkz2xKb for ; Mon, 7 Mar 2022 16:52:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4KC4JV67qyzf0; Mon, 7 Mar 2022 16:52:42 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1646671963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ewyWSgnetSAK8xwDfnzxRJtuic8oXr9Hru6A+zIjbvQ=; b=b8AxwzCPJninpKFVgHXuhbztOIw5nf6Wf2b8KveXr9YHVRnh+OadtlBfCJ1+VMUc1K4LWb 0ko8Jk6WJ+prksBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1646671963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ewyWSgnetSAK8xwDfnzxRJtuic8oXr9Hru6A+zIjbvQ=; b=f2rPSVMpCN7wax86a8rF0hR5BdVtVCoTjmpWBunEEc4GA4qwvmm/VZTACBqiM1gujXnaFo wXDrHvq9zKRn3FvCb2JD4Rqqy9wCbFvVSFia+G7IRKqKT7XRjWV/9E6mYNeY5Ag0bGqQ0O R7K7iS4n+DrGES0c6vYBv4kvFYL4sv2Ll3HFBfHOsXrkivgpjgact0B/xjP59lRZf6DeTB XsDJM0M+1IcHRWgUJM7n1hKn15vKMakcd02VzuoYVWe+iaN/bOd50t7ilaFYjrdfkHsbQ2 7I3c72uL2CqPsZf2tWx9dNjd01ZKk8mBhstuxdULfJVF8w6UPACwKY1Txk22+w== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH] ids.cgi: Only read-in ignored hosts, if the ignore file exists. Date: Mon, 7 Mar 2022 17:52:36 +0100 Message-Id: <20220307165236.2944-1-stefan.schantl@ipfire.org> In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Otherwise the CGI will crash. Signed-off-by: Stefan Schantl --- html/cgi-bin/ids.cgi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 27e61e9bb..722715667 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'} = '';