[exim-cvs] Early-pipe: retry without pipelining on first-res…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] Early-pipe: retry without pipelining on first-response failure
Gitweb: https://git.exim.org/exim.git/commitdiff/4ca005cdf526b0c6803c29a154bd85dc112bc6a3
Commit:     4ca005cdf526b0c6803c29a154bd85dc112bc6a3
Parent:     691ca88ca06899e02e77cb28fbf075de450607bc
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Mar 10 17:06:26 2020 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Mar 10 17:06:26 2020 +0000


    Early-pipe: retry without pipelining on first-response failure
---
 doc/doc-txt/ChangeLog                    |  4 +++
 src/src/transports/smtp.c                |  6 +++-
 test/confs/4060                          |  2 +-
 test/log/4062                            | 52 ++++++++++++++++++++------------
 test/scripts/4062-pipe-conn-openssl/4062 | 20 ++++++++++--
 5 files changed, 59 insertions(+), 25 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 7e0fbf7..001f919 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -143,6 +143,10 @@ JH/28 Bug 2533: Fix expansion of ${tr } item.  When called in some situations
 JH/29 Bug 2537: Fix $mime_part_count.  When a single connection had a non-mime
       message following a mime one, the variable was not reset.


+JH/30 When an pipelined-connect fails at the first response, assume incorrect
+      cached capability (perhaps the peer reneged?) and immediately retry in
+      non-pipelined mode.
+


 Exim version 4.93
 -----------------
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index 13410b8..6f99909 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -2079,6 +2079,7 @@ if (!continue_hostname)
     else DEBUG(D_transport)
       debug_printf("helo needs $sending_ip_address\n");


+PIPE_CONNECT_RETRY:
   if (sx->early_pipe_active)
     sx->outblock.conn_args = &sx->conn_args;
   else
@@ -2425,7 +2426,10 @@ if (  smtp_peer_options & OPTION_TLS
     {
     HDEBUG(D_transport)
       debug_printf("failed reaping pipelined cmd responses\n");
-    goto RESPONSE_FAILED;
+    close(sx->cctx.sock);
+    sx->cctx.sock = -1;
+    sx->early_pipe_active = FALSE;
+    goto PIPE_CONNECT_RETRY;
     }
 #endif


diff --git a/test/confs/4060 b/test/confs/4060
index 1916770..f3aa84d 100644
--- a/test/confs/4060
+++ b/test/confs/4060
@@ -34,7 +34,7 @@ tls_require_ciphers = NORMAL:-KX-ALL:+RSA
tls_require_ciphers = DEFAULT:!kECDHE
.endif

-pipelining_connect_advertise_hosts = *
+pipelining_connect_advertise_hosts = CONTROL
log_selector = +received_recipients +millisec +pipelining
queue_only

diff --git a/test/log/4062 b/test/log/4062
index f436a0d..d3b90c4 100644
--- a/test/log/4062
+++ b/test/log/4062
@@ -1,54 +1,66 @@
-2017-07-30 18:51:05.712 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for a@???
+2017-07-30 18:51:05.712 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for nocache@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmaX-0005vi-00 => a@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L C="250 OK id=10HmaY-0005vi-00"
+2017-07-30 18:51:05.712 10HmaX-0005vi-00 => nocache@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L C="250 OK id=10HmaY-0005vi-00"
2017-07-30 18:51:05.712 10HmaX-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmaZ-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for b@???
+2017-07-30 18:51:05.712 10HmaZ-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for hascache@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmaZ-0005vi-00 => b@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L* C="250 OK id=10HmbA-0005vi-00"
+2017-07-30 18:51:05.712 10HmaZ-0005vi-00 => hascache@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L* C="250 OK id=10HmbA-0005vi-00"
2017-07-30 18:51:05.712 10HmaZ-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbB-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for c@???
+2017-07-30 18:51:05.712 10HmbB-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for client_no@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbB-0005vi-00 => c@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L C="250 OK id=10HmbC-0005vi-00"
+2017-07-30 18:51:05.712 10HmbB-0005vi-00 => client_no@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L C="250 OK id=10HmbC-0005vi-00"
2017-07-30 18:51:05.712 10HmbB-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbD-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for nocache@???
+2017-07-30 18:51:05.712 10HmbD-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for server_oops@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbD-0005vi-00 => nocache@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L K C="250- 3nn byte chunk, total 3nn\\n250 OK id=10HmbE-0005vi-00"
+2017-07-30 18:51:05.712 10HmbD-0005vi-00 => server_oops@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L C="250 OK id=10HmbE-0005vi-00"
2017-07-30 18:51:05.712 10HmbD-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbF-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for chunking@???
+2017-07-30 18:51:05.712 10HmbF-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for nocache@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbF-0005vi-00 => chunking@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L* K C="250- 3nn byte chunk, total 3nn\\n250 OK id=10HmbG-0005vi-00"
+2017-07-30 18:51:05.712 10HmbF-0005vi-00 => nocache@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L K C="250- 3nn byte chunk, total 3nn\\n250 OK id=10HmbG-0005vi-00"
2017-07-30 18:51:05.712 10HmbF-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
+2017-07-30 18:51:05.712 10HmbH-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for chunking@???
+2017-07-30 18:51:05.712 Start queue run: pid=pppp
+2017-07-30 18:51:05.712 10HmbH-0005vi-00 => chunking@??? R=client T=smtp H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no L* K C="250- 3nn byte chunk, total 3nn\\n250 OK id=10HmbI-0005vi-00"
+2017-07-30 18:51:05.712 10HmbH-0005vi-00 Completed
+2017-07-30 18:51:05.712 End queue run: pid=pppp

******** SERVER ********
2017-07-30 18:51:05.712 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D
-2017-07-30 18:51:05.712 10HmaY-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L. X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmaX-0005vi-00@??? for a@???
+2017-07-30 18:51:05.712 10HmaY-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L. X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmaX-0005vi-00@??? for nocache@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmaY-0005vi-00 => :blackhole: <a@???> R=server
+2017-07-30 18:51:05.712 10HmaY-0005vi-00 => :blackhole: <nocache@???> R=server
2017-07-30 18:51:05.712 10HmaY-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbA-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L* X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmaZ-0005vi-00@??? for b@???
+2017-07-30 18:51:05.712 10HmbA-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L* X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmaZ-0005vi-00@??? for hascache@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbA-0005vi-00 => :blackhole: <b@???> R=server
+2017-07-30 18:51:05.712 10HmbA-0005vi-00 => :blackhole: <hascache@???> R=server
2017-07-30 18:51:05.712 10HmbA-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbC-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L. X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmbB-0005vi-00@??? for c@???
+2017-07-30 18:51:05.712 10HmbC-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L. X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmbB-0005vi-00@??? for client_no@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbC-0005vi-00 => :blackhole: <c@???> R=server
+2017-07-30 18:51:05.712 10HmbC-0005vi-00 => :blackhole: <client_no@???> R=server
2017-07-30 18:51:05.712 10HmbC-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
2017-07-30 18:51:05.712 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D
-2017-07-30 18:51:05.712 10HmbE-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L. X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no K S=sss id=E10HmbD-0005vi-00@??? for nocache@???
+2017-07-30 18:51:05.712 SMTP protocol synchronization error (input sent without waiting for greeting): rejected connection from H=[127.0.0.1] input="EHLO the.local.host.name\r\nSTARTTLS\r\n"
+2017-07-30 18:51:05.712 10HmbE-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmbD-0005vi-00@??? for server_oops@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbE-0005vi-00 => :blackhole: <nocache@???> R=server
+2017-07-30 18:51:05.712 10HmbE-0005vi-00 => :blackhole: <server_oops@???> R=server
2017-07-30 18:51:05.712 10HmbE-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbG-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L* X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no K S=sss id=E10HmbF-0005vi-00@??? for chunking@???
+2017-07-30 18:51:05.712 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D
+2017-07-30 18:51:05.712 10HmbG-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L. X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no K S=sss id=E10HmbF-0005vi-00@??? for nocache@???
2017-07-30 18:51:05.712 Start queue run: pid=pppp
-2017-07-30 18:51:05.712 10HmbG-0005vi-00 => :blackhole: <chunking@???> R=server
+2017-07-30 18:51:05.712 10HmbG-0005vi-00 => :blackhole: <nocache@???> R=server
2017-07-30 18:51:05.712 10HmbG-0005vi-00 Completed
2017-07-30 18:51:05.712 End queue run: pid=pppp
+2017-07-30 18:51:05.712 10HmbI-0005vi-00 <= CALLER@??? H=localhost (the.local.host.name) [127.0.0.1] P=esmtps L* X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no K S=sss id=E10HmbH-0005vi-00@??? for chunking@???
+2017-07-30 18:51:05.712 Start queue run: pid=pppp
+2017-07-30 18:51:05.712 10HmbI-0005vi-00 => :blackhole: <chunking@???> R=server
+2017-07-30 18:51:05.712 10HmbI-0005vi-00 Completed
+2017-07-30 18:51:05.712 End queue run: pid=pppp
diff --git a/test/scripts/4062-pipe-conn-openssl/4062 b/test/scripts/4062-pipe-conn-openssl/4062
index bd0fe57..6f1dfcb 100644
--- a/test/scripts/4062-pipe-conn-openssl/4062
+++ b/test/scripts/4062-pipe-conn-openssl/4062
@@ -4,7 +4,7 @@
exim -bd -DSERVER=server -oX PORT_D
****
#
-exim a@???
+exim nocache@???
Subject test 1

****
@@ -16,7 +16,7 @@ exim -DNOTDAEMON -DSERVER=server -q
#
#
# Go for it. This one should do early-pipelinng.
-exim b@???
+exim hascache@???
Subject test 2

****
@@ -28,7 +28,7 @@ exim -DNOTDAEMON -DSERVER=server -q
#
# Check that client doesn't try when not told to, even now there is
# a cache entry
-exim c@???
+exim client_no@???
Subject test 3

****
@@ -40,6 +40,20 @@ exim -DNOTDAEMON -DSERVER=server -q
#
killdaemon
#
+# Check what happens when the server suddenly does not support it
+# and we have cached info saying it does
+exim -bd -DSERVER=server -DCONTROL=: -oX PORT_D
+****
+exim server_oops@???
+Subject test 3_2
+
+****
+exim -q
+****
+exim -DNOTDAEMON -DSERVER=server -q
+****
+killdaemon
+#
#
# And again with CHUNKING
sudo rm DIR/spool/db/misc