From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C519F1F406 for ; Sat, 25 Nov 2023 01:05:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1700874356; bh=2A6Otq2c+ysUf2oPKTcKq2I0YeUbWdsa0c0fiks1emg=; h=From:To:Subject:Date:From; b=sW1qApyb1sdzva06ya+2tj7/tbaWTvAGOIA1D0cuXdTYzJrMV90nvuAmh90enzBOS TIKgxymsoXrWqYEBw5/ObWdJ5/oHj9QHv43RcwB3YaJYXyvUi3mv3ZZxsVdfRCpl6s tmVkPiU7emt+arSx/iXieDr7Y9jR+i+GkWDxNroo= From: Eric Wong To: test@public-inbox.org Subject: [PATCH] unsubscribe.milter Date: Sat, 25 Nov 2023 01:05:56 +0000 Message-ID: <20231125010556.15435-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --- examples/unsubscribe.milter | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/unsubscribe.milter b/examples/unsubscribe.milter index 8bad8bd5..fc76cc54 100644 --- a/examples/unsubscribe.milter +++ b/examples/unsubscribe.milter @@ -33,8 +33,8 @@ if (open my $fh, '<', $allow_domains) { local $/ = "\n"; chomp(my @l = <$fh>); die "close: $!" unless eof($fh) && close($fh); - my %ad = map { lc($_) => 1 } @l; - $ALLOW_DOMAINS = \%ad; + my %l = map { lc($_) => 1 } @l; + $ALLOW_DOMAINS = \%l; } else { warn <getpriv; $ctx->setpriv({ header => {}, envrcpt => {} }); + my @rcpt = keys %{$priv->{envrcpt}}; + if ($ALLOW_ADDR) { + my $x = $ctx->getsymval('{daemon_addr}'); + return SMFIS_CONTINUE if $x && $x !~ /$ALLOW_ADDR/; + } # one recipient, one unique HTTP(S) URL return SMFIS_CONTINUE if @rcpt != 1;