]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.2-20160612
authorWietse Venema <wietse@porcupine.org>
Sun, 12 Jun 2016 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Tue, 26 Jul 2016 11:54:26 +0000 (07:54 -0400)
postfix/HISTORY
postfix/html/dnsblog.8.html
postfix/man/man8/dnsblog.8
postfix/src/dnsblog/dnsblog.c
postfix/src/global/mail_version.h
postfix/src/smtpd/smtpd.h
postfix/src/smtpd/smtpd_peer.c

index 6f3dd54aef9a8eb7d655ec0f3f674c0644507a4b..ad4a2be631d3987d2cc8722322943f3b8354a260 100644 (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.
index e12f8311da8e1fa47723036c5baea7e34bdcc2d9..8e51362e47b9dd313471969934d935dd01abc4a3 100644 (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).
index 38c5a2474ab24d584661c796eb1fef03966192e4..ba95973fe7da0027aba0d12b091c8989bc3e46b4 100644 (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
index 37265f12b26e47a8ddf27afdbb0f538f86d3a790..5243828b68b902d98ecfb478b35585e3a8890a0a 100644 (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).
index 94268b98a293e32c0ada6c7188bf0986bdf4392f..11e92caa3c08e3e403ce2a376c69b1b269186617 100644 (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
index 13ea8fc1ba26df0afebb8201d60e9314dc8f8a24..fdce249293e11d9dab783a8c5b98b503b07b5880 100644 (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 */
index f1f80e92111d166f1e8348a67ec1b69a359cba27..d319f693c9e9a44c9661199bf37ffd75c3281dc8 100644 (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);
     }