ph10 2005/08/08 16:02:48 BST
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src smtp_out.c
exim-src/src/transports smtp.c
exim-test-orig/AutoTest/confs 544
exim-test-orig/AutoTest/log 544
exim-test-orig/AutoTest/scripts 544
exim-test-orig/AutoTest/stderr 544
exim-test-orig/AutoTest/stdout 544
exim-test-orig/DNSzones db.test.ex
Log:
Incorrect port was logged when an SRV record specified a special port.
Revision Changes Path
1.203 +4 -0 exim/exim-doc/doc-txt/ChangeLog
1.6 +4 -2 exim/exim-src/src/smtp_out.c
1.16 +11 -7 exim/exim-src/src/transports/smtp.c
1.2 +1 -0 exim/exim-test-orig/AutoTest/confs/544
1.2 +6 -0 exim/exim-test-orig/AutoTest/log/544
1.2 +24 -0 exim/exim-test-orig/AutoTest/scripts/544
1.2 +29 -0 exim/exim-test-orig/AutoTest/stderr/544
1.2 +26 -0 exim/exim-test-orig/AutoTest/stdout/544
1.4 +3 -1 exim/exim-test-orig/DNSzones/db.test.ex
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -r1.202 -r1.203
--- ChangeLog 8 Aug 2005 10:48:26 -0000 1.202
+++ ChangeLog 8 Aug 2005 15:02:48 -0000 1.203
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.202 2005/08/08 10:48:26 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.203 2005/08/08 15:02:48 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -72,6 +72,10 @@
HP-UX compiler.
PH/19 Added sqlite_lock_timeout option (David Woodhouse's patch).
+
+PH/20 If a delivery was routed to a non-standard port by means of an SRV
+ record, the port was not correctly logged when the outgoing_port log
+ selector was set (it logged the transort's default port).
Exim version 4.52
Index: smtp_out.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/smtp_out.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- smtp_out.c 27 Jun 2005 14:29:43 -0000 1.5
+++ smtp_out.c 8 Aug 2005 15:02:48 -0000 1.6
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/smtp_out.c,v 1.5 2005/06/27 14:29:43 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/smtp_out.c,v 1.6 2005/08/08 15:02:48 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -155,12 +155,13 @@
host->address will always be an IPv4 address.
The port field in the host item is used if it is set (usually router from SRV
-records). In other cases, the default passed as an argument is used.
+records or elsewhere). In other cases, the default passed as an argument is
+used, and the host item is updated with its value.
Arguments:
host host item containing name and address (and sometimes port)
host_af AF_INET or AF_INET6
- port default, remote port to connect to, in host byte order for those
+ port default remote port to connect to, in host byte order, for those
hosts whose port setting is PORT_NONE
interface outgoing interface address or NULL
timeout timeout value or 0
@@ -184,6 +185,7 @@
host->port);
port = host->port;
}
+else host->port = port; /* Set the port actually used */
HDEBUG(D_transport|D_acl|D_v)
{
Index: smtp.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/smtp.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- smtp.c 2 Aug 2005 11:22:24 -0000 1.15
+++ smtp.c 8 Aug 2005 15:02:48 -0000 1.16
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/smtp.c,v 1.15 2005/08/02 11:22:24 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/smtp.c,v 1.16 2005/08/08 15:02:48 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -749,7 +749,7 @@
failed by one of them.
host host to deliver to
host_af AF_INET or AF_INET6
- port TCP/IP port to use, in host byte order
+ port default TCP/IP port to use, in host byte order
interface interface to bind to, or NULL
tblock transport instance block
copy_host TRUE if host set in addr->host_used must be copied, because
@@ -1577,11 +1577,10 @@
}
/* SMTP, or success return from LMTP for this address. Pass back the
- actual port used. */
+ actual host that was used. */
addr->transport_return = OK;
addr->more_errno = delivery_time;
- thost->port = port;
addr->host_used = thost;
addr->special_action = flag;
addr->message = conf;
@@ -2130,12 +2129,9 @@
}
-/* Sort out the port. Set up a string for adding to the retry key if the port
-number is not the standard SMTP port. */
+/* Sort out the default port. */
if (!smtp_get_port(ob->port, addrlist, &port, tid)) return FALSE;
-pistring = string_sprintf(":%d", port);
-if (Ustrcmp(pistring, ":25") == 0) pistring = US"";
/* For each host-plus-IP-address on the list:
@@ -2209,6 +2205,14 @@
uschar *retry_host_key = NULL;
uschar *retry_message_key = NULL;
uschar *serialize_key = NULL;
+
+ /* Set up a string for adding to the retry key if the port number is not
+ the standard SMTP port. A host may have its own port setting that overrides
+ the default. */
+
+ pistring = string_sprintf(":%d", (host->port == PORT_NONE)?
+ port : host->port);
+ if (Ustrcmp(pistring, ":25") == 0) pistring = US"";
/* Default next host is next host. :-) But this can vary if the
hosts_max_try limit is hit (see below). It may also be reset if a host
Index: 544
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/confs/544,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 544 8 Oct 2004 14:49:16 -0000 1.1
+++ 544 8 Aug 2005 15:02:48 -0000 1.2
@@ -22,6 +22,7 @@
driver = dnslookup
check_srv = SRV
transport = t1
+ self = send
# ----- Transports -----
Index: 544
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/log/544,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 544 8 Oct 2004 14:49:31 -0000 1.1
+++ 544 8 Aug 2005 15:02:48 -0000 1.2
@@ -1,3 +1,9 @@
1999-03-02 09:44:33 10HmaX-0005vi-00 <= ph10@??? U=ph10 P=local S=263
1999-03-02 09:44:33 10HmaX-0005vi-00 *> x@??? R=r1 T=t1 H=ten-1.test.ex [10.0.0.1]:25
1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaY-0005vi-00 <= ph10@??? U=ph10 P=local S=263
+1999-03-02 09:44:33 10HmaY-0005vi-00 *> x@??? R=r1 T=t1 H=ten-4.test.ex [10.0.0.4]:88
+1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= ph10@??? U=ph10 P=local S=263
+1999-03-02 09:44:33 10HmaZ-0005vi-00 => x@??? R=r1 T=t1 H=localhost.test.ex [127.0.0.1]:1225
+1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
Index: 544
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/scripts/544,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 544 8 Oct 2004 14:49:53 -0000 1.1
+++ 544 8 Aug 2005 15:02:48 -0000 1.2
@@ -7,3 +7,27 @@
0
exim -odi -N x@???
****
+0
+exim -odi -DSRV=smtp2 -N x@???
+****
+# Actually send a message to a port specified in the SRV record.
+0
+server 1225
+220 Server ready
+EHLO
+250-server id
+250 OK
+MAIL FROM
+250 OK
+RCPT TO
+250 OK
+DATA
+354 OK
+.
+250 OK
+QUIT
+250 OK
+****
+0
+exim -v -odi x@???
+****
Index: 544
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/stderr/544,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 544 8 Oct 2004 14:50:08 -0000 1.1
+++ 544 8 Aug 2005 15:02:48 -0000 1.2
@@ -5,3 +5,32 @@
*> x@??? R=r1 T=t1 H=ten-1.test.ex [10.0.0.1]:25
LOG: MAIN
Completed
+LOG: MAIN
+ <= ph10@??? U=ph10 P=local S=263
+delivering 10HmaY-0005vi-00
+LOG: MAIN
+ *> x@??? R=r1 T=t1 H=ten-4.test.ex [10.0.0.4]:88
+LOG: MAIN
+ Completed
+LOG: MAIN
+ <= ph10@??? U=ph10 P=local S=263
+delivering 10HmaZ-0005vi-00
+Transport port=25 replaced by host-specific port=1225
+Connecting to localhost.test.ex [127.0.0.1]:1225 ... connected
+ SMTP<< 220 Server ready
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-server id
+ 250 OK
+ SMTP>> MAIL FROM:<ph10@???>
+ SMTP<< 250 OK
+ SMTP>> RCPT TO:<x@???>
+ SMTP<< 250 OK
+ SMTP>> DATA
+ SMTP<< 354 OK
+ SMTP>> writing message and terminating "."
+ SMTP<< 250 OK
+ SMTP>> QUIT
+LOG: MAIN
+ => x@??? R=r1 T=t1 H=localhost.test.ex [127.0.0.1]:1225
+LOG: MAIN
+ Completed
Index: 544
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/stdout/544,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 544 8 Oct 2004 14:50:14 -0000 1.1
+++ 544 8 Aug 2005 15:02:48 -0000 1.2
@@ -19,3 +19,29 @@
x@???
router = r1, transport = t1
host ten-4.test.ex [10.0.0.4] MX=0 port=88
+
+******** SERVER ********
+Listening on port 1225 ...
+Connection request from [127.0.0.1]
+220 Server ready
+EHLO myhost.test.ex
+250-server id
+250 OK
+MAIL FROM:<ph10@???>
+250 OK
+RCPT TO:<x@???>
+250 OK
+DATA
+354 OK
+Received: from ph10 by myhost.test.ex with local (Exim x.yz)
+ id 10HmaZ-0005vi-00
+ for x@???; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaZ-0005vi-00@???>
+From: Philip Hazel <ph10@???>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+.
+250 OK
+QUIT
+250 OK
+End of script
Index: db.test.ex
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/DNSzones/db.test.ex,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- db.test.ex 10 May 2005 10:19:12 -0000 1.3
+++ db.test.ex 8 Aug 2005 15:02:48 -0000 1.4
@@ -8,7 +8,7 @@
NS xoanon.csi.cam.ac.uk.
-; $Cambridge: exim/exim-test-orig/DNSzones/db.test.ex,v 1.3 2005/05/10 10:19:12 ph10 Exp $
+; $Cambridge: exim/exim-test-orig/DNSzones/db.test.ex,v 1.4 2005/08/08 15:02:48 ph10 Exp $
; This is a testing zone file for use on xoanon.csi.cam.ac.uk when testing
; DNS handling in Exim. This is a fake zone of no real use. The zone name
@@ -320,6 +320,8 @@
_smtp._tcp.nosmtp SRV 0 0 0 .
_smtp2._tcp.srv03 SRV 0 0 88 ten-4.test.ex.
+
+_smtp._tcp.srv27 SRV 0 0 1225 localhost
; -------- With some for CSA testing plus their A records -------