From a2042e783d5db744eeb94d4d6ac3bc86aef45511 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 7 Nov 2006 14:13:18 +0000 Subject: [PATCH] Stop rewriting addresses as a consequence of CNAMEs, as Exim isn't supposed to do that (it must have crept in accidentally). --- doc/doc-txt/ChangeLog | 5 +- src/src/dns.c | 12 ++-- test/confs/0545 | 32 +++++++++ test/scripts/0000-Basic/0545 | 5 ++ test/src/fakens.c | 14 +--- test/stderr/0545 | 121 +++++++++++++++++++++++++++++++++++ test/stdout/0545 | 7 ++ 7 files changed, 176 insertions(+), 20 deletions(-) create mode 100644 test/confs/0545 create mode 100644 test/scripts/0000-Basic/0545 create mode 100644 test/stderr/0545 create mode 100644 test/stdout/0545 diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 53b82096f..63c169369 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.426 2006/11/07 11:28:05 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.427 2006/11/07 14:13:18 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -252,6 +252,9 @@ PH/37 For LMTP over TCP/IP (the smtp transport), error responses from the happening for LMTP over a pipe (the lmtp transport), but now it is the same for both kinds of LMTP. +PH/38 Despite being documented as not happening, Exim was rewriting addresses + in header lines that were in fact CNAMEs. This is no longer the case. + Exim version 4.63 ----------------- diff --git a/src/src/dns.c b/src/src/dns.c index 1a940b6ab..b86762ed4 100644 --- a/src/src/dns.c +++ b/src/src/dns.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/dns.c,v 1.14 2006/02/16 10:05:33 ph10 Exp $ */ +/* $Cambridge: exim/src/src/dns.c,v 1.15 2006/11/07 14:13:19 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -677,12 +677,10 @@ for (i = 0; i < 10; i++) else if (rr->type == T_CNAME) cname_rr = *rr; } - /* If a CNAME was found, take the fully qualified name from it; otherwise - from the first data record, if present. For testing, there is a magic name - that gets its casing adjusted, because my resolver doesn't seem to pass back - upper case letters in domain names. */ + /* For the first time round this loop, if a CNAME was found, take the fully + qualified name from it; otherwise from the first data record, if present. */ - if (fully_qualified_name != NULL) + if (i == 0 && fully_qualified_name != NULL) { if (cname_rr.data != NULL) { @@ -712,6 +710,8 @@ for (i = 0; i < 10; i++) cname_rr.data, (DN_EXPAND_ARG4_TYPE)data, 256); if (datalen < 0) return DNS_FAIL; name = data; + + DEBUG(D_dns) debug_printf("CNAME found: change to %s\n", name); } /* Loop back to do another lookup */ /*Control reaches here after 10 times round the CNAME loop. Something isn't diff --git a/test/confs/0545 b/test/confs/0545 new file mode 100644 index 000000000..1f70fbb9f --- /dev/null +++ b/test/confs/0545 @@ -0,0 +1,32 @@ +# Exim test configuration 0545 + +exim_path = EXIM_PATH +host_lookup_order = bydns +rfc1413_query_timeout = 0s +spool_directory = DIR/spool +log_file_path = DIR/spool/log/%slog +gecos_pattern = "" +gecos_name = CALLER_NAME + +# ----- Main settings ----- + + +# ----- Routers ----- + +begin routers + +dns: + driver = dnslookup + transport = smtp + self = send + + +# ----- Transports ----- + +begin transports + +smtp: + driver = smtp + + +# End diff --git a/test/scripts/0000-Basic/0545 b/test/scripts/0000-Basic/0545 new file mode 100644 index 000000000..caec73458 --- /dev/null +++ b/test/scripts/0000-Basic/0545 @@ -0,0 +1,5 @@ +# CNAME not rewriting +exim -d -bt userx@alias-eximtesthost +**** +exim -d -bt userx@alias-eximtesthost.test.ex +**** diff --git a/test/src/fakens.c b/test/src/fakens.c index 3ec432c49..9c561653d 100644 --- a/test/src/fakens.c +++ b/test/src/fakens.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/test/src/fakens.c,v 1.2 2006/02/16 10:05:34 ph10 Exp $ */ +/* $Cambridge: exim/test/src/fakens.c,v 1.3 2006/11/07 14:13:19 ph10 Exp $ */ /************************************************* * fakens - A Fake Nameserver Program * @@ -415,18 +415,6 @@ while (fgets(CS buffer, sizeof(buffer), f) != NULL) rdlptr[0] = ((pk - rdlptr - 2) >> 8) & 255; rdlptr[1] = (pk -rdlptr - 2) & 255; - - /* If we have just yielded a CNAME, we must change the domain name to the - new domain, and re-start the scan from the beginning. */ - - if (found_cname) - { - domain = fcopystring("%s", p); - domainlen = Ustrlen(domain); - domain[domainlen - 1] = 0; /* Removed trailing dot */ - rrdomain[0] = 0; /* No previous domain */ - (void)fseek(f, 0, SEEK_SET); /* Start again at the beginning */ - } } *pkptr = pk; diff --git a/test/stderr/0545 b/test/stderr/0545 new file mode 100644 index 000000000..cfe6a114e --- /dev/null +++ b/test/stderr/0545 @@ -0,0 +1,121 @@ +Exim version x.yz .... +changed uid/gid: forcing real = effective + uid=uuuu gid=CALLER_GID pid=pppp +configuration file is TESTSUITE/test-config +admin user +originator: uid=CALLER_UID gid=CALLER_GID login=CALLER name=CALLER_NAME +sender address = CALLER@the.local.host.name +Address testing: uid=uuuu gid=EXIM_GID euid=uuuu egid=EXIM_GID +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +Testing userx@alias-eximtesthost +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +Considering userx@alias-eximtesthost +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +routing userx@alias-eximtesthost +--------> dns router <-------- +local_part=userx domain=alias-eximtesthost +calling dns router +dns router called for userx@alias-eximtesthost + domain = alias-eximtesthost +DNS lookup of alias-eximtesthost (MX) using fakens +DNS lookup of alias-eximtesthost (MX) succeeded +CNAME found: change to eximtesthost.test.ex +DNS lookup of eximtesthost.test.ex (MX) using fakens +DNS lookup of eximtesthost.test.ex (MX) gave NO_DATA +returning DNS_NODATA +DNS lookup of alias-eximtesthost (AAAA) succeeded +CNAME found: change to eximtesthost.test.ex +DNS lookup of alias-eximtesthost (A) using fakens +DNS lookup of alias-eximtesthost (A) succeeded +CNAME found: change to eximtesthost.test.ex +DNS lookup of eximtesthost.test.ex (A) using fakens +DNS lookup of eximtesthost.test.ex (A) succeeded +local host found for non-MX address +fully qualified name = alias-eximtesthost.test.ex +eximtesthost.test.ex ip4.ip4.ip4.ip4 mx=-1 sort=xx +domain changed to alias-eximtesthost.test.ex +rewriting header lines +re-routed to userx@alias-eximtesthost.test.ex +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +Considering userx@alias-eximtesthost.test.ex +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +routing userx@alias-eximtesthost.test.ex +--------> dns router <-------- +local_part=userx domain=alias-eximtesthost.test.ex +calling dns router +dns router called for userx@alias-eximtesthost.test.ex + domain = alias-eximtesthost.test.ex +DNS lookup of alias-eximtesthost.test.ex (MX) using fakens +DNS lookup of alias-eximtesthost.test.ex (MX) succeeded +CNAME found: change to eximtesthost.test.ex +DNS lookup of eximtesthost.test.ex-MX: using cached value DNS_NODATA +DNS lookup of alias-eximtesthost.test.ex (AAAA) succeeded +CNAME found: change to eximtesthost.test.ex +DNS lookup of eximtesthost.test.ex-AAAA: using cached value DNS_NODATA +DNS lookup of alias-eximtesthost.test.ex (A) using fakens +DNS lookup of alias-eximtesthost.test.ex (A) succeeded +CNAME found: change to eximtesthost.test.ex +DNS lookup of eximtesthost.test.ex (A) using fakens +DNS lookup of eximtesthost.test.ex (A) succeeded +local host found for non-MX address +fully qualified name = alias-eximtesthost.test.ex +eximtesthost.test.ex ip4.ip4.ip4.ip4 mx=-1 sort=xx +remote host address is the local host: alias-eximtesthost.test.ex: configured to try delivery anyway +set transport smtp +queued for smtp transport: local_part = userx +domain = alias-eximtesthost.test.ex + errors_to=NULL + domain_data=NULL localpart_data=NULL +routed by dns router + envelope to: userx@alias-eximtesthost.test.ex + transport: smtp + host eximtesthost.test.ex [ip4.ip4.ip4.ip4] +search_tidyup called +>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>> +Exim version x.yz .... +changed uid/gid: forcing real = effective + uid=uuuu gid=CALLER_GID pid=pppp +configuration file is TESTSUITE/test-config +admin user +originator: uid=CALLER_UID gid=CALLER_GID login=CALLER name=CALLER_NAME +sender address = CALLER@the.local.host.name +Address testing: uid=uuuu gid=EXIM_GID euid=uuuu egid=EXIM_GID +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +Testing userx@alias-eximtesthost.test.ex +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +Considering userx@alias-eximtesthost.test.ex +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +routing userx@alias-eximtesthost.test.ex +--------> dns router <-------- +local_part=userx domain=alias-eximtesthost.test.ex +calling dns router +dns router called for userx@alias-eximtesthost.test.ex + domain = alias-eximtesthost.test.ex +DNS lookup of alias-eximtesthost.test.ex (MX) using fakens +DNS lookup of alias-eximtesthost.test.ex (MX) succeeded +CNAME found: change to eximtesthost.test.ex +DNS lookup of eximtesthost.test.ex (MX) using fakens +DNS lookup of eximtesthost.test.ex (MX) gave NO_DATA +returning DNS_NODATA +DNS lookup of alias-eximtesthost.test.ex (AAAA) succeeded +CNAME found: change to eximtesthost.test.ex +DNS lookup of alias-eximtesthost.test.ex (A) using fakens +DNS lookup of alias-eximtesthost.test.ex (A) succeeded +CNAME found: change to eximtesthost.test.ex +DNS lookup of eximtesthost.test.ex (A) using fakens +DNS lookup of eximtesthost.test.ex (A) succeeded +local host found for non-MX address +fully qualified name = alias-eximtesthost.test.ex +eximtesthost.test.ex ip4.ip4.ip4.ip4 mx=-1 sort=xx +remote host address is the local host: alias-eximtesthost.test.ex: configured to try delivery anyway +set transport smtp +queued for smtp transport: local_part = userx +domain = alias-eximtesthost.test.ex + errors_to=NULL + domain_data=NULL localpart_data=NULL +routed by dns router + envelope to: userx@alias-eximtesthost.test.ex + transport: smtp + host eximtesthost.test.ex [ip4.ip4.ip4.ip4] +search_tidyup called +>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>> diff --git a/test/stdout/0545 b/test/stdout/0545 new file mode 100644 index 000000000..1495ed9e6 --- /dev/null +++ b/test/stdout/0545 @@ -0,0 +1,7 @@ +userx@alias-eximtesthost.test.ex + <-- userx@alias-eximtesthost + router = dns, transport = smtp + host eximtesthost.test.ex [ip4.ip4.ip4.ip4] +userx@alias-eximtesthost.test.ex + router = dns, transport = smtp + host eximtesthost.test.ex [ip4.ip4.ip4.ip4] -- 2.30.2