From patchwork Sat Dec 11 18:01:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller?= X-Patchwork-Id: 4916 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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4JBFwL28dxz3wt3 for ; Sat, 11 Dec 2021 18:02:10 +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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4JBFwK6fF2zdJ; Sat, 11 Dec 2021 18:02:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4JBFwK5Jqvz2xgV; Sat, 11 Dec 2021 18:02:09 +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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4JBFwH5rRCz2xd7 for ; Sat, 11 Dec 2021 18:02:07 +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 4JBFwG5Zt5zN7 for ; Sat, 11 Dec 2021 18:02:06 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1639245727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QPaAboTVUwdatLeO6KlzKHtgIQVezEoIcOFjRwyLvNY=; b=tS2StFNB26zCwhiMFnT/zzwzY0SQpc2IJILA8MBdGhIUwRoUM00S41jbRlkDJP7IHyBh5u AzANFhRbkcZBtBAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1639245727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QPaAboTVUwdatLeO6KlzKHtgIQVezEoIcOFjRwyLvNY=; b=CNUYg+t4eV+rQFwNvUt3Oba3UczXTzBEeYFy0E8eJoN3ifu+VtrwFSpYCTm38WOJ0FiAq+ BZOsRJYmzLG1k6oDB1FD/52h/LpV1k3Lg91M1AeZkD+/akttcfAAwvvYItvnfw+5tipQNd +kcOrbF4COzvd7iNuOEG8en9RAIp0v4hcS7DHZedSDv8vD7ZD7a+VD3nCSUAR9Tp2gVcL1 P6OeP6wCZE05Uni+9JXu7NnLFNhfG/Ac0yIN3LwTfmEn0f1Oe1CeP8VkZXdP0DRIEpWtrm cW4wZXcSjr8JlkDT86Cs5YN1sePaRRGu8nuoKGQm1Q+BJOyY3vhOt/G/0XH5Nw== To: "IPFire: Location" From: =?utf-8?q?Peter_M=C3=BCller?= Subject: [PATCH] location-importer: Set "is_drop" to "True" even in case of conflicts Message-ID: <19b33f2c-e801-24be-0c3c-ea2a667109b2@ipfire.org> Date: Sat, 11 Dec 2021 19:01:54 +0100 MIME-Version: 1.0 Content-Language: en-US X-BeenThere: location@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: location-bounces@lists.ipfire.org Sender: "Location" Previously, any present override for a given network or ASN would have caused the SQL statement not to conduct anything at all. Since "is_drop" is the only flag being actually set here, it makes sense to do so in case of already present overrides as well. The effect of this is limited: Our own override files are always considered at last, so in case of conflicts they will be the ultima ratio. This is an intended behaviour, but slipped my mind when I filed bug #12728, so this patch can only be seen as a partial solution - the rest is not a bug, but a feature. :-) Partially fixes: #12728 Signed-off-by: Peter Müller --- src/python/location-importer.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/location-importer.in b/src/python/location-importer.in index b791b4d..b3e3658 100644 --- a/src/python/location-importer.in +++ b/src/python/location-importer.in @@ -1320,7 +1320,7 @@ class CLI(object): source, is_drop ) VALUES (%s, %s, %s) - ON CONFLICT (network) DO NOTHING""", + ON CONFLICT (network) DO UPDATE SET is_drop = True""", "%s" % network, "Spamhaus DROP lists", True @@ -1368,7 +1368,7 @@ class CLI(object): source, is_drop ) VALUES (%s, %s, %s) - ON CONFLICT (number) DO NOTHING""", + ON CONFLICT (number) DO UPDATE SET is_drop = True""", "%s" % asn, "Spamhaus ASN-DROP list", True