git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update all copyright messages to cover 1995 - 2009. Remove tab from exim_checkaccess.src
[exim.git]
/
src
/
src
/
routers
/
ipliteral.c
diff --git
a/src/src/routers/ipliteral.c
b/src/src/routers/ipliteral.c
index ac99fd9899ba11cdc683bd45f7138a25bc1bdece..13eebf96eceb5f61bf676de94a3031a307b44ff6 100644
(file)
--- a/
src/src/routers/ipliteral.c
+++ b/
src/src/routers/ipliteral.c
@@
-1,10
+1,10
@@
-/* $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.
10 2009/11/16 19:50:38 nm4
Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 200
5
*/
+/* Copyright (c) University of Cambridge 1995 - 200
9
*/
/* See the file NOTICE for conditions of use and distribution. */
/* See the file NOTICE for conditions of use and distribution. */
@@
-102,8
+102,9
@@
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 len = Ustrlen(domain);
-int rc;
+int rc
, ipv
;
addr_new = addr_new; /* Keep picky compilers happy */
addr_succeed = addr_succeed;
addr_new = addr_new; /* Keep picky compilers happy */
addr_succeed = addr_succeed;
@@
-111,14
+112,20
@@
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;
+
+ipv = string_is_ip_address(ip, NULL);
+if (ipv == 0 || (disable_ipv6 && ipv == 6))
{
domain[len-1] = ']';
return DECLINE;
{
domain[len-1] = ']';
return DECLINE;
@@
-128,10
+135,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
+149,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);