From e0e7a74bde52a1aa02d1da758128722598fb6dd8 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sun, 25 Aug 2019 18:52:53 +0200 Subject: Align with legacy_6x. * Normalize include order. * Backport missed bug fixes. * Remove dead code. --- sink.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'sink.c') diff --git a/sink.c b/sink.c index 164c36d8..85680dbe 100644 --- a/sink.c +++ b/sink.c @@ -11,6 +11,8 @@ */ #include "config.h" +#include "fetchmail.h" + #include #include #include @@ -32,8 +34,6 @@ #include #include -#include "fetchmail.h" - /* for W* macros after pclose() */ #define _USE_BSD #include @@ -445,18 +445,6 @@ static int handle_smtp_report(struct query *ctl, struct msgblk *msg) responses[0] = xstrdup(smtp_response); -#ifdef __UNUSED__ - /* - * Don't do this! It can really mess you up if, for example, you're - * reporting an error with a single RCPT TO address among several; - * RSET discards the message body and it doesn't get sent to the - * valid recipients. - */ - smtp_rset(ctl); /* stay on the safe side */ - if (outlevel >= O_DEBUG) - report(stdout, GT_("Saved error is still %d\n"), smtperr); -#endif /* __UNUSED */ - /* * Note: send_bouncemail message strings are not made subject * to gettext translation because (a) they're going to be @@ -533,12 +521,6 @@ static int handle_smtp_report(struct query *ctl, struct msgblk *msg) * (b) we wouldn't want spammers to get confirmation that * this address is live, anyway. */ -#ifdef __DONT_FEED_THE_SPAMMERS__ - if (run.bouncemail) - send_bouncemail(ctl, msg, XMIT_ACCEPT, - "Invalid address in MAIL FROM (SMTP error 553).\r\n", - 1, responses); -#endif /* __DONT_FEED_THE_SPAMMERS__ */ free(responses[0]); return(PS_REFUSED); @@ -617,10 +599,6 @@ static int handle_smtp_report_without_bounce(struct query *ctl, struct msgblk *m return(PS_REFUSED); case 553: /* invalid sending domain */ -#ifdef __DONT_FEED_THE_SPAMMERS__ - if (run.bouncemail) - return(PS_SUCCESS); -#endif /* __DONT_FEED_THE_SPAMMERS__ */ return(PS_REFUSED); default: @@ -1185,6 +1163,16 @@ static int open_mda_sink(struct query *ctl, struct msgblk *msg, for (dp = after, sp = before; (*dp = *sp); dp++, sp++) { if (sp[0] != '%') continue; + if (sp > before && sp[-1] == '\'') { + report(stderr, GT_("MDA option contains single-quoted %%%c expansion.\n"), sp[1]); + report(stderr, GT_("Refusing to deliver. Check the manual and fix your mda option.\n")); + free(before); + free(after); + if (from) free(from); + if (names) free(names); + return PS_SYNTAX; + } + /* need to expand? BTW, no here overflow, because in ** the worst case (end of string) sp[1] == '\0' */ if (sp[1] == 's' || sp[1] == 'T') { -- cgit v1.2.3