From 8241d8dda54bd5680b6fd8ef16108c0309a5ade7 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 10 May 2015 23:13:41 +0100 Subject: [PATCH] Do not use the A lookup following an AAAA for setting the FQDN. Bug 1588 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 | 5 +++++ src/src/host.c | 5 ++++- test/confs/0607 | 41 ++++++++++++++++++++++++++++++++++++ test/dnszones-src/db.test.ex | 6 ++++++ test/log/0607 | 14 ++++++++++++ test/scripts/0000-Basic/0607 | 32 ++++++++++++++++++++++++++++ 6 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 test/confs/0607 create mode 100644 test/log/0607 create mode 100644 test/scripts/0000-Basic/0607 diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 4e6b9783b..e7693c38d 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -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/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 ----------------- diff --git a/src/src/host.c b/src/src/host.c index 45ec13659..206751757 100644 --- a/src/src/host.c +++ b/src/src/host.c @@ -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 - 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; diff --git a/test/confs/0607 b/test/confs/0607 new file mode 100644 index 000000000..af4d238b5 --- /dev/null +++ b/test/confs/0607 @@ -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 + diff --git a/test/dnszones-src/db.test.ex b/test/dnszones-src/db.test.ex index c9b004c76..05deca5d3 100644 --- a/test/dnszones-src/db.test.ex +++ b/test/dnszones-src/db.test.ex @@ -155,6 +155,12 @@ testsub.sub A V4NET.99.0.3 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 diff --git a/test/log/0607 b/test/log/0607 new file mode 100644 index 000000000..049238256 --- /dev/null +++ b/test/log/0607 @@ -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= 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= 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 index 000000000..83c83b312 --- /dev/null +++ b/test/scripts/0000-Basic/0607 @@ -0,0 +1,32 @@ +# delivery to cname +# Exim test configuration 0607 +# +need_ipv6 +# +exim -DSERVER=server -bd -oX PORT_D +**** +# +exim -bs +MAIL FROM: +RCPT TO: +DATA +Subject: test + +foo +. +RSET +MAIL FROM: +RCPT TO: +DATA +Subject: test + +foo +. +QUIT +**** +# +exim -qq +**** +# +killdaemon +no_msglog_check -- 2.30.2