From dac79d3efbba76b420f6d89cdb1dcd276e2ced00 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Mon, 13 Feb 2006 16:23:57 +0000 Subject: [PATCH] Fix "(during SMTP connection from NULL)" bug. --- doc/doc-txt/ChangeLog | 7 ++++++- src/src/smtp_in.c | 15 ++++++++++----- test/dnszones-src/db.ip4.V4NET | 8 ++++++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 4aeffb78d..6febd4d85 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.294 2006/02/13 12:02:59 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.295 2006/02/13 16:23:57 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -143,6 +143,11 @@ PH/25 Do not write to syslog when running in the test harness. The only PH/26 Added the /no_tell option to "control=freeze". +PH/27 If a host name lookup failed very early in a connection, for example, if + the IP address matched host_lookup and the reverse lookup yielded a name + that did not have a forward lookup, an error message of the form "no IP + address found for host xxx.xxx.xxx (during SMTP connection from NULL)" + could be logged. Now it outputs the IP address instead of "NULL". Exim version 4.60 diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index cc6486a40..a6a14fe2f 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/smtp_in.c,v 1.31 2006/02/13 12:02:59 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_in.c,v 1.32 2006/02/13 16:23:57 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -626,6 +626,8 @@ for (;;) /* This function is called when logging information about an SMTP connection. It sets up appropriate source information, depending on the type of connection. +If sender_fullhost is NULL, we are at a very early stage of the connection; +just use the IP address. Argument: none Returns: a string describing the connection @@ -634,21 +636,24 @@ Returns: a string describing the connection uschar * smtp_get_connection_info(void) { +uschar *hostname = (sender_fullhost == NULL)? + sender_host_address : sender_fullhost; + if (host_checking) - return string_sprintf("SMTP connection from %s", sender_fullhost); + return string_sprintf("SMTP connection from %s", hostname); if (sender_host_unknown || sender_host_notsocket) return string_sprintf("SMTP connection from %s", sender_ident); if (is_inetd) - return string_sprintf("SMTP connection from %s (via inetd)", sender_fullhost); + return string_sprintf("SMTP connection from %s (via inetd)", hostname); if ((log_extra_selector & LX_incoming_interface) != 0 && interface_address != NULL) - return string_sprintf("SMTP connection from %s I=[%s]:%d", sender_fullhost, + return string_sprintf("SMTP connection from %s I=[%s]:%d", hostname, interface_address, interface_port); -return string_sprintf("SMTP connection from %s", sender_fullhost); +return string_sprintf("SMTP connection from %s", hostname); } diff --git a/test/dnszones-src/db.ip4.V4NET b/test/dnszones-src/db.ip4.V4NET index b7419f561..2caad55ba 100644 --- a/test/dnszones-src/db.ip4.V4NET +++ b/test/dnszones-src/db.ip4.V4NET @@ -1,4 +1,4 @@ -; $Cambridge: exim/test/dnszones-src/db.ip4.V4NET,v 1.1 2006/02/06 16:22:56 ph10 Exp $ +; $Cambridge: exim/test/dnszones-src/db.ip4.V4NET,v 1.2 2006/02/13 16:23:57 ph10 Exp $ ; This is a testing reverse zone file for use when testing DNS handling in ; Exim. This is a fake zone of no real use - hence no SOA record. The zone name @@ -48,11 +48,15 @@ 96.99.99 PTR x.test.again.dns. ; This IP number points back to a legitimate host, but also to a name that -; isn't forward registered +; does not forward resolve to the same address 90.99.99 PTR oneback.test.ex. 90.99.99 PTR host1.masq.test.ex. +; This IP number points back to a host that does not exist + +80.99.99 PTR nonexist.test.ex. + ; This is a duff registration for testing 255.255.255 PTR . -- 2.25.1