From patchwork Thu Mar 21 20:51:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7653 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 (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4V0yLF2n38z3wkd for ; Thu, 21 Mar 2024 20:51:33 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4V0yLC1ZcNznn; Thu, 21 Mar 2024 20:51:31 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4V0yLB53fcz32qp; Thu, 21 Mar 2024 20:51:30 +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 (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4V0yL75q4wz32qp for ; Thu, 21 Mar 2024 20:51:27 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4V0yL511N4zn8; Thu, 21 Mar 2024 20:51:24 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1711054285; 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; bh=kbJZd06lpIDdN6bG7FzA4j10RVAgHP+++sccV6udjDM=; b=98GFBXWg1LMm5F0/Bq179DDIVXlWlIXHrekQOelFbgBovwrA0QoO5h73lneS9oqdxDfSBy f3wLUsoZ2n9TPbDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1711054285; 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; bh=kbJZd06lpIDdN6bG7FzA4j10RVAgHP+++sccV6udjDM=; b=bLUz4Lx1EHx0s2a32Fj2s9cN97d2TAEKMrKZokQ+6L7Do0SYIyWhmZtK8KNcafTlrEPMe5 AsLqlB3oAT4WgF+nkGDPiskBl2hJ9qNHUoVyywrsECUzi0RHJ4LBlYK05i83EioQ//gvmj iDdFH7EtOAoSpp79QSPPuQWJbwWT21+rSvBvtkDKv34mMlV/lMzIZLE19eYsugW3Cmempf KlhzvUxC0BBxGmqav9oe30DK3YeSO/SQXSOCETbpCGma5KlIqKKAtaKzWr2rv47BkvE9eB feGr/UD5WJSk9cvEbrp7DHJdsMI1eWKhmpRuNucntpk+owDhu3irmfHIiUT1Uw== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 1/5] ids-functions.pl: Improve logic to get the cached rulesfile of a provider Date: Thu, 21 Mar 2024 21:51:14 +0100 Message-Id: <20240321205118.382948-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: H2WUGZDSFOE2UDSTLHBDZGAW2HXIA3XN X-Message-ID-Hash: H2WUGZDSFOE2UDSTLHBDZGAW2HXIA3XN X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- config/cfgroot/ids-functions.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index d97431b4a..c29a5151f 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -1027,11 +1027,14 @@ sub _store_error_message ($) { sub _get_dl_rulesfile($) { my ($provider) = @_; - # Check if the requested provider is known. - if ($IDS::Ruleset::Providers{$provider}) { - # Gather the download type for the given provider. - my $dl_type = $IDS::Ruleset::Providers{$provider}{'dl_type'}; + # Abort if the requested provider is not known. + return unless($IDS::Ruleset::Providers{$provider}); + # Try to gather the download type for the given provider. + my $dl_type = $IDS::Ruleset::Providers{$provider}{'dl_type'}; + + # Check if a download type could be grabbed. + if ($dl_type) { # Obtain the file suffix for the download file type. my $suffix = $dl_type_to_suffix{$dl_type};