ph10 2005/01/11 15:51:03 GMT
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src exim.c host.c route.c verify.c
exim-src/src/lookups dnsdb.c lsearch.c
exim-src/src/routers dnslookup.c ipliteral.c
rf_lookup_hostlist.c
exim-src/src/transports smtp.c
Log:
Corrected several mis-calls of is_ip_address() that treated the result
as a boolean instead of an int.
Revision Changes Path
1.65 +5 -0 exim/exim-doc/doc-txt/ChangeLog
1.13 +2 -2 exim/exim-src/src/exim.c
1.6 +1 -1 exim/exim-src/src/host.c
1.9 +1 -1 exim/exim-src/src/lookups/dnsdb.c
1.3 +2 -2 exim/exim-src/src/lookups/lsearch.c
1.4 +1 -1 exim/exim-src/src/route.c
1.3 +1 -1 exim/exim-src/src/routers/dnslookup.c
1.4 +1 -1 exim/exim-src/src/routers/ipliteral.c
1.3 +1 -1 exim/exim-src/src/routers/rf_lookup_hostlist.c
1.5 +1 -1 exim/exim-src/src/transports/smtp.c
1.10 +4 -3 exim/exim-src/src/verify.c
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- ChangeLog 4 Jan 2005 16:36:27 -0000 1.64
+++ ChangeLog 11 Jan 2005 15:51:02 -0000 1.65
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.64 2005/01/04 16:36:27 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.65 2005/01/11 15:51:02 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -291,6 +291,11 @@
the caching.)
66. Added hosts_max_try_hardlimit to the smtp transport, default 50.
+
+67. The string_is_ip_address() function returns 0, 4, or 6, for "no an IP
+ address", "IPv4 address", and "IPv6 address", respectively. Some calls of
+ the function were treating the return as a boolean value, which happened to
+ work because 0=false and not-0=true, but is not correct code.
Exim version 4.43
Index: exim.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/exim.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- exim.c 4 Jan 2005 10:00:42 -0000 1.12
+++ exim.c 11 Jan 2005 15:51:02 -0000 1.13
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/exim.c,v 1.12 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/exim.c,v 1.13 2005/01/11 15:51:02 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -599,7 +599,7 @@
check_port(uschar *address)
{
int port = host_extract_port(address);
-if (!string_is_ip_address(address, NULL))
+if (string_is_ip_address(address, NULL) == 0)
{
fprintf(stderr, "exim abandoned: \"%s\" is not an IP address\n", address);
exit(EXIT_FAILURE);
@@ -622,7 +622,7 @@
flags flag bits for verify_address()
exit_value to be set for failures
-Returns: nothint
+Returns: nothing
*/
static void
Index: host.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/host.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- host.c 4 Jan 2005 10:00:42 -0000 1.5
+++ host.c 11 Jan 2005 15:51:02 -0000 1.6
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/host.c,v 1.5 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/host.c,v 1.6 2005/01/11 15:51:02 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -493,7 +493,7 @@
while ((s = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL)
{
int port = host_extract_port(s); /* Leaves just the IP address */
- if (!string_is_ip_address(s, NULL))
+ if (string_is_ip_address(s, NULL) == 0)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Malformed IP address \"%s\" in %s",
s, name);
Index: route.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/route.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- route.c 4 Jan 2005 10:00:42 -0000 1.3
+++ route.c 11 Jan 2005 15:51:02 -0000 1.4
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/route.c,v 1.3 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/route.c,v 1.4 2005/01/11 15:51:02 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1854,7 +1854,7 @@
DEBUG(D_route) debug_printf("%s [%s] translated to %s\n",
h->name, h->address, newaddress);
- if (string_is_ip_address(newaddress, NULL))
+ if (string_is_ip_address(newaddress, NULL) > 0)
{
h->address = newaddress;
continue;
Index: verify.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/verify.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- verify.c 4 Jan 2005 10:00:42 -0000 1.9
+++ verify.c 11 Jan 2005 15:51:02 -0000 1.10
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/verify.c,v 1.9 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/verify.c,v 1.10 2005/01/11 15:51:02 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1049,7 +1049,8 @@
for (host = host_list; host != NULL; host = nexthost)
{
nexthost = host->next;
- if (tf.gethostbyname || string_is_ip_address(host->name, NULL))
+ if (tf.gethostbyname ||
+ string_is_ip_address(host->name, NULL) > 0)
(void)host_find_byname(host, NULL, &canonical_name, TRUE);
else
{
@@ -1830,7 +1831,7 @@
/* If the pattern is an IP address, optionally followed by a bitmask count, do
a (possibly masked) comparision with the current IP address. */
-if (string_is_ip_address(ss, &maskoffset))
+if (string_is_ip_address(ss, &maskoffset) > 0)
return (host_is_in_net(cb->host_address, ss, maskoffset)? OK : FAIL);
/* If the item is of the form net[n]-lookup;<file|query> then it is a lookup on
@@ -2600,7 +2601,7 @@
while ((keydomain = string_nextinlist(&key, &keysep, keybuffer,
sizeof(keybuffer))) != NULL)
{
- if (string_is_ip_address(keydomain, NULL))
+ if (string_is_ip_address(keydomain, NULL) > 0)
{
uschar keyrevadd[128];
invert_address(keyrevadd, keydomain);
Index: dnsdb.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/lookups/dnsdb.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- dnsdb.c 4 Jan 2005 10:00:44 -0000 1.8
+++ dnsdb.c 11 Jan 2005 15:51:03 -0000 1.9
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/lookups/dnsdb.c,v 1.8 2005/01/04 10:00:44 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/lookups/dnsdb.c,v 1.9 2005/01/11 15:51:03 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -236,7 +236,7 @@
records for different purposes where the key string is a host name). This
code for doing the reversal is now in a separate function. */
- if (type == T_PTR && string_is_ip_address(domain, NULL))
+ if (type == T_PTR && string_is_ip_address(domain, NULL) > 0)
{
dns_build_reverse(domain, rbuffer);
domain = rbuffer;
Index: lsearch.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/lookups/lsearch.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lsearch.c 4 Jan 2005 10:00:44 -0000 1.2
+++ lsearch.c 11 Jan 2005 15:51:03 -0000 1.3
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/lookups/lsearch.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/lookups/lsearch.c,v 1.3 2005/01/11 15:51:03 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -213,7 +213,7 @@
int maskoffset;
int save = buffer[linekeylength];
buffer[linekeylength] = 0;
- if (!string_is_ip_address(buffer, &maskoffset) ||
+ if (string_is_ip_address(buffer, &maskoffset) == 0 ||
!host_is_in_net(keystring, buffer, maskoffset)) continue;
buffer[linekeylength] = save;
}
@@ -369,7 +369,7 @@
{
do_cache = do_cache; /* Keep picky compilers happy */
if ((length == 1 && keystring[0] == '*') ||
- string_is_ip_address(keystring, NULL))
+ string_is_ip_address(keystring, NULL) > 0)
{
return internal_lsearch_find(handle, filename, keystring, length, result,
errmsg, LSEARCH_IP);
Index: dnslookup.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/routers/dnslookup.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dnslookup.c 4 Jan 2005 10:00:44 -0000 1.2
+++ dnslookup.c 11 Jan 2005 15:51:03 -0000 1.3
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/routers/dnslookup.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/routers/dnslookup.c,v 1.3 2005/01/11 15:51:03 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -305,7 +305,7 @@
else
{
addr->message = US"all relevant MX records point to non-existent hosts";
- if (!allow_mx_to_ip && string_is_ip_address(h.name, NULL))
+ if (!allow_mx_to_ip && string_is_ip_address(h.name, NULL) > 0)
{
addr->user_message =
string_sprintf("It appears that the DNS operator for %s\n"
Index: ipliteral.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/routers/ipliteral.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ipliteral.c 4 Jan 2005 10:00:44 -0000 1.3
+++ ipliteral.c 11 Jan 2005 15:51:03 -0000 1.4
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/routers/ipliteral.c,v 1.3 2005/01/04 10:00:44 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/routers/ipliteral.c,v 1.4 2005/01/11 15:51:03 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -118,7 +118,7 @@
if (domain[0] != '[' || domain[len-1] != ']') return DECLINE;
domain[len-1] = 0; /* temporarily */
-if (!string_is_ip_address(domain+1, NULL))
+if (string_is_ip_address(domain+1, NULL) == 0)
{
domain[len-1] = ']';
return DECLINE;
Index: rf_lookup_hostlist.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/routers/rf_lookup_hostlist.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- rf_lookup_hostlist.c 4 Jan 2005 10:00:44 -0000 1.2
+++ rf_lookup_hostlist.c 11 Jan 2005 15:51:03 -0000 1.3
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/routers/rf_lookup_hostlist.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/routers/rf_lookup_hostlist.c,v 1.3 2005/01/11 15:51:03 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -92,7 +92,7 @@
/* If explicitly configured to look up by name, or if the "host name" is
actually an IP address, do a byname lookup. */
- else if (lookup_type == lk_byname || string_is_ip_address(h->name, NULL))
+ else if (lookup_type == lk_byname || string_is_ip_address(h->name, NULL) > 0)
{
DEBUG(D_route|D_host_lookup) debug_printf("calling host_find_byname\n");
rc = host_find_byname(h, ignore_target_hosts, &canonical_name, TRUE);
Index: smtp.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/smtp.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- smtp.c 4 Jan 2005 16:36:28 -0000 1.4
+++ smtp.c 11 Jan 2005 15:51:03 -0000 1.5
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/smtp.c,v 1.4 2005/01/04 16:36:28 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/smtp.c,v 1.5 2005/01/11 15:51:03 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2177,7 +2177,7 @@
/* Find by name if so configured, or if it's an IP address. We don't
just copy the IP address, because we need the test-for-local to happen. */
- if (ob->gethostbyname || string_is_ip_address(host->name, NULL))
+ if (ob->gethostbyname || string_is_ip_address(host->name, NULL) > 0)
rc = host_find_byname(host, NULL, &canonical_name, TRUE);
else
{