[exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim…

Pàgina inicial
Delete this message
Reply to this message
Autor: Philip Hazel
Data:  
A: exim-cvs
Assumpte: [exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim/exim-src/src host.c verify.c exim/exim-test-orig/AutoTest/confs 593 exim/exim-test-orig/AutoTest/log 593 exim/exim-test-orig/AutoTest/rej
ph10 2004/11/12 16:54:56 GMT

  Modified files:
    exim-doc/doc-txt     ChangeLog 
    exim-src/src         host.c verify.c 
  Added files:
    exim-test-orig/AutoTest/confs 593 
    exim-test-orig/AutoTest/log 593 
    exim-test-orig/AutoTest/rejectlog 593 
    exim-test-orig/AutoTest/scripts 593 
    exim-test-orig/AutoTest/stderr 593 
    exim-test-orig/AutoTest/stdout 593 
  Log:
  Exim went into a mad DNS lookup loop when doing a callout where the
  host was specified on the transport, if the DNS lookup yielded more than
  one IP address.


  Revision  Changes    Path
  1.28      +4 -0      exim/exim-doc/doc-txt/ChangeLog
  1.2       +50 -25    exim/exim-src/src/host.c
  1.5       +7 -3      exim/exim-src/src/verify.c
  1.1       +45 -0     exim/exim-test-orig/AutoTest/confs/593 (new)
  1.1       +1 -0      exim/exim-test-orig/AutoTest/log/593 (new)
  1.1       +1 -0      exim/exim-test-orig/AutoTest/rejectlog/593 (new)
  1.1       +7 -0      exim/exim-test-orig/AutoTest/scripts/593 (new)
  1.1       +8 -0      exim/exim-test-orig/AutoTest/stderr/593 (new)
  1.1       +5 -0      exim/exim-test-orig/AutoTest/stdout/593 (new)


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ChangeLog    12 Nov 2004 15:03:40 -0000    1.27
  +++ ChangeLog    12 Nov 2004 16:54:55 -0000    1.28
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.27 2004/11/12 15:03:40 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.28 2004/11/12 16:54:55 ph10 Exp $


   Change log file for Exim from version 4.21
   -------------------------------------------
  @@ -112,6 +112,10 @@
       lookups. However, all the other forms of pattern expect the subject to
       contain a local part and a domain, and therefore, for them, an empty
       address still always fails if the pattern is not itself empty.
  +
  +30. Exim went into a mad DNS loop when attempting to do a callout where the
  +    host was specified on an smtp transport, and looking it up yielded more
  +    than one IP address.



Exim version 4.43

  Index: host.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/host.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- host.c    7 Oct 2004 10:39:01 -0000    1.1
  +++ host.c    12 Nov 2004 16:54:55 -0000    1.2
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/host.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/host.c,v 1.2 2004/11/12 16:54:55 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -91,6 +91,48 @@



   /*************************************************
  +*         Sort addresses when testing            *
  +*************************************************/
  +
  +/* This function is called only when running in the test harness. It sorts a
  +number of multihomed host IP addresses into the order, so as to get
  +repeatability. This doesn't have to be efficient. But don't interchange IPv4
  +and IPv6 addresses!
  +
  +Arguments:
  +  host        -> the first host item
  +  last        -> the last host item
  +  
  +Returns:      nothing
  +*/  
  +
  +static void
  +sort_addresses(host_item *host, host_item *last)
  +{
  +BOOL done = FALSE;
  +while (!done)
  +  {
  +  host_item *h;
  +  done = TRUE;
  +  for (h = host; h != last; h = h->next)
  +    {
  +    if ((Ustrchr(h->address, ':') == NULL) !=
  +        (Ustrchr(h->next->address, ':') == NULL))
  +      continue;
  +    if (Ustrcmp(h->address, h->next->address) > 0)
  +      {
  +      uschar *temp = h->address;
  +      h->address = h->next->address;
  +      h->next->address = temp;
  +      done = FALSE;
  +      }
  +    }
  +  }
  +}
  +
  +
  +
  +/*************************************************
   *       Build chain of host items from list      *
   *************************************************/


  @@ -1791,31 +1833,9 @@
     host_scan_for_local_hosts(host, &last, NULL) : HOST_FOUND;


/* When running in the test harness, sort into the order of addresses so as to
-get repeatability. This doesn't have to be efficient. But don't interchange
-IPv4 and IPv6 addresses! */
+get repeatability. */

  -if (running_in_test_harness)
  -  {
  -  BOOL done = FALSE;
  -  while (!done)
  -    {
  -    host_item *h;
  -    done = TRUE;
  -    for (h = host; h != last; h = h->next)
  -      {
  -      if ((Ustrchr(h->address, ':') == NULL) !=
  -          (Ustrchr(h->next->address, ':') == NULL))
  -        continue;
  -      if (Ustrcmp(h->address, h->next->address) > 0)
  -        {
  -        uschar *temp = h->address;
  -        h->address = h->next->address;
  -        h->next->address = temp;
  -        done = FALSE;
  -        }
  -      }
  -    }
  -  }
  +if (running_in_test_harness) sort_addresses(host, last);


   HDEBUG(D_host_lookup)
     {
  @@ -1954,7 +1974,7 @@
     fails or times out, but not if another one succeeds. (In the early
     IPv6 days there are name servers that always fail on AAAA, but are happy
     to give out an A record. We want to proceed with that A record.) */
  -
  +  
     if (rc != DNS_SUCCEED)
       {
       if (i == 0)  /* Just tried for an A record, i.e. end of loop */
  @@ -2241,6 +2261,11 @@
       rc = host_scan_for_local_hosts(host, &last, removed);
     else
       if (rc == HOST_IGNORED) rc = HOST_FIND_FAILED;  /* No special action */
  +
  +  /* When running in the test harness, sort into the order of addresses so as
  +  to get repeatability. */
  +  
  +  if (running_in_test_harness) sort_addresses(host, last);


     DEBUG(D_host_lookup)
       {


  Index: verify.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/verify.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- verify.c    11 Nov 2004 11:40:36 -0000    1.4
  +++ verify.c    12 Nov 2004 16:54:55 -0000    1.5
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/verify.c,v 1.4 2004/11/11 11:40:36 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/verify.c,v 1.5 2004/11/12 16:54:55 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -1037,14 +1037,18 @@
             else
               {
               uschar *canonical_name;
  -            host_item *host;
  +            host_item *host, *nexthost;
               host_build_hostlist(&host_list, s, tf.hosts_randomize);


               /* Just ignore failures to find a host address. If we don't manage
  -            to find any addresses, the callout will defer. */
  +            to find any addresses, the callout will defer. Note that more than 
  +            one address may be found for a single host, which will result in 
  +            additional host items being inserted into the chain. Hence we must 
  +            save the next host first. */


  -            for (host = host_list; host != NULL; host = host->next)
  +            for (host = host_list; host != NULL; host = nexthost)
                 {
  +              nexthost = host->next;
                 if (tf.gethostbyname || string_is_ip_address(host->name, NULL))
                   (void)host_find_byname(host, NULL, &canonical_name, TRUE);
                 else


Index: 593
====================================================================
# Exim test configuration 593

# Macros are set externally in order to get the path
# of the Exim that is being tested, and the directory
# in which the test data lives.

exim_path = EXIM_PATH
primary_hostname = myhost.test.ex
spool_directory = DIR/spool


# ----- Main settings -----

acl_smtp_rcpt = check_rcpt


# ----- ACL -----

begin acl

  check_rcpt:
    accept   senders  = :
             endpass
             verify   = recipient/callout=1s



# ----- Routers -----

begin routers

  r1:
    driver = accept
    transport = t1



# ----- Transports -----

begin transports

  t1:
    driver = smtp
    hosts = ten-5-6.test.ex   



# End

Index: 593
====================================================================
1999-03-02 09:44:33 U=ph10 F=<> temporarily rejected RCPT ph10@???: Could not complete recipient verify callout

Index: 593
====================================================================
1999-03-02 09:44:33 U=ph10 F=<> temporarily rejected RCPT ph10@???: Could not complete recipient verify callout

Index: 593
====================================================================
0 DNS loop with -bs
exim -N -bs
helo test.host
mail from:<>
rcpt to:ph10@???
quit
****

  Index: 593
  ====================================================================
  LOG: smtp_connection MAIN
    SMTP connection from ph10
  Connecting to ten-5-6.test.ex [10.0.0.5]:25 ... failed: Connection timed out (timeout=1s)
  Connecting to ten-5-6.test.ex [10.0.0.6]:25 ... failed: Connection timed out (timeout=1s)
  LOG: MAIN REJECT
    U=ph10 F=<> temporarily rejected RCPT ph10@???: Could not complete recipient verify callout
  LOG: smtp_connection MAIN
    SMTP connection from ph10 closed by QUIT


Index: 593
====================================================================
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
250 myhost.test.ex Hello ph10 at test.host
250 OK
451 Could not complete recipient verify callout
221 myhost.test.ex closing connection