]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mda: reject multiple Message-IDs up front
authorEric Wong <e@80x24.org>
Thu, 21 Apr 2016 22:46:04 +0000 (22:46 +0000)
committerEric Wong <e@80x24.org>
Thu, 21 Apr 2016 22:46:04 +0000 (22:46 +0000)
While ssoma now documents it uses the first Message-ID, they
are confusing and could be a sign of a broken mail software,
and broken mail software is often a sign of spam...

ref: http://public-inbox.org/meta/20160421221128.4910-1-e@80x24.org/

lib/PublicInbox/MDA.pm

index 003bac659e6166ef73d29613ac372fc6cb382702..26681c2f3f10a06d5ce3b9e57081004029323525 100644 (file)
@@ -23,7 +23,9 @@ sub __drop_plus {
 sub precheck {
        my ($klass, $filter, $address) = @_;
        my Email::Simple $simple = $filter->simple;
-       my $mid = $simple->header("Message-ID");
+       my @mid = $simple->header('Message-ID');
+       return 0 if scalar(@mid) != 1;
+       my $mid = $mid[0];
        return 0 if (length($mid) > MAX_MID_SIZE);
        return 0 unless usable_str(length('<m@h>'), $mid) && $mid =~ /\@/;
        return 0 unless usable_str(length('u@h'), $filter->from);