From 6a3bceb1162da6104bf656ecde9890c03cc2328d Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 8 May 2007 13:08:22 +0000 Subject: [PATCH] Use colon, not dot, as IPv6 separator in host-list lookups that use the iplsearch lookup type. --- doc/doc-txt/ChangeLog | 19 ++++++++++++++++++- src/src/verify.c | 11 +++++++---- test/aux-fixed/0002.matchip | 1 + test/scripts/0000-Basic/0002 | 1 + test/stdout/0002 | 1 + 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index e6ecdce5b..b21876ec8 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -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 ------------------------------------------- @@ -8,6 +8,23 @@ Exim version 4.68 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 ----------------- diff --git a/src/src/verify.c b/src/src/verify.c index 666790601..23f63d803 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -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 * @@ -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 - dot separators instead of colons. */ + dot separators instead of colons, except when the lookup type is "iplsearch". + */ if (mac_islookup(search_type, lookup_absfilequery)) { @@ -2216,11 +2217,13 @@ if (iplookup) 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); - (void)host_nmtoa(insize, incoming, mlen, buffer, '.'); + (void)host_nmtoa(insize, incoming, mlen, buffer, sep); key = buffer; filename = semicolon + 1; } diff --git a/test/aux-fixed/0002.matchip b/test/aux-fixed/0002.matchip index 90bb0ea09..6b4263544 100644 --- a/test/aux-fixed/0002.matchip +++ b/test/aux-fixed/0002.matchip @@ -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 +"abcd::dcba": data for abcd::dcba diff --git a/test/scripts/0000-Basic/0002 b/test/scripts/0000-Basic/0002 index fd332afa4..bf604477b 100644 --- a/test/scripts/0000-Basic/0002 +++ b/test/scripts/0000-Basic/0002 @@ -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: 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}} diff --git a/test/stdout/0002 b/test/stdout/0002 index f76f07f51..2b2b0881f 100644 --- a/test/stdout/0002 +++ b/test/stdout/0002 @@ -345,6 +345,7 @@ > match_ip: 12 true > match_ip: 13 true > match_ip: 14 true +> match_ip: 15 true > > queue_running: n > first_delivery: n -- 2.25.1