user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] unsubscribe.milter: implement archive blacklist
  @ 2016-06-07 13:21  7%   ` Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-06-07 13:21 UTC (permalink / raw)
  To: meta

We don't want people following links from archivers and
breaking archival.
---
 examples/unsubscribe.milter | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/examples/unsubscribe.milter b/examples/unsubscribe.milter
index eb1717b..c245a5b 100644
--- a/examples/unsubscribe.milter
+++ b/examples/unsubscribe.milter
@@ -72,16 +72,13 @@ $cbs{header} = sub {
 	SMFIS_CONTINUE;
 };
 
-# only whitelist a few users for testing:
-my $whitelist = '/etc/unsubscribe-milter.whitelist';
-my %TEST_WHITELIST = map { $_ => 1 } eval {
-		open my $fh, '<', $whitelist or
-			die "Failed to open $whitelist: $!";
-		local $/ = "\n";
-		chomp(my @lines = (<$fh>));
-		@lines;
-	};
-die "No whitelist at $whitelist\n" unless scalar keys %TEST_WHITELIST;
+# We don't want people unsubscribing archivers:
+sub archive_addr {
+	my ($addr) = @_;
+	return 1 if ($addr =~ /\@m\.gmane\.org\z/);
+	return 1 if ($addr eq 'archive@mail-archive.com');
+	0
+}
 
 $cbs{eom} = sub {
 	my ($ctx) = @_;
@@ -92,7 +89,7 @@ $cbs{eom} = sub {
 
 		# one recipient, one unique HTTP(S) URL
 		return SMFIS_CONTINUE if @rcpt != 1;
-		return SMFIS_CONTINUE unless $TEST_WHITELIST{$rcpt[0]};
+		return SMFIS_CONTINUE if archive_addr(lc($rcpt[0]));
 
 		my $unsub = $priv->{header}->{'list-unsubscribe'} || [];
 		my $n = 0;

^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-05-20 21:36     [PATCH] unsubscribe: get off mah lawn^H^H^Hist Eric Wong
2016-06-07 13:18     ` Merge branch 'unsubscribe' Eric Wong
2016-06-07 13:21  7%   ` [PATCH] unsubscribe.milter: implement archive blacklist Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).