From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [RFC] mda: use PublicInbox::Address to extract emails
Date: Fri, 19 Jun 2020 17:18:47 +0000 [thread overview]
Message-ID: <20200619171847.7852-1-e@yhbt.net> (raw)
I'm not sure why this wasn't done in Jun/July 2016 when I was
working on PublicInbox::Address to replace the DoS-vulnerable
Email::Address.
Nowadays, PublicInbox::Address allows using Email::Address::XS
which should be fast and robust.
---
lib/PublicInbox/MDA.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/MDA.pm b/lib/PublicInbox/MDA.pm
index 57b436b9..fa4a2ad8 100644
--- a/lib/PublicInbox/MDA.pm
+++ b/lib/PublicInbox/MDA.pm
@@ -6,6 +6,7 @@ package PublicInbox::MDA;
use strict;
use warnings;
use PublicInbox::MsgTime;
+use PublicInbox::Address;
use constant MAX_SIZE => 1024 * 500; # same as spamc default, should be tunable
use constant MAX_MID_SIZE => 244; # max term size - 1 in Xapian
@@ -62,7 +63,7 @@ sub alias_specified {
} @address;
foreach my $line ($simple->header('Cc'), $simple->header('To')) {
- my @addrs = ($line =~ /([^,<\s]+\@[^,>\s]+)/g);
+ my @addrs = PublicInbox::Address::emails($line);
foreach my $addr (@addrs) {
if ($ok{lc(__drop_plus($addr))}) {
return 1;
next reply other threads:[~2020-06-19 17:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 17:18 Eric Wong [this message]
2020-07-07 7:15 ` [RFC] mda: use PublicInbox::Address to extract emails Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200619171847.7852-1-e@yhbt.net \
--to=e@yhbt.net \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).