unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [RFC] mda: use PublicInbox::Address to extract emails
@ 2020-06-19 17:18 Eric Wong
  2020-07-07  7:15 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2020-06-19 17:18 UTC (permalink / raw)
  To: meta

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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-07  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19 17:18 [RFC] mda: use PublicInbox::Address to extract emails Eric Wong
2020-07-07  7:15 ` Eric Wong

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).