diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-03-01 20:58:00 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2016-03-03 13:25:30 +0000 |
commit | f9334a281c155709bd269771c11fc5bbf687c17b (patch) | |
tree | 6fe70438a3c12bf304319cff18d88737eff1e6f9 | |
parent | b8a7fa2dd5c9a7fec40925366743255f91fcf846 (diff) |
Cutthrough: Reflect 5xx recipient reject from target to originator
When connection not opened by verify and target hard-rejects a RCPT,
the reject was not being passed to the originating system (just the
cutthrough connection was being dropped). Fix this.
-rw-r--r-- | doc/doc-txt/ChangeLog | 3 | ||||
-rw-r--r-- | src/src/acl.c | 6 | ||||
-rw-r--r-- | src/src/functions.h | 2 | ||||
-rw-r--r-- | src/src/verify.c | 7 | ||||
-rw-r--r-- | test/confs/5400 | 1 | ||||
-rw-r--r-- | test/log/5400 | 10 | ||||
-rw-r--r-- | test/rejectlog/5400 | 2 | ||||
-rw-r--r-- | test/scripts/5400-cutthrough/5400 | 10 | ||||
-rw-r--r-- | test/stdout/5400 | 28 |
9 files changed, 34 insertions, 35 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index eab7419be..211588b40 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -183,6 +183,9 @@ JH/44 Bug 1800: The combination of a -bhc commandline option and cutthrough delivery resulted in actual delivery. Cancel cutthrough before DATA stage. +JH/45 Fix cutthrough, when connection not opened by verify and target hard- + rejects a recipient: pass the reject to the originator. + Exim version 4.86 diff --git a/src/src/acl.c b/src/src/acl.c index d508a29e7..f17e28488 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -4489,8 +4489,8 @@ and WHERE_RCPT and not yet opened conn as result of recipient-verify, and rcpt acl returned accept, and first recipient (cancel on any subsequents) open one now and run it up to RCPT acceptance. -A failed verify should cancel cutthrough request. - +A failed verify should cancel cutthrough request, +and will pass the fail to the originator. Initial implementation: dual-write to spool. Assume the rxd datastream is now being copied byte-for-byte to an open cutthrough connection. @@ -4512,7 +4512,7 @@ case ACL_WHERE_PRDR: if (host_checking_callout) /* -bhc mode */ cancel_cutthrough_connection("host-checking mode"); else if (rc == OK && cutthrough.delivery && rcpt_count > cutthrough.nrcpt) - open_cutthrough_connection(addr); + rc = open_cutthrough_connection(addr); break; case ACL_WHERE_PREDATA: diff --git a/src/src/functions.h b/src/src/functions.h index 97af70cee..53ed64345 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -280,7 +280,7 @@ extern BOOL moan_to_sender(int, error_block *, header_line *, FILE *, BOOL); extern void moan_write_from(FILE *); extern FILE *modefopen(const uschar *, const char *, mode_t); -extern void open_cutthrough_connection( address_item * addr ); +extern int open_cutthrough_connection( address_item * addr ); extern uschar *parse_extract_address(uschar *, uschar **, int *, int *, int *, BOOL); diff --git a/src/src/verify.c b/src/src/verify.c index ef95394d3..6aa425a54 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -1413,10 +1413,11 @@ return yield; /* Called after recipient-acl to get a cutthrough connection open when one was requested and a recipient-verify wasn't subsequently done. */ -void +int open_cutthrough_connection( address_item * addr ) { address_item addr2; +int rc; /* Use a recipient-verify-callout to set up the cutthrough connection. */ /* We must use a copy of the address for verification, because it might @@ -1425,12 +1426,12 @@ get rewritten. */ addr2 = *addr; HDEBUG(D_acl) debug_printf("----------- %s cutthrough setup ------------\n", rcpt_count > 1 ? "more" : "start"); -(void) verify_address(&addr2, NULL, +rc= verify_address(&addr2, NULL, vopt_is_recipient | vopt_callout_recipsender | vopt_callout_no_cache, CUTTHROUGH_CMD_TIMEOUT, -1, -1, NULL, NULL, NULL); HDEBUG(D_acl) debug_printf("----------- end cutthrough setup ------------\n"); -return; +return rc; } diff --git a/test/confs/5400 b/test/confs/5400 index 2bbe6965a..8cf757768 100644 --- a/test/confs/5400 +++ b/test/confs/5400 @@ -45,6 +45,7 @@ all: transport = ${if eq {special_tpt}{$local_part} {smtp2}{smtp}} headers_remove = X-hdr-rtr headers_add = X-hdr-rtr-new: $h_X-hdr-rtr:+++ + errors_to = "" no_more diff --git a/test/log/5400 b/test/log/5400 index ceaeb00dd..380b4e1e9 100644 --- a/test/log/5400 +++ b/test/log/5400 @@ -18,15 +18,15 @@ 1999-03-02 09:44:33 10HmbA-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss for userx@domain.com 1999-03-02 09:44:33 10HmbA-0005vi-00 Completed 1999-03-02 09:44:33 rcpt for no@domain.com +1999-03-02 09:44:33 U=CALLER F=<CALLER@myhost.test.ex> rejected RCPT <no@domain.com> 1999-03-02 09:44:33 rcpt for userx@domain.com -1999-03-02 09:44:33 10HmbB-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss for no@domain.com userx@domain.com -1999-03-02 09:44:33 10HmbB-0005vi-00 -> userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" -1999-03-02 09:44:33 10HmbB-0005vi-00 => no@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" +1999-03-02 09:44:33 10HmbB-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss for userx@domain.com +1999-03-02 09:44:33 10HmbB-0005vi-00 => userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" 1999-03-02 09:44:33 10HmbB-0005vi-00 Completed 1999-03-02 09:44:33 rcpt for userx@domain.com 1999-03-02 09:44:33 rcpt for no@domain.com -1999-03-02 09:44:33 10HmbC-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss for userx@domain.com no@domain.com -1999-03-02 09:44:33 10HmbC-0005vi-00 -> no@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" +1999-03-02 09:44:33 U=CALLER F=<CALLER@myhost.test.ex> rejected RCPT <no@domain.com> +1999-03-02 09:44:33 10HmbC-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss for userx@domain.com 1999-03-02 09:44:33 10HmbC-0005vi-00 => userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" 1999-03-02 09:44:33 10HmbC-0005vi-00 Completed 1999-03-02 09:44:33 rcpt for userx@domain.com diff --git a/test/rejectlog/5400 b/test/rejectlog/5400 new file mode 100644 index 000000000..bc0c95b18 --- /dev/null +++ b/test/rejectlog/5400 @@ -0,0 +1,2 @@ +1999-03-02 09:44:33 U=CALLER F=<CALLER@myhost.test.ex> rejected RCPT <no@domain.com> +1999-03-02 09:44:33 U=CALLER F=<CALLER@myhost.test.ex> rejected RCPT <no@domain.com> diff --git a/test/scripts/5400-cutthrough/5400 b/test/scripts/5400-cutthrough/5400 index 802cf047a..10406c255 100644 --- a/test/scripts/5400-cutthrough/5400 +++ b/test/scripts/5400-cutthrough/5400 @@ -120,8 +120,7 @@ QUIT # # cutthrough for 2 recipients in one domain # first one denied -# so we get a 2nd conn with the traditional delivery -# (for both because it's not a real verify=recipient) +# so we get a 2nd conn with the traditional delivery for the second server PORT_S 2 220 ESMTP EHLO @@ -140,8 +139,6 @@ MAIL FROM: 250 Sender OK RCPT TO: 250 ok rcpt-1 -RCPT TO: -250 ok rcpt-2 DATA 354 Send data . @@ -168,8 +165,7 @@ QUIT # # cutthrough for 2 recipients in one domain # second one denied -# so we get a 2nd conn with the traditional delivery -# (for both because it's not a real verify=recipient) +# so we get a 2nd conn with the traditional delivery of the 1st server PORT_S 2 220 ESMTP EHLO @@ -190,8 +186,6 @@ MAIL FROM: 250 Sender OK RCPT TO: 250 ok rcpt-1 -RCPT TO: -250 ok rcpt-2 DATA 354 Send data . diff --git a/test/stdout/5400 b/test/stdout/5400 index 20de2df09..9fae04fb5 100644 --- a/test/stdout/5400 +++ b/test/stdout/5400 @@ -50,7 +50,7 @@ 250-PIPELINING
250 HELP
250 OK
-250 Accepted
+550 Administrative prohibition
250 Accepted
354 Enter message, ending with "." on a line by itself
250 OK id=10HmbB-0005vi-00
@@ -63,7 +63,7 @@ 250 HELP
250 OK
250 Accepted
-250 Accepted
+550 Administrative prohibition
354 Enter message, ending with "." on a line by itself
250 OK id=10HmbC-0005vi-00
221 myhost.test.ex closing connection
@@ -255,18 +255,17 @@ Connection request from [ip4.ip4.ip4.ip4] 220 ESMTP EHLO myhost.test.ex 250 OK -MAIL FROM:<CALLER@myhost.test.ex> +MAIL FROM:<> 250 Sender OK -RCPT TO:<no@domain.com> -250 ok rcpt-1 RCPT TO:<userx@domain.com> -250 ok rcpt-2 +250 ok rcpt-1 DATA 354 Send data Received: from CALLER (helo=myhost.test.ex) by myhost.test.ex with local-esmtp (Exim x.yz) (envelope-from <CALLER@myhost.test.ex>) - id 10HmbB-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000 + id 10HmbB-0005vi-00 + for userx@domain.com; Tue, 2 Mar 1999 09:44:33 +0000 Message-Id: <E10HmbB-0005vi-00@myhost.test.ex> From: CALLER_NAME <CALLER@myhost.test.ex> Date: Tue, 2 Mar 1999 09:44:33 +0000 @@ -296,18 +295,17 @@ Connection request from [ip4.ip4.ip4.ip4] 220 ESMTP EHLO myhost.test.ex 250 OK -MAIL FROM:<CALLER@myhost.test.ex> +MAIL FROM:<> 250 Sender OK RCPT TO:<userx@domain.com> 250 ok rcpt-1 -RCPT TO:<no@domain.com> -250 ok rcpt-2 DATA 354 Send data Received: from CALLER (helo=myhost.test.ex) by myhost.test.ex with local-esmtp (Exim x.yz) (envelope-from <CALLER@myhost.test.ex>) - id 10HmbC-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000 + id 10HmbC-0005vi-00 + for userx@domain.com; Tue, 2 Mar 1999 09:44:33 +0000 Message-Id: <E10HmbC-0005vi-00@myhost.test.ex> From: CALLER_NAME <CALLER@myhost.test.ex> Date: Tue, 2 Mar 1999 09:44:33 +0000 @@ -347,7 +345,7 @@ Connection request from [ip4.ip4.ip4.ip4] 220 ESMTP EHLO myhost.test.ex 250 OK -MAIL FROM:<CALLER@myhost.test.ex> +MAIL FROM:<> 250 Sender OK RCPT TO:<userx@domain.com> 250 ok rcpt-1 @@ -372,7 +370,7 @@ Connection request from [ip4.ip4.ip4.ip4] 220 ESMTP EHLO myhost.test.ex 250 OK -MAIL FROM:<CALLER@myhost.test.ex> +MAIL FROM:<> 250 Sender OK RCPT TO:<special_tpt@domain.com> 250 ok rcpt-2 @@ -448,7 +446,7 @@ Connection request from [ip4.ip4.ip4.ip4] 220 ESMTP EHLO myhost.test.ex 250 OK -MAIL FROM:<CALLER@myhost.test.ex> +MAIL FROM:<> 250 Sender OK RCPT TO:<userx@domain.com> 250 ok rcpt-1 @@ -473,7 +471,7 @@ Connection request from [ip4.ip4.ip4.ip4] 220 ESMTP EHLO myhost.test.ex 250 OK -MAIL FROM:<CALLER@myhost.test.ex> +MAIL FROM:<> 250 Sender OK RCPT TO:<usery@special.com> 250 ok rcpt-2 |