summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/doc-txt/ChangeLog6
-rw-r--r--src/src/exim.c14
-rw-r--r--src/src/expand.c4
-rw-r--r--src/src/functions.h4
-rw-r--r--src/src/host.c16
-rw-r--r--src/src/verify.c7
6 files changed, 35 insertions, 16 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 8eb25ac9e..8a8f552f4 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.32 2004/11/18 10:35:18 ph10 Exp $
+$Cambridge: 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
-------------------------------------------
@@ -138,6 +138,10 @@ Exim version 4.44
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
-----------------
diff --git a/src/src/exim.c b/src/src/exim.c
index 6664ea214..e643cdeec 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/exim.c,v 1.8 2004/11/10 10:29:56 ph10 Exp $ */
+/* $Cambridge: 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 @@ call to find the ident for. */
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;
diff --git a/src/src/expand.c b/src/src/expand.c
index f580d3820..1bdcd3760 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.6 2004/11/17 16:12:26 ph10 Exp $ */
+/* $Cambridge: 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 @@ while (*s != 0)
/* 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;
}
diff --git a/src/src/functions.h b/src/src/functions.h
index 85fc17607..493575d36 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/functions.h,v 1.3 2004/11/17 14:32:25 ph10 Exp $ */
+/* $Cambridge: 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_in_net(uschar *, uschar *, int);
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 *);
diff --git a/src/src/host.c b/src/src/host.c
index 2809e7e07..fb58ab4da 100644
--- a/src/src/host.c
+++ b/src/src/host.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/host.c,v 1.2 2004/11/12 16:54:55 ph10 Exp $ */
+/* $Cambridge: 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 @@ for (i = 0; i < count; i++)
/* 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 @@ else
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;
diff --git a/src/src/verify.c b/src/src/verify.c
index e8d43eed9..cd2ae666c 100644
--- a/src/src/verify.c
+++ b/src/src/verify.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/verify.c,v 1.5 2004/11/12 16:54:55 ph10 Exp $ */
+/* $Cambridge: 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 @@ if (Ustrncmp(ss, "net", 3) == 0 && (semicolon = Ustrchr(ss, ';')) != NULL)
/* 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 @@ if (Ustrncmp(ss, "net", 3) == 0 && (semicolon = Ustrchr(ss, ';')) != NULL)
{
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;
}