2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-31 14:17:41 +00:00

postfix-3.2-20160612

This commit is contained in:
Wietse Venema
2016-06-12 00:00:00 -05:00
committed by Viktor Dukhovni
parent ba7eb35fad
commit 8c9a213e87
7 changed files with 40 additions and 12 deletions

View File

@@ -22367,3 +22367,8 @@ Apologies for any names omitted.
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.

View File

@@ -24,9 +24,9 @@ DNSBLOG(8) DNSBLOG(8)
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).

View File

@@ -28,8 +28,8 @@ If the IP address is listed under the DNS white/blacklist, 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.
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

View File

@@ -20,8 +20,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.
/* DIAGNOSTICS
/* Problems and transactions are logged to \fBsyslogd\fR(8).

View File

@@ -20,7 +20,7 @@
* 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

View File

@@ -83,6 +83,8 @@ typedef struct {
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 */

View File

@@ -175,6 +175,8 @@ static int smtpd_peer_sockaddr_to_hostaddr(SMTPD_STATE *state)
) {
MAI_HOSTADDR_STR client_addr;
MAI_SERVPORT_STR client_port;
MAI_HOSTADDR_STR server_addr;
MAI_SERVPORT_STR server_port;
int aierr;
char *colonp;
@@ -276,6 +278,21 @@ static int smtpd_peer_sockaddr_to_hostaddr(SMTPD_STATE *state)
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);
}
@@ -493,8 +510,6 @@ static void smtpd_peer_from_pass_attr(SMTPD_STATE *state)
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
@@ -502,13 +517,19 @@ static void smtpd_peer_from_default(SMTPD_STATE *state)
* 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);
}