git: 71daa4ae2f2b - main - mail/mlmmj: handle X-Original-From

Baptiste Daroussin bapt at FreeBSD.org
Wed May 26 11:32:22 UTC 2021


The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=71daa4ae2f2b89711db9e1a74ac8eb204adf2bf1

commit 71daa4ae2f2b89711db9e1a74ac8eb204adf2bf1
Author:     Baptiste Daroussin <bapt at FreeBSD.org>
AuthorDate: 2021-05-26 11:30:03 +0000
Commit:     Baptiste Daroussin <bapt at FreeBSD.org>
CommitDate: 2021-05-26 11:32:20 +0000

    mail/mlmmj: handle X-Original-From
    
    when used in conjonction with rspamd like on the FreeBSD mailing lists
    setup, rspamd will handle the munge of the from in case of sender of
    email with strong DMARC policy (yahoo, google), rspamd will set the
    X-Original-From field with the original email address, use it to check
    if the sender is a member of the list it is sending email to
---
 mail/mlmmj/Makefile                      |  2 +-
 mail/mlmmj/files/patch-originalfromemail | 44 ++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/mail/mlmmj/Makefile b/mail/mlmmj/Makefile
index 56d557d7f4b1..385d85e5a743 100644
--- a/mail/mlmmj/Makefile
+++ b/mail/mlmmj/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	mlmmj
 PORTVERSION=	1.3.0
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	mail
 MASTER_SITES=	http://mlmmj.org/releases/
 
diff --git a/mail/mlmmj/files/patch-originalfromemail b/mail/mlmmj/files/patch-originalfromemail
new file mode 100644
index 000000000000..b848a7c939dd
--- /dev/null
+++ b/mail/mlmmj/files/patch-originalfromemail
@@ -0,0 +1,44 @@
+diff --git src/mlmmj-process.c src/mlmmj-process.c
+index 82e4d04..c8f4add 100644
+--- src/mlmmj-process.c
++++ src/mlmmj-process.c
+@@ -473,6 +473,7 @@ int main(int argc, char **argv)
+ 	struct stat st;
+ 	uid_t uid;
+ 	struct email_container fromemails = { 0, NULL };
++	struct email_container originalfromemails = { 0, NULL };
+ 	struct email_container toemails = { 0, NULL };
+ 	struct email_container ccemails = { 0, NULL };
+ 	struct email_container rpemails = { 0, NULL };
+@@ -488,6 +489,7 @@ int main(int argc, char **argv)
+ 		{ "Return-Path:", 0, NULL },
+ 		{ "Delivered-To:", 0, NULL },
+ 		{ "Subject:", 0, NULL },
++		{ "X-Original-From", 0, NULL },
+ 		{ NULL, 0, NULL }
+ 	};
+ 
+@@ -708,6 +710,11 @@ int main(int argc, char **argv)
+ 	for(i = 0; i < readhdrs[0].valuecount; i++) {
+ 		find_email_adr(readhdrs[0].values[i], &fromemails);
+ 	}
++	/* X-Original-From: addresses */
++	for(i = 0; i < readhdrs[6].valuecount; i++) {
++		find_email_adr(readhdrs[6].values[i], &originalfromemails);
++	}
++
+ 	/* discard malformed mail with invalid From: unless it's a bounce */
+ 	if(fromemails.emailcount != 1 &&
+ 			(recipextra == NULL ||
+@@ -1047,7 +1054,10 @@ int main(int argc, char **argv)
+ 			exit(EXIT_SUCCESS);
+ 		}
+ 		if(subonlypost) {
+-			foundaddr = (is_subbed(listdir, posteraddr, 0) !=
++			char *testaddr;
++			if (originalfromemails.emailcount > 0)
++				testaddr = originalfromemails.emaillist[0];
++			foundaddr = (is_subbed(listdir, testaddr, 0) !=
+ 					SUB_NONE);
+ 		} else if (modonlypost) {
+ 			foundaddr = is_moderator(listdir, posteraddr, NULL);


More information about the dev-commits-ports-all mailing list