ipliteral was not recognizing "ipv6" prefix.
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Mon, 5 Dec 2005 14:38:18 +0000 (14:38 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Mon, 5 Dec 2005 14:38:18 +0000 (14:38 +0000)
doc/doc-docbook/spec.ascd
doc/doc-txt/ChangeLog
src/src/routers/ipliteral.c

index 5d83e78b6a4469a260f092bc7ff22f42f16b7634..0fb9137d57949739632a50787405c261554b8a30 100644 (file)
@@ -1,5 +1,5 @@
 ////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////
-$Cambridge: exim/doc/doc-docbook/spec.ascd,v 1.3 2005/11/15 16:10:50 ph10 Exp $
+$Cambridge: exim/doc/doc-docbook/spec.ascd,v 1.4 2005/12/05 14:38:18 ph10 Exp $
 
 This is the primary source of the Exim Manual. It is an AsciiDoc document
 that is converted into DocBook XML for subsequent conversion into printing
 
 This is the primary source of the Exim Manual. It is an AsciiDoc document
 that is converted into DocBook XML for subsequent conversion into printing
@@ -12040,7 +12040,7 @@ Processing messages
 %check_rfc2047_length%              check length of RFC 2047 ``encoded words''
 %delivery_date_remove%              from incoming messages
 %envelope_to_remote%                from incoming messages
 %check_rfc2047_length%              check length of RFC 2047 ``encoded words''
 %delivery_date_remove%              from incoming messages
 %envelope_to_remote%                from incoming messages
-%extract_addresses_remove_arguments%affects %-t% processing
+%extract_addresses_remove_arguments% affects %-t% processing
 %headers_charset%                   default for translations
 %qualify_domain%                    default for senders
 %qualify_recipient%                 default for recipients
 %headers_charset%                   default for translations
 %qualify_domain%                    default for senders
 %qualify_recipient%                 default for recipients
index 1c87258619a5d3cc8833cca6e1888f60c6f41038..c95c33777c8b5d7b7af1035c0d792ae1267ef28c 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.269 2005/12/01 14:21:25 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.270 2005/12/05 14:38:18 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -14,6 +14,9 @@ PH/01 The code for finding all the local interface addresses on a FreeBSD
       that it would not match correctly against @[] and not recognize the IPv6
       addresses as local.
 
       that it would not match correctly against @[] and not recognize the IPv6
       addresses as local.
 
+PH/02 The ipliteral router was not recognizing addresses of the form user@
+      [ipv6:....] because it didn't know about the "ipv6:" prefix.
+
 
 Exim version 4.60
 -----------------
 
 Exim version 4.60
 -----------------
index ac99fd9899ba11cdc683bd45f7138a25bc1bdece..2b33a83cd70855fd5f9c4b997be02227b8644ea4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/routers/ipliteral.c,v 1.5 2005/09/12 15:09:55 ph10 Exp $ */
+/* $Cambridge: exim/src/src/routers/ipliteral.c,v 1.6 2005/12/05 14:38:18 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -102,6 +102,7 @@ ipliteral_router_options_block *ob =
 */
 host_item *h;
 uschar *domain = addr->domain;
 */
 host_item *h;
 uschar *domain = addr->domain;
+uschar *ip;
 int len = Ustrlen(domain);
 int rc;
 
 int len = Ustrlen(domain);
 int rc;
 
@@ -111,14 +112,19 @@ addr_succeed = addr_succeed;
 DEBUG(D_route) debug_printf("%s router called for %s: domain = %s\n",
   rblock->name, addr->address, addr->domain);
 
 DEBUG(D_route) debug_printf("%s router called for %s: domain = %s\n",
   rblock->name, addr->address, addr->domain);
 
-/* Check that the domain is an IP address enclosed in square brackets. If
-not, the router declines. Otherwise route to the single IP address, setting the
-host name to "(unnamed)". */
+/* Check that the domain is an IP address enclosed in square brackets. Remember
+to allow for the "official" form of IPv6 addresses. If not, the router
+declines. Otherwise route to the single IP address, setting the host name to
+"(unnamed)". */
 
 if (domain[0] != '[' || domain[len-1] != ']') return DECLINE;
 domain[len-1] = 0;  /* temporarily */
 
 
 if (domain[0] != '[' || domain[len-1] != ']') return DECLINE;
 domain[len-1] = 0;  /* temporarily */
 
-if (string_is_ip_address(domain+1, NULL) == 0)
+ip = domain + 1;
+if (strncmpic(ip, US"IPV6:", 5) == 0 || strncmpic(ip, US"IPV4:", 5) == 0)
+  ip += 5;
+
+if (string_is_ip_address(ip, NULL) == 0)
   {
   domain[len-1] = ']';
   return DECLINE;
   {
   domain[len-1] = ']';
   return DECLINE;
@@ -128,10 +134,10 @@ if (string_is_ip_address(domain+1, NULL) == 0)
 but if it is set, it should probably work. */
 
 if (verify_check_this_host(&(rblock->ignore_target_hosts), NULL, domain,
 but if it is set, it should probably work. */
 
 if (verify_check_this_host(&(rblock->ignore_target_hosts), NULL, domain,
-      domain + 1, NULL) == OK)
+      ip, NULL) == OK)
   {
   DEBUG(D_route)
   {
   DEBUG(D_route)
-      debug_printf("%s is in ignore_target_hosts\n", domain+1);
+      debug_printf("%s is in ignore_target_hosts\n", ip);
   addr->message = US"IP literal host explicitly ignored";
   domain[len-1] = ']';
   return DECLINE;
   addr->message = US"IP literal host explicitly ignored";
   domain[len-1] = ']';
   return DECLINE;
@@ -142,7 +148,7 @@ if (verify_check_this_host(&(rblock->ignore_target_hosts), NULL, domain,
 h = store_get(sizeof(host_item));
 
 h->next = NULL;
 h = store_get(sizeof(host_item));
 
 h->next = NULL;
-h->address = string_copy(domain+1);
+h->address = string_copy(ip);
 h->port = PORT_NONE;
 domain[len-1] = ']';   /* restore */
 h->name = string_copy(domain);
 h->port = PORT_NONE;
 domain[len-1] = ']';   /* restore */
 h->name = string_copy(domain);