Cutthrough: fix for port-number defined by router. Bug 2229
authorJeremy Harris <jgh146exb@wizmail.org>
Fri, 26 Jan 2018 18:40:41 +0000 (18:40 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Fri, 26 Jan 2018 20:05:56 +0000 (20:05 +0000)
doc/doc-txt/ChangeLog
src/src/verify.c
test/confs/5407 [new file with mode: 0644]
test/log/5407 [new file with mode: 0644]
test/scripts/5400-cutthrough/5407 [new file with mode: 0644]
test/stdout/5407 [new file with mode: 0644]

index facdece8369a71acb3a25b00a71adf7cfd1d98a1..7d577dbcb3fa6fdef7fb426871853685ee766410 100644 (file)
@@ -67,6 +67,10 @@ JH/12 Bug 2230: Fix cutthrough routing for nonfirst messages in an initiating
       multiple onward connections in sequence, handling cutthrough connection
       for all multi-message initiating connections.
 
+JH/13 Bug 2229: Fix cutthrough routing for nonstandard port numbers defined by
+      routers.  Previously, a multi-recipient message would fail to match the
+      onward-connection opened for the first recipient, and cause its closure.
+
 
 Exim version 4.90
 -----------------
index dd54518480fbc8962588064aa9fa126dd78a16b4..eb479d44005f9b796637e85c1e50d6645f2b54ac 100644 (file)
@@ -388,18 +388,21 @@ if (addr->transport == cutthrough.addr.transport)
 
       host_af = Ustrchr(host->address, ':') ? AF_INET6 : AF_INET;
 
-      if (!smtp_get_interface(tf->interface, host_af, addr, &interface,
-             US"callout") ||
-         !smtp_get_port(tf->port, addr, &port, US"callout"))
+      if (  !smtp_get_interface(tf->interface, host_af, addr, &interface,
+             US"callout")
+        || !smtp_get_port(tf->port, addr, &port, US"callout")
+        )
        log_write(0, LOG_MAIN|LOG_PANIC, "<%s>: %s", addr->address,
          addr->message);
 
+      smtp_port_for_connect(host, port);
+
       if (  (  interface == cutthrough.interface
            || (  interface
               && cutthrough.interface
               && Ustrcmp(interface, cutthrough.interface) == 0
            )  )
-        && port == cutthrough.host.port
+        && host->port == cutthrough.host.port
         )
        {
        uschar * resp = NULL;
diff --git a/test/confs/5407 b/test/confs/5407
new file mode 100644 (file)
index 0000000..0d41b0b
--- /dev/null
@@ -0,0 +1,52 @@
+# Exim test configuration 5407
+
+# any options on the cutthrough_delivery control
+CONTROL=
+
+# optional verify-callout
+OPT=
+
+.include DIR/aux-var/std_conf_prefix
+
+primary_hostname = myhost.test.ex
+
+log_selector = +received_recipients
+queue_only
+
+# ----- Main settings -----
+
+domainlist local_domains = test.ex : *.test.ex
+
+acl_smtp_rcpt = ar
+
+
+# ----- ACLs -----
+
+begin acl
+
+ar:
+  accept
+       control = cutthrough_deliveryCONTROL
+       OPT
+       logwrite = rcpt for $local_part@$domain
+
+# ----- Routers -----
+
+begin routers
+
+all:
+  driver =     manualroute
+  domains =    ! +local_domains
+  route_list = * 127.0.0.1::PORT_S
+  self =       send
+  transport =  smtp
+
+
+# ----- Transports -----
+
+begin transports
+
+smtp:
+  driver =     smtp
+
+# End
diff --git a/test/log/5407 b/test/log/5407
new file mode 100644 (file)
index 0000000..3b35ec6
--- /dev/null
@@ -0,0 +1,6 @@
+1999-03-02 09:44:33 rcpt for userx@domain.com
+1999-03-02 09:44:33 rcpt for usery@domain.com
+1999-03-02 09:44:33 10HmaX-0005vi-00 >> usery@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 >> 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 for userx@domain.com usery@domain.com
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
diff --git a/test/scripts/5400-cutthrough/5407 b/test/scripts/5400-cutthrough/5407
new file mode 100644 (file)
index 0000000..08bc36f
--- /dev/null
@@ -0,0 +1,40 @@
+# cutthrough_delivery multiple recipient; router specifying port
+need_ipv4
+munge loopback
+#
+# A two-RCPT message.
+# Both should get cuttthrough, still as one message
+server PORT_S
+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
+*eof
+****
+exim -bs
+EHLO myhost.test.ex
+MAIL FROM:<CALLER@myhost.test.ex>
+RCPT TO:<userx@domain.com>
+RCPT TO:<usery@domain.com>
+DATA
+
+.
+QUIT
+****
+#
+#
+#
+#
+#
+# End
diff --git a/test/stdout/5407 b/test/stdout/5407
new file mode 100644 (file)
index 0000000..90ae013
--- /dev/null
@@ -0,0 +1,41 @@
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250-myhost.test.ex Hello CALLER at myhost.test.ex\r
+250-SIZE 52428800\r
+250-8BITMIME\r
+250-PIPELINING\r
+250 HELP\r
+250 OK\r
+250 Accepted\r
+250 Accepted\r
+354 Enter message, ending with "." on a line by itself\r
+250 OK id=10HmaX-0005vi-00\r
+221 myhost.test.ex closing connection\r
+
+******** SERVER ********
+Listening on port 1224 ... 
+Connection request from [IP_LOOPBACK_ADDR]
+220 ESMTP
+EHLO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@myhost.test.ex>
+250 Sender OK
+RCPT TO:<userx@domain.com>
+250 Recipient OK
+RCPT TO:<usery@domain.com>
+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@myhost.test.ex>)
+       id 10HmaX-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+.
+250 OK
+QUIT
+250 OK
+Expected EOF read from client
+End of script