Stop rewriting addresses as a consequence of CNAMEs, as Exim isn't
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 7 Nov 2006 14:13:18 +0000 (14:13 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 7 Nov 2006 14:13:18 +0000 (14:13 +0000)
supposed to do that (it must have crept in accidentally).

doc/doc-txt/ChangeLog
src/src/dns.c
test/confs/0545 [new file with mode: 0644]
test/scripts/0000-Basic/0545 [new file with mode: 0644]
test/src/fakens.c
test/stderr/0545 [new file with mode: 0644]
test/stdout/0545 [new file with mode: 0644]

index 53b82096fd48cfd7ecf029516434f81f671cd024..63c1693696cb61dac8483d259829ae92406230cf 100644 (file)
@@ -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
 -----------------
index 1a940b6abdd6818ec78554385a9b42dbccfad4f2..b86762ed4346e4b7f64de6d7d9e53d60fec8b856 100644 (file)
@@ -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 (file)
index 0000000..1f70fbb
--- /dev/null
@@ -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 (file)
index 0000000..caec734
--- /dev/null
@@ -0,0 +1,5 @@
+# CNAME not rewriting
+exim -d -bt userx@alias-eximtesthost
+****
+exim -d -bt userx@alias-eximtesthost.test.ex
+****
index 3ec432c49734f38fcd49f9de1ac86c1604256a3f..9c561653d883bb8c3866e7087d32e5b48fd71d8d 100644 (file)
@@ -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 (file)
index 0000000..cfe6a11
--- /dev/null
@@ -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 (file)
index 0000000..1495ed9
--- /dev/null
@@ -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]