]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.6-20200531
authorWietse Venema <wietse@porcupine.org>
Sun, 31 May 2020 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Wed, 10 Jun 2020 21:39:07 +0000 (17:39 -0400)
22 files changed:
postfix/HISTORY
postfix/README_FILES/CONNECTION_CACHE_README
postfix/RELEASE_NOTES
postfix/WISHLIST
postfix/conf/postfix-tls-script
postfix/html/CONNECTION_CACHE_README.html
postfix/html/lmtp.8.html
postfix/html/postconf.5.html
postfix/html/smtp.8.html
postfix/man/man5/postconf.5
postfix/man/man8/smtp.8
postfix/proto/CONNECTION_CACHE_README.html
postfix/proto/postconf.proto
postfix/src/global/Makefile.in
postfix/src/global/deliver_pass.c
postfix/src/global/mail_version.h
postfix/src/smtp/Makefile.in
postfix/src/smtp/smtp.c
postfix/src/smtp/smtp.h
postfix/src/smtp/smtp_addr.c
postfix/src/smtp/smtp_session.c
postfix/src/smtp/smtp_state.c

index 191e064cf721b9415cac5bca9f86596bde43c51a..2aa23d9d5c4fced975d8658d720e84ba8ea257b1 100644 (file)
@@ -24811,3 +24811,31 @@ Apologies for any names omitted.
        Cleanup: unit tests now build with -fno-common. Files:
        global/server_acl.c, smtpd/smtpd_check.c, global/strip_addr.c,
        proxymap/proxymap.c.
+
+20200525
+
+       Documentation: revised text about TLS connection reuse.
+       File: proto/CONNECTION_CACHE_README.html
+
+20200530
+
+       Bugfix (introduced: Postfix 3.1): "postfix tls deploy-server-cert"
+       did not handle a missing optional argument. File:
+       conf/postfix-tls-script.
+
+20200531
+
+       Debugging: per-nexthop SMTP client "debug peer" logging so
+       that we can also see what happens before, between, and after
+       SMTP sessions; add explicit SMTP client debug logging for
+       non-DNS host lookups.  Files: smtp/smtp.c, proto/postconf.proto,
+       smtp/smtp_addr.c, smtp/smtp.c, smtp/smtp.h, smtp/smtp_session.c,
+       smtp/smtp_state.c.
+
+       Postfix delivery agents now log an explicit record when
+       delegating delivery to a different Postfix delivery agent.
+       Example: "postfix/smtp[pid] queueid: passing <recipient>
+       to transport=local". This makes the delegating delivery
+       agent visible, where it would otherwise have remained
+       invisible, which would complicate troubleshooting. File:
+       global/deliver_pass.c.
index bd2fd03084e0a2b65f7db2a1a4f1a9a6719aaa49..db1d9affd1c56b226ed248552289ce249e1e7d2e 100644 (file)
@@ -7,9 +7,6 @@ I\bIn\bnt\btr\bro\bod\bdu\buc\bct\bti\bio\bon\bn
 This document describes the Postfix connection cache implementation, which is
 available with Postfix version 2.2 and later.
 
-See Client-side TLS connection reuse for how this connection cache is used to
-implement multiple deliveries per TLS-encrypted connection.
-
 Topics covered in this document:
 
   * What SMTP connection caching can do for you
@@ -22,8 +19,12 @@ Topics covered in this document:
 W\bWh\bha\bat\bt S\bSM\bMT\bTP\bP c\bco\bon\bnn\bne\bec\bct\bti\bio\bon\bn c\bca\bac\bch\bhi\bin\bng\bg c\bca\ban\bn d\bdo\bo f\bfo\bor\br y\byo\bou\bu
 
 With SMTP connection caching, Postfix can deliver multiple messages over the
-same SMTP connection. By default, Postfix 2.2 reuses an SMTP connection
-automatically when a destination has high volume of mail in the active queue.
+same SMTP connection. By default, Postfix 2.2 reuses a plaintext SMTP
+connection automatically when a destination has high volume of mail in the
+active queue.
+
+See Client-side TLS connection reuse to also implement multiple deliveries over
+a TLS-encrypted connection (Postfix version 3.4 and later).
 
 SMTP Connection caching is a performance feature. Whether or not it actually
 improves performance depends on the conditions:
@@ -32,9 +33,15 @@ improves performance depends on the conditions:
     mail to a destination with multiple mail servers, because it can help
     Postfix to skip over a non-responding server.
 
+  * SMTP Connection caching can also help with receivers that impose rate
+    limits on new connections.
+
   * Otherwise, the benefits of SMTP connection caching are minor: it eliminates
     the latency of the TCP handshake (SYN, SYN+ACK, ACK), plus the latency of
     the SMTP initial handshake (220 greeting, EHLO command, EHLO response).
+    With TLS-encrypted connections, this can save an additional two roundtrips
+    that would otherwise be needed to send STARTTLS and to resume a TLS
+    session.
 
   * SMTP Connection caching gives no gains with respect to SMTP session tear-
     down. The Postfix smtp(8) client normally does not wait for the server's
index 52dd221cb3fffc450bfc9986417712b8617e4966..3fc80718ba699df95d02ab83fe029a9c7f454bdb 100644 (file)
@@ -25,6 +25,26 @@ more recent Eclipse Public License 2.0. Recipients can choose to take
 the software under the license of their choice. Those who are more
 comfortable with the IPL can continue with that license.
 
+Incompatible change with snapshot 20200531
+==========================================
+
+Postfix delivery agents now log an explicit record when delegating
+delivery to a different Postfix delivery agent. 
+
+For example, with "best_mx_transport = local", an SMTP delivery
+agent will now log when a recipient will be delivered locally. This
+makes the delegating delivery agent visible, where it would otherwise
+have remained invisible, which would complicate troubleshooting.
+
+  postfix/smtp[pid]: queueid: passing <recipient> to transport=local
+
+This will usually be followed by logging for an actual delivery:
+
+  postfix/local[pid]: queueid: to=<recipient>, relay=local, ...
+
+Other examples: the local delivery agent defers mailbox delivery
+through mailbox_transport or through fallback_transport.
+
 Major changes with snapshot 20200509
 ====================================
 
index 96872fd9f7d35d26102fc0f9c6e7430e9ca35ac1..69913ede3af14aee5ce9b4813d635618deea560c 100644 (file)
@@ -1,5 +1,11 @@
 Wish list:
 
+       DNS wrapper class, like XSASL, to support different stub
+       resolvers without contaminating Postfix programs with the
+       idiosyncracies of stub resolvers. Handle differences in
+       resolver feature sets gracefully: an unsupported request
+       will result in an error status, not program termination.
+
        DNSSEC end-to-end test, probing a configurable zone (".")
        and resource type (default: NS).
 
index 2c3430a1ade647d9a0151a46f9ccb794108ae301..1a364b7fc306df0e1911b927728721ed9b868023 100644 (file)
@@ -777,7 +777,7 @@ get_cache_db_type() {
 deploy_server_cert() {
     certfile=$1; shift
     keyfile=$1; shift
-    deploy=$1; shift
+    case $# in 0) deploy=;; *) deploy=$1; shift;; esac
 
     # Sets key_algo, key_param and cert_param
     check_key "$keyfile" || return 1
index c2bf8b6faad69c0872fa0b9d76d2c56bf3857dee..28139109c2fe5944ff7421cc5cb242829514cc45 100644 (file)
 <p> This document describes the Postfix connection cache implementation,
 which is available with Postfix version 2.2 and later. </p>
 
-<p> See <a href="TLS_README.html#client_tls_reuse">Client-side TLS
-connection reuse</a> for how this connection cache is used to
-implement multiple deliveries per TLS-encrypted connection. </p>
-
 <p> Topics covered in this document: </p>
 
 <ul>
@@ -49,8 +45,12 @@ you</a></h2>
 
 <p> With SMTP connection caching, Postfix can deliver multiple
 messages over the same SMTP connection. By default, Postfix 2.2
-reuses an SMTP connection automatically when a destination has
-high volume of mail in the <a href="QSHAPE_README.html#active_queue">active queue</a>.  </p>
+reuses a plaintext SMTP connection automatically when a destination has
+high volume of mail in the <a href="QSHAPE_README.html#active_queue">active queue</a>. </p>
+
+<p> See <a href="TLS_README.html#client_tls_reuse">Client-side TLS
+connection reuse</a> to also implement multiple deliveries over a
+TLS-encrypted connection (Postfix version 3.4 and later). </p>
 
 <p> SMTP Connection caching is a performance feature. Whether or not
 it actually improves performance depends on the conditions: </p>
@@ -62,10 +62,15 @@ when delivering mail to a destination with multiple mail servers,
 because it can help Postfix to skip over a non-responding server.
 </p>
 
+<li> <p> SMTP Connection caching can also help with receivers that
+impose rate limits on new connections. </p>
+
 <li> <p> Otherwise, the benefits of SMTP connection caching are
 minor: it eliminates the latency of the TCP handshake (SYN, SYN+ACK,
 ACK), plus the latency of the SMTP initial handshake (220 greeting,
-EHLO command, EHLO response).
+EHLO command, EHLO response). With TLS-encrypted connections, this
+can save an additional two roundtrips that would otherwise be needed
+to send STARTTLS and to resume a TLS session. </p>
 
 <li> <p> SMTP Connection caching gives no gains with respect to
 SMTP session tear-down.  The Postfix <a href="smtp.8.html">smtp(8)</a> client normally does
index a01589cc196343688c0258973497e979847e07f1..f79f4e04e00506b8d56d1143e7cfcce919881ee9 100644 (file)
@@ -826,13 +826,15 @@ SMTP(8)                                                                SMTP(8)
 
 <b>TROUBLE SHOOTING CONTROLS</b>
        <b><a href="postconf.5.html#debug_peer_level">debug_peer_level</a> (2)</b>
-              The increment in verbose logging level when a remote  client  or
-              server matches a pattern in the <a href="postconf.5.html#debug_peer_list">debug_peer_list</a> parameter.
+              The increment in verbose logging level when a next-hop  destina-
+              tion,  remote client or server name or network address matches a
+              pattern given with the <a href="postconf.5.html#debug_peer_list">debug_peer_list</a> parameter.
 
        <b><a href="postconf.5.html#debug_peer_list">debug_peer_list</a> (empty)</b>
-              Optional  list  of  remote  client or server hostname or network
-              address  patterns  that  cause  the  verbose  logging  level  to
-              increase by the amount specified in $<a href="postconf.5.html#debug_peer_level">debug_peer_level</a>.
+              Optional list of next-hop destination, remote client  or  server
+              name  or  network  address  patterns that, if matched, cause the
+              verbose logging level to increase by  the  amount  specified  in
+              $<a href="postconf.5.html#debug_peer_level">debug_peer_level</a>.
 
        <b><a href="postconf.5.html#error_notice_recipient">error_notice_recipient</a> (postmaster)</b>
               The  recipient  of  postmaster notifications about mail delivery
index cf34baca6607185f4dd54b861562dbc65d8a8024..6e3f44cfbd234f40b28f8f94221988deb27206dd 100644 (file)
@@ -1834,8 +1834,11 @@ software.  </p>
 <DT><b><a name="debug_peer_level">debug_peer_level</a>
 (default: 2)</b></DT><DD>
 
-<p> The increment in verbose logging level when a remote client or
-server matches a pattern in the <a href="postconf.5.html#debug_peer_list">debug_peer_list</a> parameter.  </p>
+<p> The increment in verbose logging level when a nexthop destination,
+remote client or server name or network address matches a pattern
+given with the <a href="postconf.5.html#debug_peer_list">debug_peer_list</a> parameter. </p>
+
+<p> Per-nexthop debug logging is available in Postfix 3.6 and later. </p>
 
 
 </DD>
@@ -1843,9 +1846,12 @@ server matches a pattern in the <a href="postconf.5.html#debug_peer_list">debug_
 <DT><b><a name="debug_peer_list">debug_peer_list</a>
 (default: empty)</b></DT><DD>
 
-<p> Optional list of remote client or server hostname or network
-address patterns that cause the verbose logging level to increase
-by the amount specified in $<a href="postconf.5.html#debug_peer_level">debug_peer_level</a>.  </p>
+<p> Optional list of nexthop destination, remote client or server
+name or network address patterns that, if matched, cause the verbose
+logging level to increase by the amount specified in $<a href="postconf.5.html#debug_peer_level">debug_peer_level</a>.
+</p>
+
+<p> Per-nexthop debug logging is available in Postfix 3.6 and later. </p>
 
 <p> Specify domain names, network/netmask patterns, "/file/name"
 patterns or "<a href="DATABASE_README.html">type:table</a>" lookup tables. The right-hand side result
index a01589cc196343688c0258973497e979847e07f1..f79f4e04e00506b8d56d1143e7cfcce919881ee9 100644 (file)
@@ -826,13 +826,15 @@ SMTP(8)                                                                SMTP(8)
 
 <b>TROUBLE SHOOTING CONTROLS</b>
        <b><a href="postconf.5.html#debug_peer_level">debug_peer_level</a> (2)</b>
-              The increment in verbose logging level when a remote  client  or
-              server matches a pattern in the <a href="postconf.5.html#debug_peer_list">debug_peer_list</a> parameter.
+              The increment in verbose logging level when a next-hop  destina-
+              tion,  remote client or server name or network address matches a
+              pattern given with the <a href="postconf.5.html#debug_peer_list">debug_peer_list</a> parameter.
 
        <b><a href="postconf.5.html#debug_peer_list">debug_peer_list</a> (empty)</b>
-              Optional  list  of  remote  client or server hostname or network
-              address  patterns  that  cause  the  verbose  logging  level  to
-              increase by the amount specified in $<a href="postconf.5.html#debug_peer_level">debug_peer_level</a>.
+              Optional list of next-hop destination, remote client  or  server
+              name  or  network  address  patterns that, if matched, cause the
+              verbose logging level to increase by  the  amount  specified  in
+              $<a href="postconf.5.html#debug_peer_level">debug_peer_level</a>.
 
        <b><a href="postconf.5.html#error_notice_recipient">error_notice_recipient</a> (postmaster)</b>
               The  recipient  of  postmaster notifications about mail delivery
index 0d6dd271209ca918fc2f9233bdbc0fad748b4d01..0fef6368251550ee30b941f6ecf07b338082f187 100644 (file)
@@ -1104,12 +1104,17 @@ software.
 .PP
 This feature is available in Postfix 2.5 and later.
 .SH debug_peer_level (default: 2)
-The increment in verbose logging level when a remote client or
-server matches a pattern in the debug_peer_list parameter.
+The increment in verbose logging level when a nexthop destination,
+remote client or server name or network address matches a pattern
+given with the debug_peer_list parameter.
+.PP
+Per\-nexthop debug logging is available in Postfix 3.6 and later.
 .SH debug_peer_list (default: empty)
-Optional list of remote client or server hostname or network
-address patterns that cause the verbose logging level to increase
-by the amount specified in $debug_peer_level.
+Optional list of nexthop destination, remote client or server
+name or network address patterns that, if matched, cause the verbose
+logging level to increase by the amount specified in $debug_peer_level.
+.PP
+Per\-nexthop debug logging is available in Postfix 3.6 and later.
 .PP
 Specify domain names, network/netmask patterns, "/file/name"
 patterns or "type:table" lookup tables. The right\-hand side result
index 89a7b60eba21b20761d4e9d60894aecc80dc367d..1aaae63d321f0d79169c1604741adeda49cc3411 100644 (file)
@@ -744,12 +744,13 @@ used for DNS lookups.
 .ad
 .fi
 .IP "\fBdebug_peer_level (2)\fR"
-The increment in verbose logging level when a remote client or
-server matches a pattern in the debug_peer_list parameter.
+The increment in verbose logging level when a next\-hop destination,
+remote client or server name or network address matches a pattern
+given with the debug_peer_list parameter.
 .IP "\fBdebug_peer_list (empty)\fR"
-Optional list of remote client or server hostname or network
-address patterns that cause the verbose logging level to increase
-by the amount specified in $debug_peer_level.
+Optional list of next\-hop destination, remote client or server
+name or network address patterns that, if matched, cause the verbose
+logging level to increase by the amount specified in $debug_peer_level.
 .IP "\fBerror_notice_recipient (postmaster)\fR"
 The recipient of postmaster notifications about mail delivery
 problems that are caused by policy, resource, software or protocol
index 7ffd7bb04db03108732165f1388e060eb294ac58..7d170a1b6f527b92f1227d3a127df0d86405023c 100644 (file)
 <p> This document describes the Postfix connection cache implementation,
 which is available with Postfix version 2.2 and later. </p>
 
-<p> See <a href="TLS_README.html#client_tls_reuse">Client-side TLS
-connection reuse</a> for how this connection cache is used to
-implement multiple deliveries per TLS-encrypted connection. </p>
-
 <p> Topics covered in this document: </p>
 
 <ul>
@@ -49,8 +45,12 @@ you</a></h2>
 
 <p> With SMTP connection caching, Postfix can deliver multiple
 messages over the same SMTP connection. By default, Postfix 2.2
-reuses an SMTP connection automatically when a destination has
-high volume of mail in the active queue.  </p>
+reuses a plaintext SMTP connection automatically when a destination has
+high volume of mail in the active queue. </p>
+
+<p> See <a href="TLS_README.html#client_tls_reuse">Client-side TLS
+connection reuse</a> to also implement multiple deliveries over a
+TLS-encrypted connection (Postfix version 3.4 and later). </p>
 
 <p> SMTP Connection caching is a performance feature. Whether or not
 it actually improves performance depends on the conditions: </p>
@@ -62,10 +62,15 @@ when delivering mail to a destination with multiple mail servers,
 because it can help Postfix to skip over a non-responding server.
 </p>
 
+<li> <p> SMTP Connection caching can also help with receivers that
+impose rate limits on new connections. </p>
+
 <li> <p> Otherwise, the benefits of SMTP connection caching are
 minor: it eliminates the latency of the TCP handshake (SYN, SYN+ACK,
 ACK), plus the latency of the SMTP initial handshake (220 greeting,
-EHLO command, EHLO response).
+EHLO command, EHLO response). With TLS-encrypted connections, this
+can save an additional two roundtrips that would otherwise be needed
+to send STARTTLS and to resume a TLS session. </p>
 
 <li> <p> SMTP Connection caching gives no gains with respect to
 SMTP session tear-down.  The Postfix smtp(8) client normally does
index 3d5365743b8578d1f18c343b10524a01fabfc1a1..e608f1017d13625df611b8a4998ac34cefd35321 100644 (file)
@@ -916,14 +916,20 @@ The default time unit is s (seconds).
 
 %PARAM debug_peer_level 2
 
-<p> The increment in verbose logging level when a remote client or
-server matches a pattern in the debug_peer_list parameter.  </p>
+<p> The increment in verbose logging level when a nexthop destination,
+remote client or server name or network address matches a pattern
+given with the debug_peer_list parameter. </p>
 
-%PARAM debug_peer_list 
+<p> Per-nexthop debug logging is available in Postfix 3.6 and later. </p>
 
-<p> Optional list of remote client or server hostname or network
-address patterns that cause the verbose logging level to increase
-by the amount specified in $debug_peer_level.  </p>
+%PARAM debug_peer_list
+
+<p> Optional list of nexthop destination, remote client or server
+name or network address patterns that, if matched, cause the verbose
+logging level to increase by the amount specified in $debug_peer_level.
+</p>
+
+<p> Per-nexthop debug logging is available in Postfix 3.6 and later. </p>
 
 <p> Specify domain names, network/netmask patterns, "/file/name"
 patterns or "type:table" lookup tables. The right-hand side result
index 14f7283e306070a50bf187f9745bcd4423bace6a..7984512d054393abcf6e99e639ac49e00e9fb0c7 100644 (file)
@@ -1057,6 +1057,7 @@ deliver_pass.o: deliver_request.h
 deliver_pass.o: dsb_scan.h
 deliver_pass.o: dsn.h
 deliver_pass.o: dsn_buf.h
+deliver_pass.o: info_log_addr_form.h
 deliver_pass.o: mail_params.h
 deliver_pass.o: mail_proto.h
 deliver_pass.o: msg_stats.h
@@ -1401,6 +1402,7 @@ haproxy_srvr.o: ../../include/inet_proto.h
 haproxy_srvr.o: ../../include/msg.h
 haproxy_srvr.o: ../../include/myaddrinfo.h
 haproxy_srvr.o: ../../include/mymalloc.h
+haproxy_srvr.o: ../../include/sock_addr.h
 haproxy_srvr.o: ../../include/split_at.h
 haproxy_srvr.o: ../../include/stringops.h
 haproxy_srvr.o: ../../include/sys_defs.h
index e2112bafced8d75f074aa908c76a5e6be2b8ba07..d7945fcd4529a0f92a35c4501c69c550888a2fbd 100644 (file)
@@ -70,6 +70,7 @@
 #include <dsb_scan.h>
 #include <defer.h>
 #include <rcpt_print.h>
+#include <info_log_addr_form.h>
 
 #define DELIVER_PASS_DEFER     1
 #define DELIVER_PASS_UNKNOWN   2
@@ -182,6 +183,9 @@ int     deliver_pass(const char *class, const char *service,
     /*
      * Initialize.
      */
+    msg_info("%s: passing <%s> to transport=%s",
+            request->queue_id, info_log_addr_form_recipient(rcpt->address),
+            transport);
     stream = mail_connect_wait(class, transport);
     dsb = dsb_create();
 
index cf9a271e63ed2961eaa1f99b815dfb32c7a9303f..41ff81483ffb02dd298b9b9235dba72db786e5dc 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      "20200523"
+#define MAIL_RELEASE_DATE      "20200531"
 #define MAIL_VERSION_NUMBER    "3.6"
 
 #ifdef SNAPSHOT
index 140192f89ae181b4e46016d2093500c845dfc54d..30d0280116f68e075853a308ad67d93d07bf9004 100644 (file)
@@ -93,12 +93,14 @@ smtp.o: ../../include/byte_mask.h
 smtp.o: ../../include/check_arg.h
 smtp.o: ../../include/debug_peer.h
 smtp.o: ../../include/deliver_request.h
+smtp.o: ../../include/delivered_hdr.h
 smtp.o: ../../include/dict.h
 smtp.o: ../../include/dns.h
 smtp.o: ../../include/dsn.h
 smtp.o: ../../include/dsn_buf.h
 smtp.o: ../../include/ext_prop.h
 smtp.o: ../../include/flush_clnt.h
+smtp.o: ../../include/fold_addr.h
 smtp.o: ../../include/header_body_checks.h
 smtp.o: ../../include/header_opts.h
 smtp.o: ../../include/htable.h
@@ -713,6 +715,7 @@ smtp_session.o: smtp_session.c
 smtp_state.o: ../../include/argv.h
 smtp_state.o: ../../include/attr.h
 smtp_state.o: ../../include/check_arg.h
+smtp_state.o: ../../include/debug_peer.h
 smtp_state.o: ../../include/deliver_request.h
 smtp_state.o: ../../include/dict.h
 smtp_state.o: ../../include/dns.h
index aa35d21077e2a378883bae752f58bf6ce3228501..9f1357aa6e4c4a03738af5e34ef2f973ddbbc689 100644 (file)
 /* .ad
 /* .fi
 /* .IP "\fBdebug_peer_level (2)\fR"
-/*     The increment in verbose logging level when a remote client or
-/*     server matches a pattern in the debug_peer_list parameter.
+/*     The increment in verbose logging level when a next-hop destination,
+/*     remote client or server name or network address matches a pattern
+/*     given with the debug_peer_list parameter.
 /* .IP "\fBdebug_peer_list (empty)\fR"
-/*     Optional list of remote client or server hostname or network
-/*     address patterns that cause the verbose logging level to increase
-/*     by the amount specified in $debug_peer_level.
+/*     Optional list of next-hop destination, remote client or server
+/*     name or network address patterns that, if matched, cause the verbose
+/*     logging level to increase by the amount specified in $debug_peer_level.
 /* .IP "\fBerror_notice_recipient (postmaster)\fR"
 /*     The recipient of postmaster notifications about mail delivery
 /*     problems that are caused by policy, resource, software or protocol
@@ -1215,6 +1216,8 @@ static int deliver_message(const char *service, DELIVER_REQUEST *request)
     state->src = request->fp;
     state->service = service;
     state->misc_flags |= smtp_addr_pref;
+    state->debug_peer_per_nexthop =
+       debug_peer_check(request->nexthop, "noaddr");
     SMTP_RCPT_INIT(state);
 
     /*
index 281cfe42fa56f17d91f293f6ee2a455b8aac3b3b..e8c994fbf002ba860d3d49733bdb8b0c8905cece 100644 (file)
@@ -185,6 +185,12 @@ typedef struct SMTP_STATE {
      * DSN Support introduced major bloat in error processing.
      */
     DSN_BUF *why;                      /* on-the-fly formatting buffer */
+
+    /*
+     * Whether per-nexthop debug_peer support was requested. Otherwise,
+     * assume per-server debug_peer support.
+     */
+    int     debug_peer_per_nexthop;
 } SMTP_STATE;
 
  /*
index 2210ff7d81e033f1129d3a5beab681cece1a22ae..7111fe433e5cf041566de26535cbac14ff81a4af 100644 (file)
@@ -154,6 +154,8 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, const char *host, int res_opt,
                msg_fatal("host %s: conversion error for address family "
                          "%d: %m", host, res0->ai_addr->sa_family);
            addr_list = dns_rr_append(addr_list, addr);
+           if (msg_verbose)
+               msg_info("%s: using numerical host %s", myname, host);
            freeaddrinfo(res0);
            return (addr_list);
        }
@@ -230,6 +232,14 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, const char *host, int res_opt,
                    msg_fatal("host %s: conversion error for address family "
                              "%d: %m", host, res0->ai_addr->sa_family);
                addr_list = dns_rr_append(addr_list, addr);
+               if (msg_verbose) {
+                   MAI_HOSTADDR_STR hostaddr_str;
+
+                   SOCKADDR_TO_HOSTADDR(res->ai_addr, res->ai_addrlen,
+                                 &hostaddr_str, (MAI_SERVPORT_STR *) 0, 0);
+                   msg_info("%s: native lookup result: %s",
+                            myname, hostaddr_str.buf);
+               }
            }
            freeaddrinfo(res0);
            if (found == 0) {
@@ -370,8 +380,7 @@ static DNS_RR *smtp_balance_inet_proto(DNS_RR *addr_list, int misc_flags,
     DNS_RR *next;
     int     v6_count;
     int     v4_count;
-    int     v6_target,
-            v4_target;
+    int     v6_target, v4_target;
     int    *p;
 
     /*
index 1b3a20e9c7ea490384c8af197d2b8c30fd247b5a..9f139784300f9338c3939a816ed7ad48e425c760 100644 (file)
@@ -229,7 +229,8 @@ void    smtp_session_free(SMTP_SESSION *session)
     smtp_sasl_cleanup(session);
 #endif
 
-    debug_peer_restore();
+    if (session->state->debug_peer_per_nexthop == 0)
+       debug_peer_restore();
     myfree((void *) session);
 }
 
index f91ab8c48f58427a3a1fd7445042223b8dfe60dd..3416e0f5d6fc42cde5e9f0f0eeb34f794ce1ce49 100644 (file)
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
@@ -43,6 +48,7 @@
 /* Global library. */
 
 #include <mail_params.h>
+#include <debug_peer.h>
 
 /* Application-specific. */
 
@@ -81,6 +87,7 @@ SMTP_STATE *smtp_state_alloc(void)
        state->cache_used = 0;
     }
     state->why = dsb_create();
+    state->debug_peer_per_nexthop = 0;
     return (state);
 }
 
@@ -109,6 +116,8 @@ void    smtp_state_free(SMTP_STATE *state)
        htable_free(state->cache_used, (void (*) (void *)) 0);
     if (state->why)
        dsb_free(state->why);
+    if (state->debug_peer_per_nexthop)
+       debug_peer_restore();
 
     myfree((void *) state);
 }