[Bug 260700] mail/milter-greylist: handle mlmmj sender addresses correctly

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 26 Dec 2021 15:22:51 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260700

            Bug ID: 260700
           Summary: mail/milter-greylist: handle mlmmj sender addresses
                    correctly
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: freebsd@oldach.net
                CC: m.tsatsenko@gmail.com
                CC: m.tsatsenko@gmail.com
             Flags: maintainer-feedback?(m.tsatsenko@gmail.com)

Created attachment 230423
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=230423&action=edit
Remove '+' and suffix from local part

Currently, milter-greylist unconditionally strips sender addresses up to and
including the first '=' before checking against the database. This is done to
ensure mailing list sender addresses are handled correctly.

However mlmmj generates mailing list sender addresses in a different style: the
common '+' format. That yields a basically wrong mungling of sender addresses:

Dec 26 06:34:34 nuc milter-greylist[56938]: 1BQ5YQ5a068146: addr 96.47.72.81
from <oldach.net@FreeBSD.org> rcpt <freebsd@oldach.net>: autowhitelisted for
another 8760:00:00
Dec 26 06:34:34 nuc sm-mta[68146]: 1BQ5YQ5a068146:
from=<freebsd-stable+bounces-424-freebsd=oldach.net@FreeBSD.org>, size=6340,
class=0, nrcpts=1, msgid=<80df9457-886a-d5ad-23c4-98d54c4b4dcb@world.com>,
bodytype=8BITMIME, proto=ESMTPS, daemon=MTA, relay=mx2.freebsd.org
[96.47.72.81]

Here, <freebsd-stable+bounces-424-freebsd=oldach.net@FreeBSD.org> is cut down
to just <oldach.net@FreeBSD.org> (which is OK in my case as I'm the owner of
oldach.net). Actually that should better be stripped by removing the '+' part
from the local part, yielding <freebsd-stable@FreeBSD.org>.

The attached patch facilitates that (but keeps the '=' logic in place).

NB: Probably a more general sender rewriting should be implemented, e.g. by
using regex replacement.

-- 
You are receiving this mail because:
You are the assignee for the bug.