]> Pileus Git - ~andy/fetchmail/blobdiff - sink.c
Attempt merging from 6.3.24.
[~andy/fetchmail] / sink.c
diff --git a/sink.c b/sink.c
index 8da89f4d22bfef75818deddc8a741db198f764eb..5e9bef9864eb80f6ae3bac880a33b582be8a1e55 100644 (file)
--- a/sink.c
+++ b/sink.c
@@ -116,12 +116,12 @@ int smtp_setup(struct query *ctl)
        oldphase = phase;
        phase = LISTENER_WAIT;
 
+       set_timeout(ctl->server.timeout);
        for (idp = ctl->smtphunt; idp; idp = idp->next)
        {
            char        *cp;
            const char  *portnum = SMTP_PORT;
 
-           set_timeout(ctl->server.timeout);
            ctl->smtphost = idp->id;  /* remember last host tried. */
            if (ctl->smtphost[0]=='/')
            {
@@ -169,7 +169,6 @@ int smtp_setup(struct query *ctl)
             * so it's safest not to assume the socket will still be good.
             */
            smtp_close(ctl, 0);
-           set_timeout(ctl->server.timeout);
 
            /* if opening for ESMTP failed, try SMTP */
            if (ctl->smtphost[0]=='/')
@@ -1151,6 +1150,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') {