git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
652e1b6
)
Canonicize IPv6 addresses that are supplied via -bh or -bhc.
author
Philip Hazel
<ph10@hermes.cam.ac.uk>
Thu, 18 Nov 2004 11:17:33 +0000
(11:17 +0000)
committer
Philip Hazel
<ph10@hermes.cam.ac.uk>
Thu, 18 Nov 2004 11:17:33 +0000
(11:17 +0000)
doc/doc-txt/ChangeLog
patch
|
blob
|
history
src/src/exim.c
patch
|
blob
|
history
src/src/expand.c
patch
|
blob
|
history
src/src/functions.h
patch
|
blob
|
history
src/src/host.c
patch
|
blob
|
history
src/src/verify.c
patch
|
blob
|
history
diff --git
a/doc/doc-txt/ChangeLog
b/doc/doc-txt/ChangeLog
index 8eb25ac9e274bf109f31bb0692684c9ffdfda3f8..8a8f552f45fc8466eb6684d0586b6c5149bf3778 100644
(file)
--- a/
doc/doc-txt/ChangeLog
+++ b/
doc/doc-txt/ChangeLog
@@
-1,4
+1,4
@@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.3
2 2004/11/18 10:35:18
ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.3
3 2004/11/18 11:17:33
ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
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.
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
-----------------
Exim version 4.43
-----------------
diff --git
a/src/src/exim.c
b/src/src/exim.c
index 6664ea2146216f3c23ab798aa3731dd24faa8cfc..e643cdeec1aa301aa22193972ec8a3ec5236b850 100644
(file)
--- 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 *
/*************************************************
* Exim - an Internet mail transport agent *
@@
-4094,10
+4094,22
@@
call to find the ident for. */
if (host_checking)
{
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);
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;
host_build_sender_fullhost();
smtp_input = TRUE;
diff --git
a/src/src/expand.c
b/src/src/expand.c
index f580d3820f1a3671d65530bae649b59d9465db4b..1bdcd3760c0d061055d258985232d1ef53a4337c 100644
(file)
--- 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 *
/*************************************************
* 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,
/* 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;
}
continue;
}
diff --git
a/src/src/functions.h
b/src/src/functions.h
index 85fc1760707b570a8abee12f71fae0e4d07efe4a..493575d36b6e599f9a8faf93b1a2f53b7b1ab73e 100644
(file)
--- 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 *
/*************************************************
* 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 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 *);
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 2809e7e07f63ee65b6b62d6e536b36e735d60633..fb58ab4da32d14b466ab76dbf18c58c2bc7d1f31 100644
(file)
--- 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 *
/*************************************************
* 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
/* 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
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
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;
{
int i, j;
uschar *tt = buffer;
@@
-890,12
+892,12
@@
else
for (i = 0; i < 4; i++)
{
j = binary[i];
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++;
}
}
while (*tt) tt++;
}
}
-tt--; /* lose final
.
*/
+tt--; /* lose final
separator
*/
if (mask < 0)
*tt = 0;
if (mask < 0)
*tt = 0;
diff --git
a/src/src/verify.c
b/src/src/verify.c
index e8d43eed998f0720746cc9e7340500670e767aba..cd2ae666c8f15b4661ed92a89c1d9f7b197bb65c 100644
(file)
--- 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 *
/*************************************************
* 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
/* 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))
{
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);
{
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;
}
key = buffer;
filename = semicolon + 1;
}