mail/mlmmj: fully handle X-Original-From

This update to the initial patch makes sure, the sender receives a
denial email even if the from has been munged
This commit is contained in:
Baptiste Daroussin 2021-05-26 14:09:03 +02:00
parent a18614e342
commit 56643aaceb
2 changed files with 42 additions and 7 deletions

View file

@ -2,7 +2,7 @@
PORTNAME= mlmmj
PORTVERSION= 1.3.0
PORTREVISION= 5
PORTREVISION= 6
CATEGORIES= mail
MASTER_SITES= http://mlmmj.org/releases/

View file

@ -1,5 +1,5 @@
diff --git src/mlmmj-process.c src/mlmmj-process.c
index 82e4d04..0362c7b 100644
index 82e4d04..fee5603 100644
--- src/mlmmj-process.c
+++ src/mlmmj-process.c
@@ -473,6 +473,7 @@ int main(int argc, char **argv)
@ -30,15 +30,50 @@ index 82e4d04..0362c7b 100644
/* 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)
@@ -1036,7 +1043,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. */
- if (strcasecmp(listaddr, posteraddr) == 0) {
+ char *testaddr = posteraddr;
+ if (originalfromemails.emailcount > 0)
+ testaddr = originalfromemails.emaillist[0];
+ if (strcasecmp(listaddr, testaddr) == 0) {
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)
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);
- foundaddr = is_moderator(listdir, posteraddr, NULL);
+ foundaddr = is_moderator(listdir, testaddr, NULL);
}
if(!foundaddr) {
if(modnonsubposts) {
@@ -1086,10 +1096,10 @@ int main(int argc, char **argv)
}
MY_ASSERT(txt);
register_unformatted(txt, "subject", subject);
- register_unformatted(txt, "posteraddr", posteraddr);
+ register_unformatted(txt, "posteraddr", testaddr);
register_originalmail(txt, donemailname);
queuefilename = prepstdreply(txt, listdir,
- "$listowner$", posteraddr, NULL);
+ "$listowner$", testaddr, NULL);
MY_ASSERT(queuefilename)
close_text(txt);
myfree(listaddr);
@@ -1101,7 +1111,7 @@ int main(int argc, char **argv)
execlp(mlmmjsend, mlmmjsend,
"-L", listdir,
"-l", "1",
- "-T", posteraddr,
+ "-T", testaddr,
"-F", fromaddr,
"-m", queuefilename, (char *)NULL);