From b8a7fa2dd5c9a7fec40925366743255f91fcf846 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 1 Mar 2016 19:23:14 +0000 Subject: [PATCH] Testsuite: testcases for rejected rcpt-callout-triggered cutthrough --- doc/doc-docbook/spec.xfpt | 6 ++- test/confs/5401 | 2 +- test/log/5401 | 5 ++ test/rejectlog/5401 | 2 + test/runtest | 2 +- test/scripts/5400-cutthrough/5401 | 87 ++++++++++++++++++++++++++++++- test/stderr/5401 | 43 --------------- test/stdout/5401 | 86 ++++++++++++++++++++++++++++++ 8 files changed, 186 insertions(+), 47 deletions(-) create mode 100644 test/rejectlog/5401 delete mode 100644 test/stderr/5401 diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index c61d7a2e8..a67f48675 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -28646,7 +28646,11 @@ and data is copied from one to the other. An attempt to set this option for any recipient but the first for a mail will be quietly ignored. -If a recipient-verify callout connection is subsequently +If a recipient-verify callout +.new +(with use_sender) +.wen +connection is subsequently requested in the same ACL it is held open and used for any subsequent recipients and the data, otherwise one is made after the initial RCPT ACL completes. diff --git a/test/confs/5401 b/test/confs/5401 index 2263bc0bf..636a3b614 100644 --- a/test/confs/5401 +++ b/test/confs/5401 @@ -22,7 +22,7 @@ begin acl acl_rcpt: accept control = cutthrough_delivery - verify = recipient + verify = recipient/callout=use_sender # ----- Routers ----- diff --git a/test/log/5401 b/test/log/5401 index 37ad46794..dc4027b47 100644 --- a/test/log/5401 +++ b/test/log/5401 @@ -1,3 +1,8 @@ 1999-03-02 09:44:33 10HmaX-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 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed +1999-03-02 09:44:33 U=CALLER F= rejected RCPT : response to "RCPT TO:" from 127.0.0.1 [127.0.0.1] was: 550 No mate +1999-03-02 09:44:33 U=CALLER F= rejected RCPT : response to "RCPT TO:" from 127.0.0.1 [127.0.0.1] was: 550 Not that one +1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss +1999-03-02 09:44:33 10HmaY-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 10HmaY-0005vi-00 Completed diff --git a/test/rejectlog/5401 b/test/rejectlog/5401 new file mode 100644 index 000000000..abcc5c6a6 --- /dev/null +++ b/test/rejectlog/5401 @@ -0,0 +1,2 @@ +1999-03-02 09:44:33 U=CALLER F= rejected RCPT : response to "RCPT TO:" from 127.0.0.1 [127.0.0.1] was: 550 No mate +1999-03-02 09:44:33 U=CALLER F= rejected RCPT : response to "RCPT TO:" from 127.0.0.1 [127.0.0.1] was: 550 Not that one diff --git a/test/runtest b/test/runtest index 96f5c11e9..1431e5754 100755 --- a/test/runtest +++ b/test/runtest @@ -1972,7 +1972,7 @@ if (/^sleep\s+(.*)$/) # Various Unix management commands are recognized if (/^(ln|ls|du|mkdir|mkfifo|touch|cp|cat)\s/ || - /^sudo (rmdir|rm|chown|chmod)\s/) + /^sudo\s(rmdir|rm|chown|chmod)\s/) { run_system("$_ >>test-stdout 2>>test-stderr"); return 1; diff --git a/test/scripts/5400-cutthrough/5401 b/test/scripts/5400-cutthrough/5401 index d92110ce5..726d1f29e 100644 --- a/test/scripts/5400-cutthrough/5401 +++ b/test/scripts/5400-cutthrough/5401 @@ -16,7 +16,7 @@ DATA QUIT 250 OK **** -exim -d-all+acl+transport -bs +exim -bs -odf EHLO myhost.test.ex MAIL FROM: RCPT TO: @@ -25,3 +25,88 @@ DATA . QUIT **** +# +# +# +# cutthrough for denied recipient +# deny should be reflected to originator +# as this was a real rcpt-verify +server PORT_S +220 ESMTP +EHLO +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +550 No mate +QUIT +250 OK +*eof +**** +exim -bs -odf +EHLO myhost.test.ex +MAIL FROM: +RCPT TO: +QUIT +**** +# +# +# lose the cached callout fail record +sudo rm DIR/spool/db/callout +# +# cutthrough for 2 recipients in one domain +# first one denied +# so we get a 3rd conn with the traditional delivery +# (for just the second because it was a real verify=recipient) +server PORT_S 3 +220 ESMTP +EHLO +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +550 Not that one +QUIT +250 OK +*eof +220 ESMTP +EHLO +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +250 ok rcpt-1 +QUIT +250 OK +*eof +220 ESMTP +EHLO +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +250 ok rcpt-1 +DATA +354 Send data +. +250 OK +QUIT +250 OK +*eof +**** +# +# Foregound delivery needed else the following subtest reception logging happens before this ones +# delivery process logs and terminates; the interlock is only on the parent exim terminating. +exim -bs -odf +EHLO myhost.test.ex +MAIL FROM: +RCPT TO: +RCPT TO: +DATA + +. +QUIT +**** +# +# +# diff --git a/test/stderr/5401 b/test/stderr/5401 deleted file mode 100644 index 1b42441d9..000000000 --- a/test/stderr/5401 +++ /dev/null @@ -1,43 +0,0 @@ -Exim version x.yz .... -configuration file is TESTSUITE/test-config -admin user -LOG: smtp_connection MAIN - SMTP connection from CALLER -using ACL "acl_rcpt" -processing "accept" -check control = cutthrough_delivery -check verify = recipient ------------ end verify ------------ -accept: condition test succeeded in ACL "acl_rcpt" -end of ACL "acl_rcpt": ACCEPT ------------ start cutthrough setup ------------ -Connecting to 127.0.0.1 [127.0.0.1]:1224 from ip4.ip4.ip4.ip4 ... connected - SMTP<< 220 ESMTP - SMTP>> EHLO myhost.test.ex - SMTP<< 250 OK - SMTP>> MAIL FROM: - SMTP<< 250 Sender OK - SMTP>> RCPT TO: - SMTP<< 250 Recipient OK ------------ end cutthrough setup ------------ -processing "accept" -accept: condition test succeeded in inline ACL -end of inline ACL: ACCEPT - SMTP>> DATA - SMTP<< 354 Send data ------------ start cutthrough headers send ----------- ------------ done cutthrough headers send ------------ - SMTP>> . - SMTP<< 250 OK -LOG: MAIN - >> userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" -created log directory TESTSUITE/spool/log - SMTP>> QUIT ------------ cutthrough shutdown (delivered) ------------ -LOG: MAIN - <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss -LOG: MAIN - Completed -LOG: smtp_connection MAIN - SMTP connection from CALLER closed by QUIT ->>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>> diff --git a/test/stdout/5401 b/test/stdout/5401 index 1ceb0bffb..c0089f856 100644 --- a/test/stdout/5401 +++ b/test/stdout/5401 @@ -9,6 +9,29 @@ 354 Enter message, ending with "." on a line by itself 250 OK id=10HmaX-0005vi-00 221 myhost.test.ex closing connection +220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +250-myhost.test.ex Hello CALLER at myhost.test.ex +250-SIZE 52428800 +250-8BITMIME +250-PIPELINING +250 HELP +250 OK +550-Callout verification failed: +550 550 No mate +221 myhost.test.ex closing connection +220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +250-myhost.test.ex Hello CALLER at myhost.test.ex +250-SIZE 52428800 +250-8BITMIME +250-PIPELINING +250 HELP +250 OK +550-Callout verification failed: +550 550 Not that one +250 Accepted +354 Enter message, ending with "." on a line by itself +250 OK id=10HmaY-0005vi-00 +221 myhost.test.ex closing connection ******** SERVER ******** Listening on port 1224 ... @@ -36,3 +59,66 @@ Date: Tue, 2 Mar 1999 09:44:33 +0000 QUIT 250 OK End of script +Listening on port 1224 ... +Connection request from [ip4.ip4.ip4.ip4] +220 ESMTP +EHLO myhost.test.ex +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +550 No mate +QUIT +250 OK +Expected EOF read from client +End of script +Listening on port 1224 ... +Connection request from [ip4.ip4.ip4.ip4] +220 ESMTP +EHLO myhost.test.ex +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +550 Not that one +QUIT +250 OK +Expected EOF read from client +Listening on port 1224 ... +Connection request from [ip4.ip4.ip4.ip4] +220 ESMTP +EHLO myhost.test.ex +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +250 ok rcpt-1 +QUIT +250 OK +Expected EOF read from client +Listening on port 1224 ... +Connection request from [ip4.ip4.ip4.ip4] +220 ESMTP +EHLO myhost.test.ex +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +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 ) + id 10HmaY-0005vi-00 + for userx@domain.com; Tue, 2 Mar 1999 09:44:33 +0000 +Message-Id: +From: CALLER_NAME +Date: Tue, 2 Mar 1999 09:44:33 +0000 + +. +250 OK +QUIT +250 OK +Expected EOF read from client +End of script -- 2.30.2