cleanup/cleanup.h, cleanup/cleanup_milter.c, global/mail_proto.h,
milter/milter.h, smtpd/smtpd.c, smtpd/smtpd.h, smtpd/smtpd_check.c,
smtpd/smtpd_haproxy.c, smtpd/smtpd_milter.c, smtpd/smtpd_peer.c.
+
+20140612
+
+ Bugfix: missing server address/port conversion. File:
+ smtpd/smtpd_peer.c.
match and replies with the query arguments plus an address list with
the resulting IP addresses, separated by whitespace, and the reply TTL.
Otherwise it replies with the query arguments plus an empty address
- list and the reply TTL; the reply TTL is -1 if no reply is received, or
- a negative reply without SOA record. Finally, The <a href="dnsblog.8.html"><b>dnsblog</b>(8)</a> server
- closes the connection.
+ list and the reply TTL; the reply TTL is -1 if there is no reply, or if
+ a negative reply contains no SOA record. Finally, The <a href="dnsblog.8.html"><b>dnsblog</b>(8)</a>
+ server closes the connection.
<b>DIAGNOSTICS</b>
Problems and transactions are logged to <b>syslogd</b>(8).
query arguments plus an address list with the resulting IP
addresses, separated by whitespace, and the reply TTL.
Otherwise it replies with the query arguments plus an empty
-address list and the reply TTL; the reply TTL is \-1 if no
-reply is received, or a negative reply without SOA record.
+address list and the reply TTL; the reply TTL is \-1 if there
+is no reply, or if a negative reply contains no SOA record.
Finally, The \fBdnsblog\fR(8) server closes the connection.
.SH DIAGNOSTICS
.ad
/* query arguments plus an address list with the resulting IP
/* addresses, separated by whitespace, and the reply TTL.
/* Otherwise it replies with the query arguments plus an empty
-/* address list and the reply TTL; the reply TTL is -1 if no
-/* reply is received, or a negative reply without SOA record.
+/* address list and the reply TTL; the reply TTL is -1 if there
+/* is no reply, or if a negative reply contains no SOA record.
/* Finally, The \fBdnsblog\fR(8) server closes the connection.
/* DIAGNOSTICS
/* Problems and transactions are logged to \fBsyslogd\fR(8).
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20160611"
+#define MAIL_RELEASE_DATE "20160612"
#define MAIL_VERSION_NUMBER "3.2"
#ifdef SNAPSHOT
char *dest_port; /* Milter {daemon_port} */
struct sockaddr_storage sockaddr; /* binary client endpoint */
SOCKADDR_SIZE sockaddr_len; /* binary client endpoint */
+ struct sockaddr_storage dest_sockaddr; /* binary local endpoint */
+ SOCKADDR_SIZE dest_sockaddr_len; /* binary local endpoint */
int name_status; /* 2=ok 4=soft 5=hard 6=forged */
int reverse_name_status; /* 2=ok 4=soft 5=hard */
int conn_count; /* connections from this client */
) {
MAI_HOSTADDR_STR client_addr;
MAI_SERVPORT_STR client_port;
+ MAI_HOSTADDR_STR server_addr;
+ MAI_SERVPORT_STR server_port;
int aierr;
char *colonp;
state->rfc_addr = mystrdup(client_addr.buf);
state->addr_family = sa->sa_family;
}
+
+ /*
+ * Convert the server address/port to printable form.
+ */
+ if ((aierr = sockaddr_to_hostaddr((struct sockaddr *)
+ &state->dest_sockaddr,
+ state->dest_sockaddr_len,
+ &server_addr,
+ &server_port, 0)) != 0)
+ msg_fatal("%s: cannot convert server address/port to string: %s",
+ myname, MAI_STRERROR(aierr));
+ /* TODO: convert IPv4-in-IPv6 to IPv4 form. */
+ state->dest_addr = mystrdup(server_addr.buf);
+ state->dest_port = mystrdup(server_port.buf);
+
return (0);
}
static void smtpd_peer_from_default(SMTPD_STATE *state)
{
- SOCKADDR_SIZE sa_length = sizeof(state->sockaddr);
- struct sockaddr *sa = (struct sockaddr *) &(state->sockaddr);
/*
* The "no client" routine provides surrogate information so that the
* before the server wakes up. The "not inet" routine provides surrogate
* state for (presumably) local IPC channels.
*/
- if (getpeername(vstream_fileno(state->client), sa, &sa_length) < 0) {
+ state->sockaddr_len = sizeof(state->sockaddr);
+ state->dest_sockaddr_len = sizeof(state->dest_sockaddr);
+ if (getpeername(vstream_fileno(state->client),
+ (struct sockaddr *) &state->sockaddr,
+ &state->sockaddr_len) <0
+ || getsockname(vstream_fileno(state->client),
+ (struct sockaddr *) &state->dest_sockaddr,
+ &state->dest_sockaddr_len) < 0) {
if (errno == ENOTSOCK)
smtpd_peer_not_inet(state);
else
smtpd_peer_no_client(state);
} else {
- state->sockaddr_len = sa_length;
if (smtpd_peer_sockaddr_to_hostaddr(state) < 0)
smtpd_peer_not_inet(state);
}