about summary refs log tree commit homepage
path: root/examples
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-07 13:06:57 +0000
committerEric Wong <e@80x24.org>2016-06-07 13:14:10 +0000
commit4d507f66b73b3bb286810387a480087cf9b63e6e (patch)
treecaa726d729f99a4f752cc3ae09512962a49dc02d /examples
parent3f779258173530ca88f31e1dc5332f951d2c44cd (diff)
downloadpublic-inbox-4d507f66b73b3bb286810387a480087cf9b63e6e.tar.gz
We don't want people following links from archivers and
breaking archival.
Diffstat (limited to 'examples')
-rw-r--r--examples/unsubscribe.milter19
1 files changed, 8 insertions, 11 deletions
diff --git a/examples/unsubscribe.milter b/examples/unsubscribe.milter
index eb1717ba..c245a5b8 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;