From 24f66b4d1c46e638edbd1af06d3705cf0767a3c7 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 7 May 2012 21:15:33 +0100 Subject: [PATCH] Add testcase for callout fallback from ESMTP to SMTP. --- src/src/smtp_in.c | 2 +- test/confs/5400 | 10 +++- test/log/5400 | 10 ++++ test/scripts/5400-cutthrough/5400 | 32 +++++++++++- test/stderr/5400 | 82 ++++++++++++++++++++++++++++--- test/stdout/5400 | 46 +++++++++++++++-- 6 files changed, 167 insertions(+), 15 deletions(-) diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 9c81579bc..db7f133ca 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -3991,7 +3991,7 @@ while (done <= 0) break; /* It is perhaps arguable as to which exit ACL should be called here, - but as it is probably a situtation that almost never arises, it + but as it is probably a situation that almost never arises, it probably doesn't matter. We choose to call the real QUIT ACL, which in some sense is perhaps "right". */ diff --git a/test/confs/5400 b/test/confs/5400 index 15690b756..8f2e8b585 100644 --- a/test/confs/5400 +++ b/test/confs/5400 @@ -13,9 +13,17 @@ gecos_name = CALLER_NAME domainlist local_domains = test.ex : *.test.ex -acl_smtp_rcpt = accept control = cutthrough_delivery +acl_smtp_rcpt = ar +# ----- ACLs ----- + +begin acl + +ar: + accept control = cutthrough_delivery + logwrite = rcpt for $local_part@$domain + # ----- Routers ----- begin routers diff --git a/test/log/5400 b/test/log/5400 index 69f769cbd..2f049f7d1 100644 --- a/test/log/5400 +++ b/test/log/5400 @@ -1,4 +1,14 @@ +1999-03-02 09:44:33 rcpt for userx@domain.com 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] 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 rcpt for userz@domain.com +1999-03-02 09:44:33 10HmaY-0005vi-00 >> userz@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] 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 Completed +1999-03-02 09:44:33 rcpt for usery@domain.com +1999-03-02 09:44:33 rcpt for userx@domain.com +1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss +1999-03-02 09:44:33 10HmaZ-0005vi-00 => usery@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] +1999-03-02 09:44:33 10HmaZ-0005vi-00 -> userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] +1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed diff --git a/test/scripts/5400-cutthrough/5400 b/test/scripts/5400-cutthrough/5400 index 843e24b30..ccf5e7429 100644 --- a/test/scripts/5400-cutthrough/5400 +++ b/test/scripts/5400-cutthrough/5400 @@ -22,6 +22,35 @@ MAIL FROM: RCPT TO: DATA +. +QUIT +**** +# cutthrough_delivery into HELO-only server +need_ipv4 +# +server PORT_S +220 SMTP only spoken here +EHLO +550 Not here, mate +HELO +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +250 Recipient OK +DATA +354 Send data +. +250 OK +QUIT +250 OK +**** +exim -d-all+acl+transport -bs +EHLO myhost.test.ex +MAIL FROM: +RCPT TO: +DATA + . QUIT **** @@ -56,9 +85,10 @@ exim -d-all+acl+transport -bs EHLO myhost.test.ex MAIL FROM: RCPT TO: -RCPT TO: +RCPT TO: DATA . QUIT **** +sleep 1 diff --git a/test/stderr/5400 b/test/stderr/5400 index c32d902b5..11c861ba7 100644 --- a/test/stderr/5400 +++ b/test/stderr/5400 @@ -3,9 +3,15 @@ configuration file is TESTSUITE/test-config admin user LOG: smtp_connection MAIN SMTP connection from CALLER +using ACL "ar" processing "accept" check control = cutthrough_delivery -accept: condition test succeeded in inline ACL +check logwrite = rcpt for $local_part@$domain + = rcpt for userx@domain.com +LOG: MAIN + rcpt for userx@domain.com +created log directory TESTSUITE/spool/log +accept: condition test succeeded in ACL "ar" ----------- start cutthrough setup ------------ Connecting to 127.0.0.1 [127.0.0.1]:1224 from ip4.ip4.ip4.ip4 ... connected SMTP<< 220 ESMTP @@ -25,9 +31,8 @@ accept: condition test succeeded in inline ACL SMTP<< 250 OK LOG: MAIN >> userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] -created log directory TESTSUITE/spool/log SMTP>> QUIT ------------ cutthrough shutdown ------------ +----------- cutthrough shutdown (delivered) ------------ LOG: MAIN <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss LOG: MAIN @@ -40,9 +45,57 @@ configuration file is TESTSUITE/test-config admin user LOG: smtp_connection MAIN SMTP connection from CALLER +using ACL "ar" processing "accept" check control = cutthrough_delivery +check logwrite = rcpt for $local_part@$domain + = rcpt for userz@domain.com +LOG: MAIN + rcpt for userz@domain.com +accept: condition test succeeded in ACL "ar" +----------- start cutthrough setup ------------ +Connecting to 127.0.0.1 [127.0.0.1]:1224 from ip4.ip4.ip4.ip4 ... connected + SMTP<< 220 SMTP only spoken here + SMTP>> EHLO myhost.test.ex + SMTP<< 550 Not here, mate + SMTP>> HELO 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 + SMTP>> DATA + SMTP<< 354 Send data + SMTP>>(nl) + SMTP>> . + SMTP<< 250 OK +LOG: MAIN + >> userz@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] + 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 >>>>>>>>>>>>>>>> +Exim version x.yz .... +configuration file is TESTSUITE/test-config +admin user +LOG: smtp_connection MAIN + SMTP connection from CALLER +using ACL "ar" +processing "accept" +check control = cutthrough_delivery +check logwrite = rcpt for $local_part@$domain + = rcpt for usery@domain.com +LOG: MAIN + rcpt for usery@domain.com +accept: condition test succeeded in ACL "ar" ----------- start cutthrough setup ------------ Connecting to 127.0.0.1 [127.0.0.1]:1224 from ip4.ip4.ip4.ip4 ... connected SMTP<< 220 ESMTP @@ -53,11 +106,16 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 from ip4.ip4.ip4.ip4 ... connected SMTP>> RCPT TO: SMTP<< 250 Recipient OK ----------- end cutthrough setup ------------ +using ACL "ar" processing "accept" check control = cutthrough_delivery -accept: condition test succeeded in inline ACL +check logwrite = rcpt for $local_part@$domain + = rcpt for userx@domain.com +LOG: MAIN + rcpt for userx@domain.com +accept: condition test succeeded in ACL "ar" SMTP>> QUIT ------------ cutthrough shutdown ------------ +----------- cutthrough shutdown (more than one recipient) ------------ LOG: MAIN <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss LOG: smtp_connection MAIN @@ -67,14 +125,15 @@ Exim version x.yz .... configuration file is TESTSUITE/test-config trusted user admin user +skipping ACL configuration - not needed >>>>>>>>>>>>>>>> Remote deliveries >>>>>>>>>>>>>>>> --------> usery@domain.com <-------- smtp transport entered usery@domain.com - userz@domain.com + userx@domain.com checking status of 127.0.0.1 127.0.0.1 [127.0.0.1]:1111 status = usable -delivering 10HmaY-0005vi-00 to 127.0.0.1 [127.0.0.1] (usery@domain.com, ...) +delivering 10HmaZ-0005vi-00 to 127.0.0.1 [127.0.0.1] (usery@domain.com, ...) 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 @@ -84,7 +143,7 @@ not using PIPELINING SMTP<< 250 Sender OK SMTP>> RCPT TO: SMTP<< 250 Recipient OK - SMTP>> RCPT TO: + SMTP>> RCPT TO: SMTP<< 250 Recipient OK SMTP>> DATA SMTP<< 354 Send data @@ -97,3 +156,10 @@ transport_check_waiting entered no messages waiting for 127.0.0.1 SMTP>> QUIT Leaving smtp transport +LOG: MAIN + => usery@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] +LOG: MAIN + -> userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] +LOG: MAIN + Completed +>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>> diff --git a/test/stdout/5400 b/test/stdout/5400 index b8cd59af3..74c2d2358 100644 --- a/test/stdout/5400 +++ b/test/stdout/5400 @@ -17,10 +17,21 @@ 250 HELP 250 OK 250 Accepted -250 Accepted 354 Enter message, ending with "." on a line by itself 250 OK id=10HmaY-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 +250 Accepted +250 Accepted +354 Enter message, ending with "." on a line by itself +250 OK id=10HmaZ-0005vi-00 +221 myhost.test.ex closing connection ******** SERVER ******** Listening on port 1224 ... @@ -43,6 +54,33 @@ Message-Id: From: CALLER_NAME Date: Tue, 2 Mar 1999 09:44:33 +0000 +. +250 OK +QUIT +250 OK +End of script +Listening on port 1224 ... +Connection request from [ip4.ip4.ip4.ip4] +220 SMTP only spoken here +EHLO myhost.test.ex +550 Not here, mate +HELO myhost.test.ex +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +250 Recipient OK +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 userz@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 @@ -68,15 +106,15 @@ MAIL FROM: 250 Sender OK RCPT TO: 250 Recipient OK -RCPT TO: +RCPT TO: 250 Recipient OK 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; Tue, 2 Mar 1999 09:44:33 +0000 -Message-Id: + id 10HmaZ-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000 +Message-Id: From: CALLER_NAME Date: Tue, 2 Mar 1999 09:44:33 +0000 -- 2.25.1