From: Jeremy Harris Date: Sat, 15 Apr 2017 15:22:52 +0000 (+0100) Subject: Transport: fix smtp under combo of mua_wrapper and limited max_rcpt X-Git-Tag: exim-4_90_RC1~191 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4c2471caf34b901ee481cd1e742b3620e734b16b;p=exim.git Transport: fix smtp under combo of mua_wrapper and limited max_rcpt --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index b6c9e3986..93fc3da4e 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -49,6 +49,10 @@ JH/06 Default openssl_options to include +no_ticket, to reduce load on peers. PP/03 Add $SOURCE_DATE_EPOCH support for reproducible builds, per spec at . +JH/07 Fix smtp transport use of limited max_rcpt under mua_wrapper. Previously + the check for any unsuccessful recipients did not notice the limit, and + erroneously found still-pending ones. + Exim version 4.89 ----------------- diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index a5f8665e1..997281901 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -796,7 +796,9 @@ with an address by scanning for the next address whose status is PENDING_DEFER. while (count-- > 0) { - while (addr->transport_return != PENDING_DEFER) addr = addr->next; + while (addr->transport_return != PENDING_DEFER) + if (!(addr = addr->next)) + return -2; /* The address was accepted */ addr->host_used = sx->host; @@ -2475,7 +2477,8 @@ for (addr = sx->first_addr, address_count = 0; ? dsn_support_yes : dsn_support_no; address_count++; - no_flush = pipelining_active && !sx->verify && (!mua_wrapper || addr->next); + no_flush = pipelining_active && !sx->verify + && (!mua_wrapper || addr->next && address_count < sx->max_rcpt); build_rcptcmd_options(sx, addr); @@ -2781,13 +2784,15 @@ else if (mua_wrapper) { - address_item *badaddr; - for (badaddr = sx.first_addr; badaddr; badaddr = badaddr->next) - if (badaddr->transport_return != PENDING_OK) + address_item * a; + unsigned cnt; + + for (a = sx.first_addr, cnt = 0; a && cnt < sx.max_rcpt; a = a->next, cnt++) + if (a->transport_return != PENDING_OK) { /*XXX could we find a better errno than 0 here? */ - set_errno_nohost(addrlist, 0, badaddr->message, FAIL, - testflag(badaddr, af_pass_message)); + set_errno_nohost(addrlist, 0, a->message, FAIL, + testflag(a, af_pass_message)); sx.ok = FALSE; break; }