This affected any platform not supporting "abstract" Unix-domain
sockets (i.e. not Linux).
+JH/42 Bug 2692: Harden against a peer which reneges on a 452 "too many
+ recipients" response to RCPT in a later response, with a 250. The
+ previous coding assumed this would not happen, and under PIPELINING
+ would result in both lost and duplicate recipients for a message.
+
{
DEBUG(D_transport) debug_printf("%s expect mail\n", __FUNCTION__);
count--;
- sx->pending_MAIL = FALSE;
+ sx->pending_MAIL = sx->RCPT_452 = FALSE;
if (!smtp_read_response(sx, sx->buffer, sizeof(sx->buffer),
'2', ob->command_timeout))
{
/* The address was accepted */
addr->host_used = sx->conn_args.host;
- DEBUG(D_transport) debug_printf("%s expect rcpt\n", __FUNCTION__);
+ DEBUG(D_transport) debug_printf("%s expect rcpt for %s\n", __FUNCTION__, addr->address);
if (smtp_read_response(sx, sx->buffer, sizeof(sx->buffer),
'2', ob->command_timeout))
{
if (addr->more_errno >> 8 == 52 && yield & 3)
{
- if (!sx->RCPT_452)
+ if (!sx->RCPT_452) /* initialised at MAIL-ack above */
{
DEBUG(D_transport)
debug_printf("%s: seen first 452 too-many-rcpts\n", __FUNCTION__);
}
}
}
+ if (count && !(addr = addr->next))
+ return -2;
} /* Loop for next RCPT response */
/* Update where to start at for the next block of responses, unless we
!sx->lmtp
)
{
- const uschar *s = string_printing(sx->buffer);
+ const uschar * s = string_printing(sx->buffer);
/* deconst cast ok here as string_printing was checked to have alloc'n'copied */
- conf = (s == sx->buffer)? US string_copy(s) : US s;
+ conf = s == sx->buffer ? US string_copy(s) : US s;
}
/* Process all transported addresses - for LMTP or PRDR, read a status for
- each one. */
+ each one. We used to drop out at first_addr, until someone returned a 452
+ followed by a 250... and we screwed up the accepted addresses. */
- for (address_item * addr = addrlist; addr != sx->first_addr; addr = addr->next)
+ for (address_item * addr = addrlist; addr; addr = addr->next)
{
if (addr->transport_return != PENDING_OK) continue;
--- /dev/null
+# Exim test configuration 0622
+
+SERVER=
+
+.include DIR/aux-var/std_conf_prefix
+
+primary_hostname = myhost.test.ex
+log_selector = +pipelining +received_recipients
+
+
+# ----- Main settings -----
+
+acl_smtp_connect = check_connect
+acl_smtp_rcpt = check_rcpt
+
+begin acl
+
+check_connect:
+ accept
+ logwrite = :main:New connection
+
+check_rcpt:
+ defer
+ condition = ${if eq {$acl_m0}{1}}
+ recipients = B@test.ex : C@test.ex : D@test.ex : E@test.ex : F@test.ex
+ message = 452 4.5.3 Try again
+
+ defer
+ condition = ${if eq {$acl_m0}{2}}
+ recipients = C@test.ex : D@test.ex
+ message = 452 4.5.3 Try again
+
+ warn
+ recipients = A@test.ex
+ set acl_m0 = 1
+
+ warn
+ recipients = B@test.ex
+ set acl_m0 = 2
+
+ accept
+
+
+# ----- Routers -----
+
+begin routers
+
+server:
+ driver = redirect
+ condition = ${if eq {SERVER}{server} {yes}{no}}
+ data = :blackhole:
+
+client:
+ driver = accept
+ condition = ${if eq {SERVER}{server} {no}{yes}}
+ retry_use_local_part
+ transport = send_to_server
+
+
+# ----- Transports -----
+
+begin transports
+
+send_to_server:
+ driver = smtp
+ allow_localhost
+ hosts = 127.0.0.1
+ port = PORT_D
+ max_rcpt = 0
+
+# ----- Retry -----
+
+
+begin retry
+
+* * F,5d,10s
+
+
+# End
--- /dev/null
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss for A@test.ex B@test.ex C@test.ex D@test.ex E@test.ex F@test.ex
+1999-03-02 09:44:33 10HmaX-0005vi-00 => a@test.ex <A@test.ex> R=client T=send_to_server H=127.0.0.1 [127.0.0.1] L C="250 OK id=10HmaY-0005vi-00"
+1999-03-02 09:44:33 10HmaX-0005vi-00 => b@test.ex <B@test.ex> R=client T=send_to_server H=127.0.0.1 [127.0.0.1] L C="250 OK id=10HmaZ-0005vi-00"
+1999-03-02 09:44:33 10HmaX-0005vi-00 => c@test.ex <C@test.ex> R=client T=send_to_server H=127.0.0.1 [127.0.0.1] L C="250 OK id=10HmbA-0005vi-00"
+1999-03-02 09:44:33 10HmaX-0005vi-00 -> d@test.ex <D@test.ex> R=client T=send_to_server H=127.0.0.1 [127.0.0.1] L C="250 OK id=10HmbA-0005vi-00"
+1999-03-02 09:44:33 10HmaX-0005vi-00 -> e@test.ex <E@test.ex> R=client T=send_to_server H=127.0.0.1 [127.0.0.1] L C="250 OK id=10HmaZ-0005vi-00"
+1999-03-02 09:44:33 10HmaX-0005vi-00 -> f@test.ex <F@test.ex> R=client T=send_to_server H=127.0.0.1 [127.0.0.1] L C="250 OK id=10HmaZ-0005vi-00"
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
+
+******** SERVER ********
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D
+1999-03-02 09:44:33 New connection
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<CALLER@myhost.test.ex> temporarily rejected RCPT <B@test.ex>: 452 4.5.3 Try again
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<CALLER@myhost.test.ex> temporarily rejected RCPT <C@test.ex>: 452 4.5.3 Try again
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<CALLER@myhost.test.ex> temporarily rejected RCPT <D@test.ex>: 452 4.5.3 Try again
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<CALLER@myhost.test.ex> temporarily rejected RCPT <E@test.ex>: 452 4.5.3 Try again
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<CALLER@myhost.test.ex> temporarily rejected RCPT <F@test.ex>: 452 4.5.3 Try again
+1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@myhost.test.ex H=localhost (myhost.test.ex) [127.0.0.1] P=esmtp L S=sss id=E10HmaX-0005vi-00@myhost.test.ex for A@test.ex
+1999-03-02 09:44:33 10HmaY-0005vi-00 => :blackhole: <A@test.ex> R=server
+1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<CALLER@myhost.test.ex> temporarily rejected RCPT <C@test.ex>: 452 4.5.3 Try again
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<CALLER@myhost.test.ex> temporarily rejected RCPT <D@test.ex>: 452 4.5.3 Try again
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@myhost.test.ex H=localhost (myhost.test.ex) [127.0.0.1] P=esmtp L S=sss id=E10HmaX-0005vi-00@myhost.test.ex for B@test.ex E@test.ex F@test.ex
+1999-03-02 09:44:33 10HmaZ-0005vi-00 => :blackhole: <F@test.ex> R=server
+1999-03-02 09:44:33 10HmaZ-0005vi-00 => :blackhole: <E@test.ex> R=server
+1999-03-02 09:44:33 10HmaZ-0005vi-00 => :blackhole: <B@test.ex> R=server
+1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
+1999-03-02 09:44:33 10HmbA-0005vi-00 <= CALLER@myhost.test.ex H=localhost (myhost.test.ex) [127.0.0.1] P=esmtp L S=sss id=E10HmaX-0005vi-00@myhost.test.ex for C@test.ex D@test.ex
+1999-03-02 09:44:33 10HmbA-0005vi-00 => :blackhole: <D@test.ex> R=server
+1999-03-02 09:44:33 10HmbA-0005vi-00 => :blackhole: <C@test.ex> R=server
+1999-03-02 09:44:33 10HmbA-0005vi-00 Completed
--- /dev/null
+# PIPELINING and 250 after 452 in a set of RCPT responses
+need_ipv4
+#
+exim -DSERVER=server -bd -oX PORT_D
+****
+exim -odq -t
+To: A@test.ex,B@test.ex,C@test.ex,D@test.ex,E@test.ex,F@test.ex
+
+Testing
+****
+exim -M $msg1
+****
+#
+#
+killdaemon
+no_msglog_check
+sleep 1
SMTP<< 250 Sender OK
SMTP>> RCPT TO:<userx@domain.com>
cmd buf flush ddd bytes
-sync_responses expect rcpt
+sync_responses expect rcpt for userx@domain.com
SMTP<< 250 Recipient OK
SMTP>> DATA
cmd buf flush ddd bytes
SMTP<< 250 OK
SMTP>> RCPT TO:<qq@remote>
cmd buf flush ddd bytes
-sync_responses expect rcpt
+sync_responses expect rcpt for qq@remote
SMTP<< 550 Unknown
SMTP>> QUIT
cmd buf flush ddd bytes
SMTP<< 250 OK
SMTP>> RCPT TO:<x@y>
cmd buf flush ddd bytes
-sync_responses expect rcpt
+sync_responses expect rcpt for x@y
SMTP<< 250 OK
SMTP>> QUIT
cmd buf flush ddd bytes
cmd buf flush ddd bytes
sync_responses expect mail
SMTP<< 250 OK
-sync_responses expect rcpt
+sync_responses expect rcpt for userx@test.ex
SMTP<< 550 NO
sync_responses expect data
SMTP(closed)<<
cmd buf flush ddd bytes
sync_responses expect mail
SMTP<< 250 OK
-sync_responses expect rcpt
+sync_responses expect rcpt for userb@test.ex
SMTP<< 250 Accepted
LOG: MAIN
<= CALLER@myhost.test.ex U=CALLER P=local-smtp S=sss
cmd buf flush ddd bytes
sync_responses expect mail
SMTP<< 250 OK
-sync_responses expect rcpt
+sync_responses expect rcpt for userb@test.ex
SMTP<< 250 Accepted
LOG: MAIN
<= CALLER@myhost.test.ex U=CALLER P=local-smtp S=sss
writing clr 0160/0000 cry 0000/0000
sync_responses expect mail
SMTP<< 250 mail-from accepted
-sync_responses expect rcpt
+sync_responses expect rcpt for extchange@test.ex
SMTP<< 250 rcpt-to accepted
sync_responses expect data
SMTP<< 354 data go-ahead
cmd buf flush ddd bytes
sync_responses expect mail
SMTP<< 250 OK
-sync_responses expect rcpt
+sync_responses expect rcpt for userx@domain.com
SMTP<< 250 Accepted
holding verify callout open for cutthrough delivery
----------- end cutthrough setup ------------
cmd buf flush ddd bytes
sync_responses expect mail
SMTP<< 250 OK
-sync_responses expect rcpt
+sync_responses expect rcpt for usery@domain.com
SMTP<< 250 Accepted
holding verify callout open for cutthrough delivery
----------- end cutthrough setup ------------
cmd buf flush ddd bytes
sync_responses expect mail
SMTP<< 250 OK
-sync_responses expect rcpt
+sync_responses expect rcpt for usery@domain.com
SMTP<< 250 Accepted
holding verify callout open for cutthrough delivery
----------- end cutthrough setup ------------
cmd buf flush ddd bytes
sync_responses expect mail
SMTP<< 250 OK
-sync_responses expect rcpt
+sync_responses expect rcpt for userx@domain.com
SMTP<< 250 Accepted
holding verify callout open for cutthrough delivery
----------- end cutthrough setup ------------
cmd buf flush ddd bytes
sync_responses expect mail
SMTP<< 250 OK
-sync_responses expect rcpt
+sync_responses expect rcpt for usery@domain.com
SMTP<< 250 Accepted
holding verify callout open for cutthrough delivery
----------- end cutthrough setup ------------
cmd buf flush ddd bytes
sync_responses expect mail
SMTP<< 250 OK
-sync_responses expect rcpt
+sync_responses expect rcpt for usery@domain.com
SMTP<< 250 Accepted
holding verify callout open for cutthrough delivery
----------- end cutthrough setup ------------