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

Góra strony
Delete this message
Reply to this message
Autor: Philip Hazel
Data:  
Dla: exim-cvs
Temat: [exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim/exim-src/src exim.c expand.c functions.h host.c verify.c exim/exim-test-orig/AutoTest/confs 595 exim/exim-test-orig/AutoTest/scripts 595
ph10 2004/11/18 11:17:34 GMT

  Modified files:
    exim-doc/doc-txt     ChangeLog 
    exim-src/src         exim.c expand.c functions.h host.c 
                         verify.c 
  Added files:
    exim-test-orig/AutoTest/confs 595 
    exim-test-orig/AutoTest/scripts 595 
    exim-test-orig/AutoTest/stderr 595 
    exim-test-orig/AutoTest/stdout 595 
  Log:
  Canonicize IPv6 addresses that are supplied via -bh or -bhc.


  Revision  Changes    Path
  1.33      +4 -0      exim/exim-doc/doc-txt/ChangeLog
  1.9       +12 -0     exim/exim-src/src/exim.c
  1.7       +1 -1      exim/exim-src/src/expand.c
  1.4       +1 -1      exim/exim-src/src/functions.h
  1.3       +8 -6      exim/exim-src/src/host.c
  1.6       +3 -2      exim/exim-src/src/verify.c
  1.1       +27 -0     exim/exim-test-orig/AutoTest/confs/595 (new)
  1.1       +3 -0      exim/exim-test-orig/AutoTest/scripts/595 (new)
  1.1       +18 -0     exim/exim-test-orig/AutoTest/stderr/595 (new)
  1.1       +7 -0      exim/exim-test-orig/AutoTest/stdout/595 (new)


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ChangeLog    18 Nov 2004 10:35:18 -0000    1.32
  +++ ChangeLog    18 Nov 2004 11:17:33 -0000    1.33
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.32 2004/11/18 10:35:18 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.33 2004/11/18 11:17:33 ph10 Exp $


   Change log file for Exim from version 4.21
   -------------------------------------------
  @@ -137,6 +137,10 @@
   34. Failure to deliver a bounce message always caused it to be frozen, even if
       there was an errors_to setting on the router. The errors_to setting is now
       respected.
  +
  +35. If an IPv6 address is given for -bh or -bhc, it is now converted to the
  +    canonical form (fully expanded) before being placed in
  +    $sender_host_address.



Exim version 4.43

  Index: exim.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/exim.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- exim.c    10 Nov 2004 10:29:56 -0000    1.8
  +++ exim.c    18 Nov 2004 11:17:33 -0000    1.9
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/exim.c,v 1.8 2004/11/10 10:29:56 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/exim.c,v 1.9 2004/11/18 11:17:33 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -4094,10 +4094,22 @@


   if (host_checking)
     {
  +  int x[4]; 
  +  int size;
  +    
     sender_ident = NULL;
     if (running_in_test_harness && sender_host_port != 0 &&
         interface_address != NULL && interface_port != 0)
       verify_get_ident(1413);
  +    
  +  /* In case the given address is a non-canonical IPv6 address, canonicize
  +  it. The code works for both IPv4 and IPv6, as it happens. */
  +  
  +  size = host_aton(sender_host_address, x);
  +  sender_host_address = store_get(48);  /* large enough for full IPv6 */
  +  (void)host_nmtoa(size, x, -1, sender_host_address, ':');
  +
  +  /* Now set up for testing */


     host_build_sender_fullhost();
     smtp_input = TRUE;


  Index: expand.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/expand.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- expand.c    17 Nov 2004 16:12:26 -0000    1.6
  +++ expand.c    18 Nov 2004 11:17:33 -0000    1.7
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/expand.c,v 1.6 2004/11/17 16:12:26 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/expand.c,v 1.7 2004/11/18 11:17:33 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -3958,7 +3958,7 @@
           /* Convert to masked textual format and add to output. */


           yield = string_cat(yield, &size, &ptr, buffer,
  -          host_nmtoa(count, binary, mask, buffer));
  +          host_nmtoa(count, binary, mask, buffer, '.'));
           continue;
           }



  Index: functions.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/functions.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- functions.h    17 Nov 2004 14:32:25 -0000    1.3
  +++ functions.h    18 Nov 2004 11:17:33 -0000    1.4
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/functions.h,v 1.3 2004/11/17 14:32:25 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/functions.h,v 1.4 2004/11/18 11:17:33 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -112,7 +112,7 @@
   extern BOOL    host_is_tls_on_connect_port(int);
   extern void    host_mask(int, int *, int);
   extern int     host_name_lookup(void);
  -extern int     host_nmtoa(int, int *, int, uschar *);
  +extern int     host_nmtoa(int, int *, int, uschar *, int);
   extern uschar *host_ntoa(int, const void *, uschar *, int *);
   extern int     host_scan_for_local_hosts(host_item *, host_item **, BOOL *);



  Index: host.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/host.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- host.c    12 Nov 2004 16:54:55 -0000    1.2
  +++ host.c    18 Nov 2004 11:17:33 -0000    1.3
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/host.c,v 1.2 2004/11/12 16:54:55 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/host.c,v 1.3 2004/11/18 11:17:33 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -856,22 +856,24 @@
   /* We can't use host_ntoa() because it assumes the binary values are in network
   byte order, and these are the result of host_aton(), which puts them in ints in
   host byte order. Also, we really want IPv6 addresses to be in a canonical
  -format, so we output them with no abbreviation. However, we can't use the
  -normal colon separator in them because it terminates keys in lsearch files, so
  -use dot instead.
  +format, so we output them with no abbreviation. In a number of cases we can't
  +use the normal colon separator in them because it terminates keys in lsearch
  +files, so we want to use dot instead. There's an argument that specifies what 
  +to use for IPv6 addresses.


   Arguments:
     count       1 or 4 (number of ints)
     binary      points to the ints
     mask        mask value; if < 0 don't add to result
     buffer      big enough to hold the result
  +  sep         component separator character for IPv6 addresses 


   Returns:      the number of characters placed in buffer, not counting
                 the final nul.
   */


   int
  -host_nmtoa(int count, int *binary, int mask, uschar *buffer)
  +host_nmtoa(int count, int *binary, int mask, uschar *buffer, int sep)
   {
   int i, j;
   uschar *tt = buffer;
  @@ -890,12 +892,12 @@
     for (i = 0; i < 4; i++)
       {
       j = binary[i];
  -    sprintf(CS tt, "%04x.%04x.", (j >> 16) & 0xffff, j & 0xffff);
  +    sprintf(CS tt, "%04x%c%04x%c", (j >> 16) & 0xffff, sep, j & 0xffff, sep);
       while (*tt) tt++;
       }
     }


-tt--; /* lose final . */
+tt--; /* lose final separator */

   if (mask < 0)
     *tt = 0;


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


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -1866,7 +1866,8 @@
       /* Adjust parameters for the type of lookup. For a query-style
       lookup, there is no file name, and the "key" is just the query. For
       a single-key lookup, the key is the current IP address, masked
  -    appropriately, and reconverted to text form, with the mask appended. */
  +    appropriately, and reconverted to text form, with the mask appended. 
  +    For IPv6 addresses, specify dot separators instead of colons. */


       if (mac_islookup(search_type, lookup_querystyle))
         {
  @@ -1877,7 +1878,7 @@
         {
         insize = host_aton(cb->host_address, incoming);
         host_mask(insize, incoming, mlen);
  -      (void)host_nmtoa(insize, incoming, mlen, buffer);
  +      (void)host_nmtoa(insize, incoming, mlen, buffer, '.');
         key = buffer;
         filename = semicolon + 1;
         }


Index: 595
====================================================================
# Exim test configuration 595

# 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_connect = check_connect


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

begin acl

  check_connect:
    warn    log_message = matched hostlist 
            hosts = <; 2001:ab8:37f:20:0:0:0:1


    accept  condition = ${if eq{$sender_host_address}{2001:0ab8:037f:0020:0000:0000:0000:0001}}


# End

Index: 595
====================================================================
0 -bh and non-canonical IPv6 addresses
exim -bh 2001:ab8:37f:20::1.999
****

Index: 595
====================================================================
>>> host in hosts_connection_nolog? no (option unset)
>>> host in host_lookup? no (option unset)
>>> host in host_reject_connection? no (option unset)
>>> host in sender_unqualified_hosts? no (option unset)
>>> host in recipient_unqualified_hosts? no (option unset)
>>> host in helo_verify_hosts? no (option unset)
>>> host in helo_try_verify_hosts? no (option unset)
>>> host in helo_accept_junk_hosts? no (option unset)
>>> using ACL "check_connect"
>>> processing "warn"
>>> check hosts = <; 2001:ab8:37f:20:0:0:0:1
>>> host in "<; 2001:ab8:37f:20:0:0:0:1"? yes (matched "2001:ab8:37f:20:0:0:0:1")
>>> warn: condition test succeeded

LOG: H=[2001:0ab8:037f:0020:0000:0000:0000:0001] Warning: matched hostlist
  >>> processing "accept"
  >>> check condition = ${if eq{$sender_host_address}{2001:0ab8:037f:0020:0000:0000:0000:0001}}
  >>>                 = true
  >>> accept: condition test succeeded


Index: 595
====================================================================

**** SMTP testing session as if from host 2001:0ab8:037f:0020:0000:0000:0000:0001
**** but without any ident (RFC 1413) callback.
**** This is not for real!

220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
421 myhost.test.ex lost input connection