Use colon, not dot, as IPv6 separator in host-list lookups that use the
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 8 May 2007 13:08:22 +0000 (13:08 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 8 May 2007 13:08:22 +0000 (13:08 +0000)
iplsearch lookup type.

doc/doc-txt/ChangeLog
src/src/verify.c
test/aux-fixed/0002.matchip
test/scripts/0000-Basic/0002
test/stdout/0002

index e6ecdce5be667b2b4b5caebadbb911a0842da0eb..b21876ec80d01d590d7c15b6d8d9bc7e93185405 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.505 2007/04/19 13:19:06 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.506 2007/05/08 13:08:22 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -8,6 +8,23 @@ Exim version 4.68
 
 PH/01 Another patch from the Sieve maintainer.
 
 
 PH/01 Another patch from the Sieve maintainer.
 
+PH/02 When an IPv6 address is converted to a string for single-key lookup
+      in an address list (e.g. for an item such as "net24-dbm;/net/works"),
+      dots are used instead of colons so that keys in lsearch files need not
+      contain colons. This was done some time before quoting was made available
+      in lsearch files. However, iplsearch files do require colons in IPv6 keys
+      (notated using the quote facility) so as to distinguish them from IPv4
+      keys. This meant that lookups for IP addresses in host lists did not work
+      for iplsearch lookups.
+
+      This has been fixed by arranging for IPv6 addresses to be expressed with
+      colons if the lookup type is iplsearch. This is not incompatible, because
+      previously such lookups could never work.
+
+      The situation is now rather anomolous, since one *can* have colons in
+      ordinary lsearch keys. However, making the change in all cases is
+      incompatible and would probably break a number of configurations.
+
 
 Exim version 4.67
 -----------------
 
 Exim version 4.67
 -----------------
index 666790601ed2cc92770922cab60d160f176b4545..23f63d803b997dcdcf2cd3631fc47be64940a88c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/verify.c,v 1.49 2007/03/01 11:17:00 ph10 Exp $ */
+/* $Cambridge: exim/src/src/verify.c,v 1.50 2007/05/08 13:08:22 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -2201,7 +2201,8 @@ if (iplookup)
   name, we have to fish the file off the start of 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. For IPv6 addresses, specify
   name, we have to fish the file off the start of 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. For IPv6 addresses, specify
-  dot separators instead of colons. */
+  dot separators instead of colons, except when the lookup type is "iplsearch".
+  */
 
   if (mac_islookup(search_type, lookup_absfilequery))
     {
 
   if (mac_islookup(search_type, lookup_absfilequery))
     {
@@ -2216,11 +2217,13 @@ if (iplookup)
     filename = NULL;
     key = semicolon + 1;
     }
     filename = NULL;
     key = semicolon + 1;
     }
-  else
+  else   /* Single-key style */
     {
     {
+    int sep = (Ustrcmp(lookup_list[search_type].name, "iplsearch") == 0)?
+      ':' : '.';
     insize = host_aton(cb->host_address, incoming);
     host_mask(insize, incoming, mlen);
     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, sep);
     key = buffer;
     filename = semicolon + 1;
     }
     key = buffer;
     filename = semicolon + 1;
     }
index 90bb0ea09a2c30ca68d7f95b68f7817de27b4888..6b42635449fa2a4c16132e6aa9456564624d4bf1 100644 (file)
@@ -1,2 +1,3 @@
 1.2.3.4:    data for 1.2.3.4
 5.6.7.0/24: data for 5.6.7.0/24
 1.2.3.4:    data for 1.2.3.4
 5.6.7.0/24: data for 5.6.7.0/24
+"abcd::dcba": data for abcd::dcba
index fd332afa46e2ece74109afadc2df8f685682e20d..bf604477b9a02c6587aaf7c4532ceccba7c945e4 100644 (file)
@@ -375,6 +375,7 @@ match_ip:        11 ${if match_ip{somename}{+hlist}}
 match_ip:        12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}}
 match_ip:        13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}}
 match_ip:        14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}}
 match_ip:        12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}}
 match_ip:        13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}}
 match_ip:        14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}}
+match_ip:        15 ${if match_ip{abcd::dcba}{net-iplsearch;DIR/aux-fixed/0002.matchip}}
 
 queue_running:  ${if queue_running{y}{n}}
 first_delivery: ${if first_delivery{y}{n}}
 
 queue_running:  ${if queue_running{y}{n}}
 first_delivery: ${if first_delivery{y}{n}}
index f76f07f518ff7251098cc07cd4e10651231d9907..2b2b0881f898e2d4e9ceb944b68248af8d9f8713 100644 (file)
 > match_ip:        12 true
 > match_ip:        13 true
 > match_ip:        14 true
 > match_ip:        12 true
 > match_ip:        13 true
 > match_ip:        14 true
+> match_ip:        15 true
 > 
 > queue_running:  n
 > first_delivery: n
 > 
 > queue_running:  n
 > first_delivery: n