aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2021-08-03 08:04:00 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2021-08-03 16:45:01 +0000
commit191922dd097895100db92e0d103a03bdb19960f4 (patch)
treec73ddf31051feeec959254b82772abcc4a0692f3
parent6f71ba9431ede3e51e7f76fc5f55c5daff192be5 (diff)
downloadports-191922dd097895100db92e0d103a03bdb19960f4.tar.gz
ports-191922dd097895100db92e0d103a03bdb19960f4.zip
mail/mlmmj: Improve support for X-Original-From
In FreeBSD setup when emails are incoming from a domain with strong dmarc validation policy (like yahoo) mail a munged upfront by rspamd and X-Original-From is set to the original email. The initial support for X-Original-From allowed everything to work but list control, this update makes listcontrol (+help, +subscribe etc works for those domains)
-rw-r--r--mail/mlmmj/Makefile2
-rw-r--r--mail/mlmmj/files/patch-originalfromemail47
2 files changed, 40 insertions, 9 deletions
diff --git a/mail/mlmmj/Makefile b/mail/mlmmj/Makefile
index 292636766d0d..1797d99b8a2f 100644
--- a/mail/mlmmj/Makefile
+++ b/mail/mlmmj/Makefile
@@ -2,7 +2,7 @@
PORTNAME= mlmmj
PORTVERSION= 1.3.0
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= mail
MASTER_SITES= http://mlmmj.org/releases/
diff --git a/mail/mlmmj/files/patch-originalfromemail b/mail/mlmmj/files/patch-originalfromemail
index 4ee0b485e3a2..c6bc45d2f129 100644
--- a/mail/mlmmj/files/patch-originalfromemail
+++ b/mail/mlmmj/files/patch-originalfromemail
@@ -1,8 +1,21 @@
+diff --git src/listcontrol.c src/listcontrol.c
+index d0c2e14..96e98d9 100644
+--- src/listcontrol.c
++++ src/listcontrol.c
+@@ -191,7 +191,7 @@ int listcontrol(struct email_container *fromemails, const char *listdir,
+ if(fromemails->emailcount != 1 && ctrl != CTRL_BOUNCES) {
+ errno = 0;
+ log_error(LOG_ARGS, "Ignoring mail with invalid From: "
+- "which was not a bounce");
++ "which was not a bounce: %d", fromemails->emailcount);
+ return -1;
+ }
+
diff --git src/mlmmj-process.c src/mlmmj-process.c
-index 82e4d04..fee5603 100644
+index 82e4d04..a9003e7 100644
--- src/mlmmj-process.c
+++ src/mlmmj-process.c
-@@ -473,6 +473,7 @@ int main(int argc, char **argv)
+@@ -473,10 +473,12 @@ int main(int argc, char **argv)
struct stat st;
uid_t uid;
struct email_container fromemails = { 0, NULL };
@@ -10,7 +23,12 @@ index 82e4d04..fee5603 100644
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)
+ struct email_container dtemails = { 0, NULL };
++ struct email_container *testfrom = NULL;
+ struct strlist *access_rules = NULL;
+ struct strlist *delheaders = NULL;
+ struct strlist allheaders;
+@@ -488,6 +490,7 @@ int main(int argc, char **argv)
{ "Return-Path:", 0, NULL },
{ "Delivered-To:", 0, NULL },
{ "Subject:", 0, NULL },
@@ -18,7 +36,7 @@ index 82e4d04..fee5603 100644
{ NULL, 0, NULL }
};
-@@ -708,6 +710,11 @@ int main(int argc, char **argv)
+@@ -708,6 +711,11 @@ int main(int argc, char **argv)
for(i = 0; i < readhdrs[0].valuecount; i++) {
find_email_adr(readhdrs[0].values[i], &fromemails);
}
@@ -30,7 +48,20 @@ index 82e4d04..fee5603 100644
/* discard malformed mail with invalid From: unless it's a bounce */
if(fromemails.emailcount != 1 &&
(recipextra == NULL ||
-@@ -1036,7 +1043,10 @@ int main(int argc, char **argv)
+@@ -812,7 +820,11 @@ int main(int argc, char **argv)
+ log_error(LOG_ARGS, "listcontrol(from, %s, %s, %s, %s, %s, %s, %s)\n", listdir, toemails.emaillist[0], mlmmjsub, mlmmjunsub, mlmmjsend, mlmmjbounce, donemailname);
+ #endif
+ unlink(mailfile);
+- listcontrol(&fromemails, listdir, recipextra,
++ if (originalfromemails.emailcount > 0)
++ testfrom = &originalfromemails;
++ else
++ testfrom = &fromemails;
++ listcontrol(testfrom, listdir, recipextra,
+ mlmmjsub, mlmmjunsub, mlmmjsend, mlmmjbounce,
+ donemailname);
+
+@@ -1036,7 +1048,10 @@ int main(int argc, char **argv)
if(!send && (subonlypost || modonlypost || modnonsubposts)) {
/* Don't send a mail about denial to the list, but silently
* discard and exit. */
@@ -42,7 +73,7 @@ index 82e4d04..fee5603 100644
log_error(LOG_ARGS, "Discarding %s because"
" there are sender restrictions but"
" From: was the list address",
-@@ -1047,10 +1057,10 @@ int main(int argc, char **argv)
+@@ -1047,10 +1062,10 @@ int main(int argc, char **argv)
exit(EXIT_SUCCESS);
}
if(subonlypost) {
@@ -55,7 +86,7 @@ index 82e4d04..fee5603 100644
}
if(!foundaddr) {
if(modnonsubposts) {
-@@ -1086,10 +1096,10 @@ int main(int argc, char **argv)
+@@ -1086,10 +1101,10 @@ int main(int argc, char **argv)
}
MY_ASSERT(txt);
register_unformatted(txt, "subject", subject);
@@ -68,7 +99,7 @@ index 82e4d04..fee5603 100644
MY_ASSERT(queuefilename)
close_text(txt);
myfree(listaddr);
-@@ -1101,7 +1111,7 @@ int main(int argc, char **argv)
+@@ -1101,7 +1116,7 @@ int main(int argc, char **argv)
execlp(mlmmjsend, mlmmjsend,
"-L", listdir,
"-l", "1",