From patchwork Sun Feb 22 19:07:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 9531 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 RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R12" (not verified)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4fJtqS619Mz3wh8 for ; Sun, 22 Feb 2026 19:10:44 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [IPv6:2001:678:b28::201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (Client CN "mail02.haj.ipfire.org", Issuer "E7" (not verified)) by mail01.ipfire.org (Postfix) with ESMTPS id 4fJtqR2rxPz5lS for ; Sun, 22 Feb 2026 19:10:43 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [IPv6:::1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4fJtqQ6160z33lj for ; Sun, 22 Feb 2026 19:10:42 +0000 (UTC) X-Original-To: development@lists.ipfire.org 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 RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R12" (not verified)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4fJtqN29Xbz2xKR for ; Sun, 22 Feb 2026 19:10:40 +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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4fJtqM1Wz4z3kQ; Sun, 22 Feb 2026 19:10:39 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1771787439; 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=1p6wnp0IiIR0c3lm3b5ejfD1oslV0bN2P1ZH97IPfJ0=; b=kh0KakxQ4rCTJud6ISW6gtjEPQ/5UUbDkLM3YGTq6msg88KJj9U/qINZ+m0AiKermxJblE SWxfFglUkYy0IDBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1771787439; 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=1p6wnp0IiIR0c3lm3b5ejfD1oslV0bN2P1ZH97IPfJ0=; b=spNMdV4FAqd2+x5ubm81IRfx0kMXOSrKP1AaYDUUrkrm/He1miksMnn8veagXVSfSiJLbu eGlX8QV2gUBupxYL/KPYSnHLk0pnWEo91DX8fHjsDclOMFY/zvBk8OePBUCjlCHXPPzzoq N7NuRm63QFcm91f3QlWCW8AQRKuaNyJAiSwgvw3XPTRM95s+f8pMvARAuh2oeVny2KjQ0O K4fFjsxLJzdP9qzpk1ySpVq74P8UpTd9j6eJWDpsXrz5WgrDRjrGuqEafivUAorOLbZMeG IMig2jW5i+hEH2LOA3hfquRJ6r/DBNe7edTQJuKUYxmMlTNufGlF1QawdT/d3A== From: Stefan Schantl To: development@lists.ipfire.org Cc: Stefan Schantl Subject: [PATCH 1/2] urlfiler: Cleanup list directory during update Date: Sun, 22 Feb 2026 20:07:52 +0100 Message-ID: <20260222190753.10632-1-stefan.schantl@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 Cleanup the directory which contains the downloaded blocklists during the update process. As the same code is used for sheduled and manual updates/list installs this also cleans up old lists when switching the lists provider. Fixes #13820. Signed-off-by: Stefan Schantl --- config/urlfilter/autoupdate.pl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/config/urlfilter/autoupdate.pl b/config/urlfilter/autoupdate.pl index 39b9b4f0b..05db6e339 100644 --- a/config/urlfilter/autoupdate.pl +++ b/config/urlfilter/autoupdate.pl @@ -7,6 +7,7 @@ # $Id: autoupdate.pl,v 1.1 2007/03/14 00:00:00 marco.s Exp $ # use strict; +use File::Path; require "/var/ipfire/general-functions.pl"; @@ -115,6 +116,7 @@ unless ($blacklist_url eq '') system("/usr/bin/squidGuard -d -c $target/update.conf -C all"); + &cleanupdbdir(); system("cp -r $target/blacklists/* $dbdir"); system("chown -R nobody.nobody $dbdir"); @@ -214,3 +216,27 @@ sub setpermissions } # ------------------------------------------------------------------- + +sub cleanupdbdir { + # Open the database directory and do a directory listing. + opendir(DIR, "$dbdir") or die "Cannot open $dbdir. $!\n"; + + # Loop through the directory. + while (my $item = readdir(DIR)) { + # Skip . and .. + next if ($item eq "."); + next if ($item eq ".."); + + # Generate absolute path. + my $abs_path = "$dbdir/$item"; + + # Skip anything which is not a directory. + next unless (-d "$abs_path"); + + # Remove the directory and the content. + &File::Path::remove_tree($abs_path); + } + + # Close directory handle. + closedir(DIR); +} From patchwork Sun Feb 22 19:07:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 9532 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) (Client CN "mail01.haj.ipfire.org", Issuer "R12" (not verified)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4fJtqY43M0z3wh8 for ; Sun, 22 Feb 2026 19:10:49 +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) (Client CN "mail02.haj.ipfire.org", Issuer "E7" (not verified)) by mail01.ipfire.org (Postfix) with ESMTPS id 4fJtqR36fCz5lX for ; Sun, 22 Feb 2026 19:10:43 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [IPv6:::1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4fJtqQ6Glkz33ll for ; Sun, 22 Feb 2026 19:10:42 +0000 (UTC) X-Original-To: development@lists.ipfire.org 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) (Client CN "mail01.haj.ipfire.org", Issuer "R12" (not verified)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4fJtqN2nzVz308h for ; Sun, 22 Feb 2026 19:10:40 +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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4fJtqN0cjnz40T; Sun, 22 Feb 2026 19:10:40 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1771787440; 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=EGkFkz6v6taffV/CkV8TK8Zd0Lp1BdMZRm1zRPESlK8=; b=l2SC/CLskndSpzcOBJuAcibt0aWNyjbpDafw80BPPQsCeOTzMZhi+BO8lc9SlXezSZ4mQf ln67tf1gwk9PlHCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1771787440; 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=EGkFkz6v6taffV/CkV8TK8Zd0Lp1BdMZRm1zRPESlK8=; b=a1nSFO87Vw5GS+gua1oK9Ba72dMCfopUNrBin1o3n1lnqkgqc+1/xEbuohh1ITNoVuMG+S YAHX0fONBMnwtMQk4apVjAvri8MH/6k8PWgtTy1vNjdiu+tOZqZgoVH789DWTL05J6Rpyp X6dPo6n8UjaqUodyt64hhahOuroq1S8exHrKSdKMCtKtymDpjTFncSEYI0Lapxdg7qez2X G1UIs7XvN2IKIeO2Q6G4aW3Jt4umHboCQ2W9UGqou4687QTiCtJ31Rru/JJjDAr9BwMDW/ VM+D+rFq1iRrpCODvisSRZZSL3vH+Duc5aPV0RHlah2yF0ZiZ5K+UzXG0TKdzA== From: Stefan Schantl To: development@lists.ipfire.org Cc: Stefan Schantl Subject: [PATCH 2/2] urlfilter: Fix syntax when calling chown Date: Sun, 22 Feb 2026 20:07:53 +0100 Message-ID: <20260222190753.10632-2-stefan.schantl@ipfire.org> In-Reply-To: <20260222190753.10632-1-stefan.schantl@ipfire.org> References: <20260222190753.10632-1-stefan.schantl@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 Signed-off-by: Stefan Schantl --- config/urlfilter/autoupdate.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/urlfilter/autoupdate.pl b/config/urlfilter/autoupdate.pl index 05db6e339..f051fec42 100644 --- a/config/urlfilter/autoupdate.pl +++ b/config/urlfilter/autoupdate.pl @@ -119,12 +119,12 @@ unless ($blacklist_url eq '') &cleanupdbdir(); system("cp -r $target/blacklists/* $dbdir"); - system("chown -R nobody.nobody $dbdir"); + system("chown -R nobody:nobody $dbdir"); &setpermissions ($dbdir); system("touch $updflagfile"); - system("chown nobody.nobody $updflagfile"); + system("chown nobody:nobody $updflagfile"); system("/etc/init.d/squid restart");