[exim-cvs] Testsuite cases for basic cutthrough_delivery.

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Exim Git Commits Mailing List
Date:  
À: exim-cvs
Sujet: [exim-cvs] Testsuite cases for basic cutthrough_delivery.
Gitweb: http://git.exim.org/exim.git/commitdiff/528fde2aff25fbe284332ad2ec4b8cb5fc8c7859
Commit:     528fde2aff25fbe284332ad2ec4b8cb5fc8c7859
Parent:     e4bdf6524e2611c6bc0279b33037c31eec6daa35
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Apr 29 18:22:56 2012 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Mon Jun 4 14:57:02 2012 +0100


    Testsuite cases for basic cutthrough_delivery.


    Also fixed bug where a predata acl was required for cutthrough.
---
 src/src/smtp_in.c                 |    8 ++-
 test/confs/5400                   |   42 +++++++++++++++
 test/confs/5401                   |   50 ++++++++++++++++++
 test/log/5400                     |    3 +
 test/log/5401                     |    3 +
 test/scripts/5400-cutthrough/5400 |   64 +++++++++++++++++++++++
 test/scripts/5400-cutthrough/5401 |   27 ++++++++++
 test/stderr/5400                  |  104 +++++++++++++++++++++++++++++++++++++
 test/stderr/5401                  |   38 +++++++++++++
 test/stdout/5400                  |   83 +++++++++++++++++++++++++++++
 test/stdout/5401                  |   35 ++++++++++++
 11 files changed, 454 insertions(+), 3 deletions(-)


diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 38162cd..9652a06 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -3773,12 +3773,14 @@ while (done <= 0)
       }


     /* If there is an ACL, re-check the synchronization afterwards, since the
-    ACL may have delayed. */
+    ACL may have delayed.  To handle cutthrough delivery enforce a dummy call
+    to get the DATA command sent. */


-    if (acl_smtp_predata == NULL) rc = OK; else
+    if (acl_smtp_predata == NULL && cutthrough_fd < 0) rc = OK; else
       {
+      uschar * acl= acl_smtp_predata ? acl_smtp_predata : US"accept";
       enable_dollar_recipients = TRUE;
-      rc = acl_check(ACL_WHERE_PREDATA, NULL, acl_smtp_predata, &user_msg,
+      rc = acl_check(ACL_WHERE_PREDATA, NULL, acl, &user_msg,
         &log_msg);
       enable_dollar_recipients = FALSE;
       if (rc == OK && !check_sync()) goto SYNC_FAILURE;
diff --git a/test/confs/5400 b/test/confs/5400
new file mode 100644
index 0000000..15690b7
--- /dev/null
+++ b/test/confs/5400
@@ -0,0 +1,42 @@
+# Exim test configuration 5400
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+rfc1413_query_timeout = 0s
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+# ----- Main settings -----
+
+domainlist local_domains = test.ex : *.test.ex
+
+acl_smtp_rcpt = accept control = cutthrough_delivery
+
+
+# ----- Routers -----
+
+begin routers
+
+all:
+  driver = manualroute
+  domains = ! +local_domains
+  route_list = * 127.0.0.1
+  self = send
+  transport = smtp
+  no_more
+
+
+# ----- Transports -----
+
+begin transports
+
+smtp:
+  driver = smtp
+  interface = HOSTIPV4
+  port = PORT_S
+
+
+# End
diff --git a/test/confs/5401 b/test/confs/5401
new file mode 100644
index 0000000..db018a6
--- /dev/null
+++ b/test/confs/5401
@@ -0,0 +1,50 @@
+# Exim test configuration 5401
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+rfc1413_query_timeout = 0s
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+# ----- Main settings -----
+
+domainlist local_domains = test.ex : *.test.ex
+
+acl_smtp_rcpt = acl_rcpt
+
+# ----- ACLs -------
+
+begin acl
+
+acl_rcpt:
+    accept    control = cutthrough_delivery
+            verify = recipient
+
+
+# ----- Routers -----
+
+begin routers
+
+all:
+  driver = manualroute
+  domains = ! +local_domains
+  route_list = * 127.0.0.1
+  self = send
+  transport = smtp
+  no_more
+
+
+# ----- Transports -----
+
+begin transports
+
+smtp:
+  driver = smtp
+  interface = HOSTIPV4
+  port = PORT_S
+
+
+# End
diff --git a/test/log/5400 b/test/log/5400
new file mode 100644
index 0000000..6d38a37
--- /dev/null
+++ b/test/log/5400
@@ -0,0 +1,3 @@
+1999-03-02 09:44:33 10HmaX-0005vi-00 >> userx@??? R=all T=smtp
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local-esmtp S=sss
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
diff --git a/test/log/5401 b/test/log/5401
new file mode 100644
index 0000000..6d38a37
--- /dev/null
+++ b/test/log/5401
@@ -0,0 +1,3 @@
+1999-03-02 09:44:33 10HmaX-0005vi-00 >> userx@??? R=all T=smtp
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local-esmtp S=sss
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
diff --git a/test/scripts/5400-cutthrough/5400 b/test/scripts/5400-cutthrough/5400
new file mode 100644
index 0000000..4aa332b
--- /dev/null
+++ b/test/scripts/5400-cutthrough/5400
@@ -0,0 +1,64 @@
+# cutthrough_delivery basic operation
+need_ipv4
+#
+server PORT_S
+220 ESMTP
+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:<eximtest@???>
+RCPT TO:<userx@???>
+DATA
+
+.
+QUIT
+****
+# cutthrough cancelled by multiple recipients
+server PORT_S 2
+220 ESMTP
+HELO
+250 OK
+MAIL FROM:
+250 Sender OK
+RCPT TO:
+250 Recipient OK
+QUIT
+*eof
+220 ESMTP
+EHLO
+250 OK
+MAIL FROM:
+250 Sender OK
+RCPT TO:
+250 Recipient 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:<eximtest@???>
+RCPT TO:<userx@???>
+RCPT TO:<usery@???>
+DATA
+
+.
+QUIT
+****
diff --git a/test/scripts/5400-cutthrough/5401 b/test/scripts/5400-cutthrough/5401
new file mode 100644
index 0000000..6104a7a
--- /dev/null
+++ b/test/scripts/5400-cutthrough/5401
@@ -0,0 +1,27 @@
+# cutthrough_delivery triggered by recipient-verify
+need_ipv4
+#
+server PORT_S
+220 ESMTP
+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:<eximtest@???>
+RCPT TO:<userx@???>
+DATA
+
+.
+QUIT
+****
diff --git a/test/stderr/5400 b/test/stderr/5400
new file mode 100644
index 0000000..c8331e5
--- /dev/null
+++ b/test/stderr/5400
@@ -0,0 +1,104 @@
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+admin user
+LOG: smtp_connection MAIN
+  SMTP connection from CALLER
+processing "accept"
+check control = cutthrough_delivery
+accept: condition test succeeded in inline ACL
+----------- start cutthrough setup ------------
+Connecting to 127.0.0.1 [127.0.0.1]:1224 from ip4.ip4.ip4.ip4 ... connected
+  SMTP<< 220 ESMTP
+  SMTP>> HELO myhost.test.ex
+  SMTP<< 250 OK
+  SMTP>> MAIL FROM:<CALLER@???>
+  SMTP<< 250 Sender OK
+  SMTP>> RCPT TO:<userx@???>
+  SMTP<< 250 Recipient OK
+----------- end cutthrough setup ------------
+processing "accept"
+accept: condition test succeeded in inline ACL
+  SMTP>> DATA
+  SMTP<< 354 Send data
+  SMTP>> .
+  SMTP<< 250 OK
+----------- cutthrough close ------------
+LOG: MAIN
+  >> userx@??? R=all T=smtp
+created log directory TESTSUITE/spool/log
+LOG: MAIN
+  <= CALLER@??? 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
+processing "accept"
+check control = cutthrough_delivery
+accept: condition test succeeded in inline ACL
+----------- start cutthrough setup ------------
+Connecting to 127.0.0.1 [127.0.0.1]:1224 from ip4.ip4.ip4.ip4 ... connected
+  SMTP<< 220 ESMTP
+  SMTP>> HELO myhost.test.ex
+  SMTP<< 250 OK
+  SMTP>> MAIL FROM:<CALLER@???>
+  SMTP<< 250 Sender OK
+  SMTP>> RCPT TO:<userx@???>
+  SMTP<< 250 Recipient OK
+----------- end cutthrough setup ------------
+processing "accept"
+check control = cutthrough_delivery
+accept: condition test succeeded in inline ACL
+  SMTP>> QUIT
+----------- cutthrough shutdown ------------
+LOG: MAIN
+  <= CALLER@??? U=CALLER P=local-esmtp S=sss
+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
+trusted user
+admin user
+>>>>>>>>>>>>>>>> Remote deliveries >>>>>>>>>>>>>>>>
+--------> userx@??? <--------
+smtp transport entered
+  userx@???
+  usery@???
+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] (userx@???, ...)
+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
+not using PIPELINING
+  SMTP>> MAIL FROM:<CALLER@???>
+  SMTP<< 250 Sender OK
+  SMTP>> RCPT TO:<userx@???>
+  SMTP<< 250 Recipient OK
+  SMTP>> RCPT TO:<usery@???>
+  SMTP<< 250 Recipient OK
+  SMTP>> DATA
+  SMTP<< 354 Send data
+  SMTP>> writing message and terminating "."
+writing data block fd=dddd size=sss timeout=300
+  SMTP<< 250 OK
+ok=1 send_quit=1 send_rset=0 continue_more=0 yield=0 first_address is NULL
+transport_check_waiting entered
+  sequence=1 local_max=500 global_max=-1
+no messages waiting for 127.0.0.1
+  SMTP>> QUIT
+Leaving smtp transport
+LOG: MAIN
+  => userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1]
+LOG: MAIN
+  -> usery@??? 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/stderr/5401 b/test/stderr/5401
new file mode 100644
index 0000000..dc02c05
--- /dev/null
+++ b/test/stderr/5401
@@ -0,0 +1,38 @@
+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"
+----------- start cutthrough setup ------------
+Connecting to 127.0.0.1 [127.0.0.1]:1224 from ip4.ip4.ip4.ip4 ... connected
+  SMTP<< 220 ESMTP
+  SMTP>> HELO myhost.test.ex
+  SMTP<< 250 OK
+  SMTP>> MAIL FROM:<CALLER@???>
+  SMTP<< 250 Sender OK
+  SMTP>> RCPT TO:<userx@???>
+  SMTP<< 250 Recipient OK
+----------- end cutthrough setup ------------
+processing "accept"
+accept: condition test succeeded in inline ACL
+  SMTP>> DATA
+  SMTP<< 354 Send data
+  SMTP>> .
+  SMTP<< 250 OK
+----------- cutthrough close ------------
+LOG: MAIN
+  >> userx@??? R=all T=smtp
+created log directory TESTSUITE/spool/log
+LOG: MAIN
+  <= CALLER@??? 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/5400 b/test/stdout/5400
new file mode 100644
index 0000000..a6c813b
--- /dev/null
+++ b/test/stdout/5400
@@ -0,0 +1,83 @@
+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-PIPELINING
+250 HELP
+250 OK
+250 Accepted
+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-PIPELINING
+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
+
+******** SERVER ********
+Listening on port 1224 ... 
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+HELO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@???>
+250 Sender OK
+RCPT TO:<userx@???>
+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 <CALLER@???>)
+    id 10HmaX-0005vi-00
+    for userx@???; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@???>
+From: CALLER_NAME <CALLER@???>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+.
+250 OK
+Unexpected EOF read from client
+Listening on port 1224 ... 
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+HELO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@???>
+250 Sender OK
+RCPT TO:<userx@???>
+250 Recipient OK
+QUIT
+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:<CALLER@???>
+250 Sender OK
+RCPT TO:<userx@???>
+250 Recipient OK
+RCPT TO:<usery@???>
+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 <CALLER@???>)
+    id 10HmaY-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaY-0005vi-00@???>
+From: CALLER_NAME <CALLER@???>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+.
+250 OK
+QUIT
+250 OK
+End of script
diff --git a/test/stdout/5401 b/test/stdout/5401
new file mode 100644
index 0000000..79b7d73
--- /dev/null
+++ b/test/stdout/5401
@@ -0,0 +1,35 @@
+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-PIPELINING
+250 HELP
+250 OK
+250 Accepted
+354 Enter message, ending with "." on a line by itself
+250 OK id=10HmaX-0005vi-00
+221 myhost.test.ex closing connection
+
+******** SERVER ********
+Listening on port 1224 ... 
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+HELO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@???>
+250 Sender OK
+RCPT TO:<userx@???>
+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 <CALLER@???>)
+    id 10HmaX-0005vi-00
+    for userx@???; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@???>
+From: CALLER_NAME <CALLER@???>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+.
+250 OK
+Unexpected EOF read from client