configuration). If a CNAME target was not a wellformed name pattern, a
crash could result.
configuration). If a CNAME target was not a wellformed name pattern, a
crash could result.
+JH/09 Logging: Fix initial listening-on line for multiple ports for an IP when
+ the OS reports them interleaved with other addresses.
+
+
Exim version 4.92
-----------------
Exim version 4.92
-----------------
int i, j;
int smtp_ports = 0;
int smtps_ports = 0;
int i, j;
int smtp_ports = 0;
int smtps_ports = 0;
- ip_address_item * ipa, * i2;
- uschar * p = big_buffer;
+ ip_address_item * ipa;
+ uschar * p;
uschar * qinfo = queue_interval > 0
? string_sprintf("-q%s", readconf_printtime(queue_interval))
: US"no queue runs";
uschar * qinfo = queue_interval > 0
? string_sprintf("-q%s", readconf_printtime(queue_interval))
: US"no queue runs";
deprecated protocol that starts TLS without using STARTTLS), and others
listening for standard SMTP. Keep their listings separate. */
deprecated protocol that starts TLS without using STARTTLS), and others
listening for standard SMTP. Keep their listings separate. */
- for (j = 0; j < 2; j++)
+ for (int j = 0, i; j < 2; j++)
{
for (i = 0, ipa = addresses; i < 10 && ipa; i++, ipa = ipa->next)
{
/* First time round, look for SMTP ports; second time round, look for
{
for (i = 0, ipa = addresses; i < 10 && ipa; i++, ipa = ipa->next)
{
/* First time round, look for SMTP ports; second time round, look for
- SMTPS ports. For the first one of each, insert leading text. */
+ SMTPS ports. Build IP+port strings. */
if (host_is_tls_on_connect_port(ipa->port) == (j > 0))
{
if (j == 0)
if (host_is_tls_on_connect_port(ipa->port) == (j > 0))
{
if (j == 0)
- {
- if (smtp_ports++ == 0)
- {
- memcpy(p, "SMTP on", 8);
- p += 7;
- }
- }
- if (smtps_ports++ == 0)
- p += sprintf(CS p, "%sSMTPS on",
- smtp_ports == 0 ? "" : " and for ");
/* Now the information about the port (and sometimes interface) */
/* Now the information about the port (and sometimes interface) */
if (ipa->next && ipa->next->address[0] == 0 &&
ipa->next->port == ipa->port)
{
if (ipa->next && ipa->next->address[0] == 0 &&
ipa->next->port == ipa->port)
{
- p += sprintf(CS p, " port %d (IPv6 and IPv4)", ipa->port);
- ipa = ipa->next;
+ ipa->log = string_sprintf(" port %d (IPv6 and IPv4)", ipa->port);
+ (ipa = ipa->next)->log = NULL;
}
else if (ipa->v6_include_v4)
}
else if (ipa->v6_include_v4)
- p += sprintf(CS p, " port %d (IPv6 with IPv4)", ipa->port);
+ ipa->log = string_sprintf(" port %d (IPv6 with IPv4)", ipa->port);
- p += sprintf(CS p, " port %d (IPv6)", ipa->port);
+ ipa->log = string_sprintf(" port %d (IPv6)", ipa->port);
}
else if (ipa->address[0] == 0) /* v4 wildcard */
}
else if (ipa->address[0] == 0) /* v4 wildcard */
- p += sprintf(CS p, " port %d (IPv4)", ipa->port);
+ ipa->log = string_sprintf(" port %d (IPv4)", ipa->port);
else /* check for previously-seen IP */
{
else /* check for previously-seen IP */
{
for (i2 = addresses; i2 != ipa; i2 = i2->next)
if ( host_is_tls_on_connect_port(i2->port) == (j > 0)
&& Ustrcmp(ipa->address, i2->address) == 0
)
{ /* found; append port to list */
for (i2 = addresses; i2 != ipa; i2 = i2->next)
if ( host_is_tls_on_connect_port(i2->port) == (j > 0)
&& Ustrcmp(ipa->address, i2->address) == 0
)
{ /* found; append port to list */
- if (p[-1] == '}') p--;
- while (isdigit(*--p)) ;
- p += 1 + sprintf(CS p+1, "%s%d,%d}", *p == ',' ? "" : "{",
- i2->port, ipa->port);
+ for (p = i2->log; *p; ) p++; /* end of existing string */
+ if (*--p == '}') *p = '\0'; /* drop EOL */
+ while (isdigit(*--p)) ; /* char before port */
+
+ i2->log = *p == ':' /* no list yet? */
+ ? string_sprintf("%.*s{%s,%d}",
+ (int)(p - i2->log + 1), i2->log, p+1, ipa->port)
+ : string_sprintf("%s,%d}", i2->log, ipa->port);
+ ipa->log = NULL;
break;
}
if (i2 == ipa) /* first-time IP */
break;
}
if (i2 == ipa) /* first-time IP */
- p += sprintf(CS p, " [%s]:%d", ipa->address, ipa->port);
+ ipa->log = string_sprintf(" [%s]:%d", ipa->address, ipa->port);
+ p = big_buffer;
+ for (int j = 0, i; j < 2; j++)
+ {
+ /* First time round, look for SMTP ports; second time round, look for
+ SMTPS ports. For the first one of each, insert leading text. */
+
+ if (j == 0)
- memcpy(p, " ...", 5);
- p += 4;
+ if (smtp_ports > 0)
+ p += sprintf(CS p, "SMTP on");
+ else
+ if (smtps_ports > 0)
+ p += sprintf(CS p, "%sSMTPS on",
+ smtp_ports == 0 ? "" : " and for ");
+
+ /* Now the information about the port (and sometimes interface) */
+
+ for (i = 0, ipa = addresses; i < 10 && ipa; i++, ipa = ipa->next)
+ if (host_is_tls_on_connect_port(ipa->port) == (j > 0))
+ if (ipa->log)
+ p += sprintf(CS p, "%s", ipa->log);
+
+ if (ipa)
+ p += sprintf(CS p, " ...");
Ustrcpy(next->address, s);
next->port = port;
next->v6_include_v4 = FALSE;
Ustrcpy(next->address, s);
next->port = port;
next->v6_include_v4 = FALSE;
if (!yield)
yield = last = next;
if (!yield)
yield = last = next;
int port;
BOOL v6_include_v4; /* Used in the daemon */
uschar address[46];
int port;
BOOL v6_include_v4; /* Used in the daemon */
uschar address[46];
+ uschar * log; /* portion of "listening on" log line */
} ip_address_item;
/* Structure for chaining together arbitrary strings. */
} ip_address_item;
/* Structure for chaining together arbitrary strings. */
# ----- Main settings -----
acl_smtp_rcpt = accept
# ----- Main settings -----
acl_smtp_rcpt = accept
-local_interfaces = <; 127.0.0.1.PORT_D ; [127.0.0.1]:PORT_D2 ; HOSTIPV4
+local_interfaces = <; 127.0.0.1.PORT_D ; [127.0.0.1]:PORT_D2 ; HOSTIPV4 ; 127.0.0.1.PORT_D4
log_selector = +incoming_interface+incoming_port
queue_only
queue_run_in_order
log_selector = +incoming_interface+incoming_port
queue_only
queue_run_in_order
1999-03-02 09:44:33 End queue run: pid=pppp
******** SERVER ********
1999-03-02 09:44:33 End queue run: pid=pppp
******** SERVER ********
-1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on [127.0.0.1]:{1225,1226} [ip4.ip4.ip4.ip4]:1227
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on [127.0.0.1]:{1225,1226,1228} [ip4.ip4.ip4.ip4]:1227
1999-03-02 09:44:33 10HmaX-0005vi-00 <= userx@test.ex H=(rhu.barb) [127.0.0.1]:1111 I=[127.0.0.1]:1225 P=esmtp S=sss
1999-03-02 09:44:33 10HmaY-0005vi-00 <= userx@test.ex H=(rhu.barb) [127.0.0.1]:1112 I=[127.0.0.1]:1226 P=esmtp S=sss
1999-03-02 09:44:33 10HmaX-0005vi-00 <= userx@test.ex H=(rhu.barb) [127.0.0.1]:1111 I=[127.0.0.1]:1225 P=esmtp S=sss
1999-03-02 09:44:33 10HmaY-0005vi-00 <= userx@test.ex H=(rhu.barb) [127.0.0.1]:1112 I=[127.0.0.1]:1226 P=esmtp S=sss