]> Sergey Matveev's repositories - public-inbox.git/commitdiff
precheck: require Message-ID to be set
authorEric Wong <normalperson@yhbt.net>
Tue, 25 Feb 2014 22:26:35 +0000 (22:26 +0000)
committerEric Wong <normalperson@yhbt.net>
Tue, 25 Feb 2014 22:26:35 +0000 (22:26 +0000)
Valid emails should not arrive without a Message-ID.

lib/PublicInbox.pm
t/precheck.t

index 899027be36765ece7e2b16a62f7e6d6f919b8b69..56137d1404986175f03c5a018607a6184eebdf68 100644 (file)
@@ -16,8 +16,10 @@ sub __drop_plus {
 # do not allow Bcc, only Cc and To if ORIGINAL_RECIPIENT (postfix) env is set
 sub precheck {
        my ($klass, $filter) = @_;
+       my $simple = $filter->simple;
+       return 0 unless $simple->header("Message-ID");
        return 0 unless defined($filter->from);
-       return 0 if length($filter->simple->as_string) > MAX_SIZE;
+       return 0 if length($simple->as_string) > MAX_SIZE;
        recipient_specified($filter);
 }
 
index 6deead9843bc194ec7cbb4190b94c77f84fd23ba..f9d61d8ef13e19211e281a7581e53df54e0a7550 100644 (file)
@@ -38,6 +38,7 @@ sub do_checks {
                        Cc => 'c@example.com',
                        'Content-Type' => 'text/plain',
                        Subject => 'this is a subject',
+                       'Message-ID' => '<MID>',
                ],
                body => "hello world\n",
        ));
@@ -51,6 +52,7 @@ sub do_checks {
                        Cc => 'John Doe <c@example.com>',
                        'Content-Type' => 'text/plain',
                        Subject => 'this is a subject',
+                       'Message-ID' => '<MID>',
                ],
                body => "hello world\n",
        ));
@@ -64,6 +66,7 @@ sub do_checks {
                        Cc => 'c@example.com',
                        'Content-Type' => 'text/plain',
                        Subject => 'this is a subject',
+                       'Message-ID' => '<MID>',
                ],
                body => "hello world\n",
        );