Do not use the A lookup following an AAAA for setting the FQDN. Bug 1588
authorJeremy Harris <jgh146exb@wizmail.org>
Sun, 10 May 2015 22:13:41 +0000 (23:13 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 10 May 2015 23:37:24 +0000 (00:37 +0100)
Normally benign, it bites when the pair was led to by a CNAME;
modern usage is to not canoicalize the domain to a cname target
(and we were inconsistent anyway for A-only vs AAAA+A).

doc/doc-txt/ChangeLog
src/src/host.c
test/confs/0607 [new file with mode: 0644]
test/dnszones-src/db.test.ex
test/log/0607 [new file with mode: 0644]
test/scripts/0000-Basic/0607 [new file with mode: 0644]

index 4e6b9783bd90ed426c03a0a98906e44fb520f897..e7693c38d4015d1680c51fb49cb6e4162600e1d4 100644 (file)
@@ -96,6 +96,11 @@ JH/26 Bug 1539: Add timout/retry options on dnsdb lookups.
 
 JH/27 Bug 286: Support SOA lookup in dnsdb lookups.
 
 
 JH/27 Bug 286: Support SOA lookup in dnsdb lookups.
 
+JH/28 Bug 1588: Do not use the A lookup following an AAAA for setting the FQDN.
+      Normally benign, it bites when the pair was led to by a CNAME;
+      modern usage is to not canoicalize the domain to a CNAME target
+      (and we were inconsistent anyway for A-only vs AAAA+A).
+
 
 Exim version 4.85
 -----------------
 
 Exim version 4.85
 -----------------
index 45ec13659c7fd524531ee2814127fc9182db1207..206751757d4775359094e0f5442ab834d35169d4 100644 (file)
@@ -2380,7 +2380,10 @@ for (; i >= 0; i--)
 
   /* Lookup succeeded: fill in the given host item with the first non-ignored
   address found; create additional items for any others. A single A6 record
 
   /* Lookup succeeded: fill in the given host item with the first non-ignored
   address found; create additional items for any others. A single A6 record
-  may generate more than one address. */
+  may generate more than one address.  The lookup had a chance to update the
+  fqdn; we do not want any later times round the loop to do so. */
+
+  fully_qualified_name = NULL;
 
   for (rr = dns_next_rr(&dnsa, &dnss, RESET_ANSWERS);
        rr != NULL;
 
   for (rr = dns_next_rr(&dnsa, &dnss, RESET_ANSWERS);
        rr != NULL;
diff --git a/test/confs/0607 b/test/confs/0607
new file mode 100644 (file)
index 0000000..af4d238
--- /dev/null
@@ -0,0 +1,41 @@
+# Exim test configuration 0607
+
+SERVER =
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/SERVER%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+log_selector = +received_recipients +sender_on_delivery
+
+acl_smtp_rcpt = accept
+queue_only
+queue_run_in_order
+
+#---------------
+
+begin routers
+
+dump:
+  driver = redirect
+  condition = ${if eq {SERVER}{server}{yes}{no}}
+  data = :blackhole:
+
+all:
+  driver = dnslookup
+  self = send
+  transport = out
+
+#---------------
+
+begin transports
+
+out:
+  driver = smtp
+  port = PORT_D
+
+# End
+
index c9b004c768eff7ae5e0d439258135e2882f73d50..05deca5d3e75a814c5ab853b9cce9be157843a42 100644 (file)
@@ -155,6 +155,12 @@ testsub.sub  A       V4NET.99.0.3
 
 recurse.test.ex   A  V4NET.99.0.2
 
 
 recurse.test.ex   A  V4NET.99.0.2
 
+; a CNAME pointing to a name with both ipv4 and ipv6 A-records
+; and one with only ipv4
+
+cname46      CNAME   localhost
+cname4       CNAME   thishost
+
 ; -------- Testing RBL records -------
 
 ; V4NET.11.12.13 is deliberately not reverse-registered
 ; -------- Testing RBL records -------
 
 ; V4NET.11.12.13 is deliberately not reverse-registered
diff --git a/test/log/0607 b/test/log/0607
new file mode 100644 (file)
index 0000000..0492382
--- /dev/null
@@ -0,0 +1,14 @@
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@the.local.host.name U=CALLER P=local-smtp S=sss for testx@cname46.test.ex
+1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@the.local.host.name U=CALLER P=local-smtp S=sss for testx@cname4.test.ex
+1999-03-02 09:44:33 Start queue run: pid=pppp -qq
+1999-03-02 09:44:33 10HmaX-0005vi-00 => testx@cname46.test.ex F=<CALLER@the.local.host.name> R=all T=out H=localhost.test.ex [::1] C="250 OK id=10HmaZ-0005vi-00"
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaY-0005vi-00 => testx@cname4.test.ex F=<CALLER@the.local.host.name> R=all T=out H=thishost.test.ex [127.0.0.1] C="250 OK id=10HmbA-0005vi-00"
+1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
+1999-03-02 09:44:33 End queue run: pid=pppp -qq
+
+******** SERVER ********
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225 (IPv6 and IPv4)
+1999-03-02 09:44:33 no host name found for IP address ::1
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@the.local.host.name H=(the.local.host.name) [::1] P=esmtp S=sss id=E10HmaX-0005vi-00@the.local.host.name for testx@cname46.test.ex
+1999-03-02 09:44:33 10HmbA-0005vi-00 <= CALLER@the.local.host.name H=localhost (the.local.host.name) [127.0.0.1] P=esmtp S=sss id=E10HmaY-0005vi-00@the.local.host.name for testx@cname4.test.ex
diff --git a/test/scripts/0000-Basic/0607 b/test/scripts/0000-Basic/0607
new file mode 100644 (file)
index 0000000..83c83b3
--- /dev/null
@@ -0,0 +1,32 @@
+# delivery to cname
+# Exim test configuration 0607
+#
+need_ipv6
+#
+exim -DSERVER=server -bd -oX PORT_D
+****
+#
+exim -bs
+MAIL FROM:<CALLER@myhost.test.ex>
+RCPT TO: <testx@cname46.test.ex>
+DATA
+Subject: test
+
+foo
+.
+RSET
+MAIL FROM:<CALLER@myhost.test.ex>
+RCPT TO: <testx@cname4.test.ex>
+DATA
+Subject: test
+
+foo
+.
+QUIT
+****
+#
+exim -qq
+****
+#
+killdaemon
+no_msglog_check