]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.11-20251217
authorWietse Z Venema <wietse@porcupine.org>
Wed, 17 Dec 2025 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <ietf-dane@dukhovni.org>
Thu, 18 Dec 2025 02:45:50 +0000 (13:45 +1100)
postfix/HISTORY
postfix/proto/stop.double-history
postfix/proto/stop.spell-history
postfix/src/bounce/bounce_notify_service.c
postfix/src/bounce/bounce_notify_verp.c
postfix/src/bounce/bounce_one_service.c
postfix/src/bounce/bounce_trace_service.c
postfix/src/bounce/bounce_warn_service.c
postfix/src/global/abounce.c
postfix/src/global/mail_version.h

index a61191d3476a0eb5f66f1ca96c61d933391205d8..5ebd2dac78a0effcb3a6c44ce172fe52f0ed2bcc 100644 (file)
@@ -30148,3 +30148,34 @@ Apologies for any names omitted.
        temporary. This problem was reported by Ankit Kulkarni.
 
        Files: proto/postconf.proto global/mail_params.h milter/milter8.c.
+
+20251216
+
+       Logging: after a delivery failure, the bounce daemon logged
+       "<old-queue-id>: sender non-delivery notification:
+       <new-queue-id>" only if the notification was queued
+       successfully. If the notification could not be queued, the
+       bounce daemon did not log why. The only hint was in the
+       form of qmgr logging with "<old-queue-id>: status=deferred
+       (bounce failed)".
+
+       Visible changes for logfile analyzers:
+
+       - The bounce daemon now logs "<old-queue-id>: sender
+       non-delivery notification: <new-queue-id>" BEFORE the cleanup
+       daemon logs activity with "<new-queue-id>". Previously, the
+       bounce daemon logged the old<=>new queue ID connection
+       later, which made logfile analysis more difficult.
+
+       - The bounce daemon now logs a logfile record "<old-queue-id>:
+       sender notification failed to <address>: <reason>" when the
+       notification was not queued. In some cases it will log
+       "<old-queue-id>: sender notification failed to <address>".
+       In those cases the failure reason was already logged by
+       lower-level code, without the queue ID.
+
+       Files: bounce/bounce_notify_service.c, bounce/bounce_notify_verp.c,
+       bounce/bounce_one_service.c, bounce/bounce_trace_service.c,
+       bounce/bounce_warn_service.c.
+
+       TODO: unit test coverage.
index 6b0405d7dcfc2f525d7902dca8c7b84acd394b01..1110496cef381edeab5ac2126545b0ab1f942b80 100644 (file)
@@ -261,3 +261,4 @@ proto  proto REQUIRETLS_README html global mail_params hc
  makedefs bounce bounce c cleanup cleanup_init c 
  smtp smtp c smtpd smtpd c trivial rewrite trivial rewrite c 
  Files makedefs bounce bounce c cleanup cleanup_init c 
+ Portability makedefs postalias postalias c util dict_debug c 
index 1730b5d2c349fa62ab708adfccf002291f8a57af..9b32215d8e96d6a74e69e08e007aefd7935ee840 100644 (file)
@@ -118,3 +118,5 @@ Natalenko
 nocertmatch
 pgnd
 jl
+Ankit
+Kulkarni
index b8068f176c78b32d5cb2da269d8b2fa2151aecaf..c6004c0bf46f29ec5d332138c1ff36a9107adba5 100644 (file)
@@ -188,6 +188,8 @@ int     bounce_notify_service(int flags, char *service, char *queue_name,
                 * reason for the bounce, and the headers of the original
                 * message. Don't bother sending the boiler-plate text.
                 */
+               msg_info("%s: postmaster non-delivery notification: %s",
+                        queue_id, STR(new_id));
                count = -1;
                if (bounce_header(bounce, bounce_info, postmaster,
                                  POSTMASTER_COPY) == 0
@@ -198,15 +200,17 @@ int     bounce_notify_service(int flags, char *service, char *queue_name,
                                             DSN_NOTIFY_OVERRIDE) > 0) {
                    bounce_original(bounce, bounce_info, DSN_RET_FULL);
                    bounce_status = post_mail_fclose(bounce);
-                   if (bounce_status == 0)
-                       msg_info("%s: postmaster non-delivery notification: %s",
-                                queue_id, STR(new_id));
+                   if (bounce_status)
+                       msg_warn("%s: postmaster notification failed: %s",
+                                queue_id, cleanup_strerror(bounce_status));
                } else {
                    /* No applicable recipients found - cancel this notice. */
                    (void) vstream_fclose(bounce);
                    if (count == 0)
                        bounce_status = 0;
                }
+           } else {
+               msg_warn("%s: postmaster notification failed", queue_id);
            }
        }
     }
@@ -227,6 +231,8 @@ int     bounce_notify_service(int flags, char *service, char *queue_name,
             * pretends that we are a polite mail system, the text with
             * reason for the bounce, and a copy of the original message.
             */
+           msg_info("%s: sender non-delivery notification: %s",
+                    queue_id, STR(new_id));
            count = -1;
            if (bounce_header(bounce, bounce_info, recipient,
                              NO_POSTMASTER_COPY) == 0
@@ -239,15 +245,19 @@ int     bounce_notify_service(int flags, char *service, char *queue_name,
                bounce_original(bounce, bounce_info, dsn_ret ?
                                dsn_ret : DSN_RET_FULL);
                bounce_status = post_mail_fclose(bounce);
-               if (bounce_status == 0)
-                   msg_info("%s: sender non-delivery notification: %s",
-                            queue_id, STR(new_id));
+               if (bounce_status)
+                   msg_warn("%s: sender notification failed to %s: %s",
+                            queue_id, recipient,
+                            cleanup_strerror(bounce_status));
            } else {
                /* No applicable recipients found - cancel this notice. */
                (void) vstream_fclose(bounce);
                if (count == 0)
                    bounce_status = 0;
            }
+       } else {
+           msg_warn("%s: sender notification failed to %s",
+                    queue_id, recipient);
        }
 
        /*
@@ -276,6 +286,8 @@ int     bounce_notify_service(int flags, char *service, char *queue_name,
                                                 NULL_TRACE_FLAGS,
                                                 sendopts,
                                                 new_id)) != 0) {
+               msg_info("%s: postmaster non-delivery notification: %s",
+                        queue_id, STR(new_id));
                count = -1;
                if (bounce_header(bounce, bounce_info, postmaster,
                                  POSTMASTER_COPY) == 0
@@ -286,9 +298,6 @@ int     bounce_notify_service(int flags, char *service, char *queue_name,
                                             DSN_NOTIFY_OVERRIDE) > 0) {
                    bounce_original(bounce, bounce_info, DSN_RET_HDRS);
                    postmaster_status = post_mail_fclose(bounce);
-                   if (postmaster_status == 0)
-                       msg_info("%s: postmaster non-delivery notification: %s",
-                                queue_id, STR(new_id));
                } else {
                    /* No applicable recipients found - cancel this notice. */
                    (void) vstream_fclose(bounce);
index 84e20b8e2195d5cd4848f32d9dabce3bff6b2073..e0844599e515d8fd9f235591cee54ecd81f91d03 100644 (file)
@@ -174,6 +174,8 @@ int     bounce_notify_verp(int flags, char *service, char *queue_name,
                 * pretends that we are a polite mail system, the text with
                 * reason for the bounce, and a copy of the original message.
                 */
+               msg_info("%s: sender non-delivery notification: %s",
+                        queue_id, STR(new_id));
                if (bounce_header(bounce, bounce_info, STR(verp_buf),
                                  NO_POSTMASTER_COPY) == 0
                    && bounce_boilerplate(bounce, bounce_info) == 0
@@ -183,11 +185,15 @@ int     bounce_notify_verp(int flags, char *service, char *queue_name,
                    bounce_original(bounce, bounce_info, dsn_ret ?
                                    dsn_ret : DSN_RET_FULL);
                bounce_status = post_mail_fclose(bounce);
-               if (bounce_status == 0)
-                   msg_info("%s: sender non-delivery notification: %s",
-                            queue_id, STR(new_id));
-           } else
+               if (bounce_status)
+                   msg_warn("%s: sender notification failed to %s: %s",
+                            queue_id, STR(verp_buf),
+                            cleanup_strerror(bounce_status));
+           } else {
+               msg_warn("%s: sender notification failed to %s",
+                        queue_id, STR(verp_buf));
                bounce_status = 1;
+           }
 
            /*
             * Stop at the first sign of trouble, instead of making the
@@ -228,6 +234,8 @@ int     bounce_notify_verp(int flags, char *service, char *queue_name,
                                                 NULL_TRACE_FLAGS,
                                                 sendopts,
                                                 new_id)) != 0) {
+               msg_info("%s: postmaster non-delivery notification: %s",
+                        queue_id, STR(new_id));
                if (bounce_header(bounce, bounce_info, postmaster,
                                  POSTMASTER_COPY) == 0
                    && bounce_recipient_log(bounce, bounce_info) == 0
@@ -235,9 +243,6 @@ int     bounce_notify_verp(int flags, char *service, char *queue_name,
                    && bounce_recipient_dsn(bounce, bounce_info) == 0)
                    bounce_original(bounce, bounce_info, DSN_RET_HDRS);
                postmaster_status = post_mail_fclose(bounce);
-               if (postmaster_status == 0)
-                   msg_info("%s: postmaster non-delivery notification: %s",
-                            queue_id, STR(new_id));
            } else
                postmaster_status = 1;
 
index ab6cac829ef35d82aae4a358a52051447211f0a6..2524cbc75f4766907124ca3370eab9103abd94c2 100644 (file)
@@ -157,6 +157,8 @@ int     bounce_one_service(int flags, char *queue_name, char *queue_id,
                 * reason for the bounce, and the headers of the original
                 * message. Don't bother sending the boiler-plate text.
                 */
+               msg_info("%s: postmaster non-delivery notification: %s",
+                        queue_id, STR(new_id));
                if (!bounce_header(bounce, bounce_info, var_2bounce_rcpt,
                                   POSTMASTER_COPY)
                    && bounce_recipient_log(bounce, bounce_info) == 0
@@ -164,9 +166,11 @@ int     bounce_one_service(int flags, char *queue_name, char *queue_id,
                    && bounce_recipient_dsn(bounce, bounce_info) == 0)
                    bounce_original(bounce, bounce_info, DSN_RET_FULL);
                bounce_status = post_mail_fclose(bounce);
-               if (bounce_status == 0)
-                   msg_info("%s: postmaster non-delivery notification: %s",
-                            queue_id, STR(new_id));
+               if (bounce_status)
+                   msg_warn("%s: postmaster notification failed: %s",
+                            queue_id, cleanup_strerror(bounce_status));
+           } else {
+               msg_warn("%s: postmaster notification failed", queue_id);
            }
        }
     }
@@ -193,6 +197,8 @@ int     bounce_one_service(int flags, char *queue_name, char *queue_id,
                 * pretends that we are a polite mail system, the text with
                 * reason for the bounce, and a copy of the original message.
                 */
+               msg_info("%s: sender non-delivery notification: %s",
+                        queue_id, STR(new_id));
                if (bounce_header(bounce, bounce_info, orig_sender,
                                  NO_POSTMASTER_COPY) == 0
                    && bounce_boilerplate(bounce, bounce_info) == 0
@@ -202,9 +208,13 @@ int     bounce_one_service(int flags, char *queue_name, char *queue_id,
                    bounce_original(bounce, bounce_info, dsn_ret ?
                                    dsn_ret : DSN_RET_FULL);
                bounce_status = post_mail_fclose(bounce);
-               if (bounce_status == 0)
-                   msg_info("%s: sender non-delivery notification: %s",
-                            queue_id, STR(new_id));
+               if (bounce_status)
+                   msg_warn("%s: sender notification failed to %s: %s",
+                            queue_id, orig_sender,
+                            cleanup_strerror(bounce_status));
+           } else {
+               msg_warn("%s: sender notification failed to %s",
+                        queue_id, orig_sender);
            }
        }
 
@@ -233,6 +243,8 @@ int     bounce_one_service(int flags, char *queue_name, char *queue_id,
                                                 NULL_TRACE_FLAGS,
                                                 sendopts,
                                                 new_id)) != 0) {
+               msg_info("%s: postmaster non-delivery notification: %s",
+                        queue_id, STR(new_id));
                if (bounce_header(bounce, bounce_info, var_bounce_rcpt,
                                  POSTMASTER_COPY) == 0
                    && bounce_recipient_log(bounce, bounce_info) == 0
@@ -240,9 +252,6 @@ int     bounce_one_service(int flags, char *queue_name, char *queue_id,
                    && bounce_recipient_dsn(bounce, bounce_info) == 0)
                    bounce_original(bounce, bounce_info, DSN_RET_HDRS);
                postmaster_status = post_mail_fclose(bounce);
-               if (postmaster_status == 0)
-                   msg_info("%s: postmaster non-delivery notification: %s",
-                            queue_id, STR(new_id));
            }
            if (postmaster_status)
                msg_warn("%s: postmaster notice failed while bouncing to %s",
index cb29bbb268773ff6143888796a0b06e5d5b0c6c4..e8c09cfa19fb6f8d008bb9e8a320c9c97e0cdab6 100644 (file)
@@ -181,6 +181,8 @@ int     bounce_trace_service(int flags, char *service, char *queue_name,
                                         NULL_TRACE_FLAGS,
                                         sendopts,
                                         new_id)) != 0) {
+       msg_info("%s: sender delivery status notification: %s",
+                queue_id, STR(new_id));
        count = -1;
        if (bounce_header(bounce, bounce_info, recipient,
                          NO_POSTMASTER_COPY) == 0
@@ -192,14 +194,18 @@ int     bounce_trace_service(int flags, char *service, char *queue_name,
                                     DSN_NOTIFY_OVERRIDE) > 0) {
            bounce_original(bounce, bounce_info, DSN_RET_HDRS);
            bounce_status = post_mail_fclose(bounce);
-           if (bounce_status == 0)
-               msg_info("%s: sender delivery status notification: %s",
-                        queue_id, STR(new_id));
+           if (bounce_status)
+               msg_warn("%s: sender notification failed to %s: %s",
+                        queue_id, recipient,
+                        cleanup_strerror(bounce_status));
        } else {
            (void) vstream_fclose(bounce);
            if (count == 0)
                bounce_status = 0;
        }
+    } else {
+       msg_warn("%s: sender notification failed to %s",
+                queue_id, recipient);
     }
 
     /*
index f9fc7641b64ce58b745629b7ad423ca324e74cce..84ea22278b2cd84409b8cb3f1734fd28280442cb 100644 (file)
@@ -177,6 +177,8 @@ int     bounce_warn_service(int unused_flags, char *service, char *queue_name,
                 * reason for the bounce, and the headers of the original
                 * message. Don't bother sending the boiler-plate text.
                 */
+               msg_info("%s: postmaster delay notification: %s",
+                        queue_id, STR(new_id));
                count = -1;
                if (!bounce_header(bounce, bounce_info, postmaster,
                                   POSTMASTER_COPY)
@@ -187,14 +189,16 @@ int     bounce_warn_service(int unused_flags, char *service, char *queue_name,
                                             DSN_NOTIFY_OVERRIDE) > 0) {
                    bounce_original(bounce, bounce_info, DSN_RET_FULL);
                    bounce_status = post_mail_fclose(bounce);
-                   if (bounce_status == 0)
-                       msg_info("%s: postmaster delay notification: %s",
-                                queue_id, STR(new_id));
+                   if (bounce_status)
+                       msg_warn("%s: postmaster notification failed: %s",
+                                queue_id, cleanup_strerror(bounce_status));
                } else {
                    (void) vstream_fclose(bounce);
                    if (count == 0)
                        bounce_status = 0;
                }
+           } else {
+               msg_warn("%s: postmaster notification failed", queue_id);
            }
        }
     }
@@ -215,6 +219,8 @@ int     bounce_warn_service(int unused_flags, char *service, char *queue_name,
             * pretends that we are a polite mail system, the text with
             * reason for the bounce, and a copy of the original message.
             */
+           msg_info("%s: sender delay notification: %s",
+                    queue_id, STR(new_id));
            count = -1;
            if (bounce_header(bounce, bounce_info, recipient,
                              NO_POSTMASTER_COPY) == 0
@@ -226,14 +232,18 @@ int     bounce_warn_service(int unused_flags, char *service, char *queue_name,
                                         DSN_NOTIFY_DELAY) > 0) {
                bounce_original(bounce, bounce_info, DSN_RET_HDRS);
                bounce_status = post_mail_fclose(bounce);
-               if (bounce_status == 0)
-                   msg_info("%s: sender delay notification: %s",
-                            queue_id, STR(new_id));
+               if (bounce_status)
+                   msg_warn("%s: sender notification failed to %s: %s",
+                            queue_id, recipient,
+                            cleanup_strerror(bounce_status));
            } else {
                (void) vstream_fclose(bounce);
                if (count == 0)
                    bounce_status = 0;
            }
+       } else {
+           msg_warn("%s: sender notification failed to %s",
+                    queue_id, recipient);
        }
 
        /*
@@ -260,6 +270,8 @@ int     bounce_warn_service(int unused_flags, char *service, char *queue_name,
                                                 NULL_TRACE_FLAGS,
                                                 sendopts,
                                                 new_id)) != 0) {
+               msg_info("%s: postmaster delay notification: %s",
+                        queue_id, STR(new_id));
                count = -1;
                if (bounce_header(bounce, bounce_info, postmaster,
                                  POSTMASTER_COPY) == 0
@@ -270,9 +282,6 @@ int     bounce_warn_service(int unused_flags, char *service, char *queue_name,
                                             DSN_NOTIFY_OVERRIDE) > 0) {
                    bounce_original(bounce, bounce_info, DSN_RET_HDRS);
                    postmaster_status = post_mail_fclose(bounce);
-                   if (postmaster_status == 0)
-                       msg_info("%s: postmaster delay notification: %s",
-                                queue_id, STR(new_id));
                } else {
                    (void) vstream_fclose(bounce);
                    if (count == 0)
index fc16af7d5118043ebdd2e68ef0c55bb06ae6cf71..eff4e79fcb022864d8b5afec18f3a0eab29b5594 100644 (file)
@@ -260,7 +260,7 @@ static void abounce_done(ABOUNCE_STATE *ap, int status)
        msg_info("%s: status=deferred (%s failed)", ap->id,
                 ap->command == BOUNCE_CMD_FLUSH ? "bounce" :
                 ap->command == BOUNCE_CMD_WARN ? "delay warning" :
-                ap->command == BOUNCE_CMD_VERP ? "verp" :
+                ap->command == BOUNCE_CMD_VERP ? "bounce" :
                 ap->command == BOUNCE_CMD_TRACE ? "trace" :
                 "whatever");
     ap->callback(status, ap->context);
index 5c3206d78c4657d11b12a1f48a2c5e60ee39ee04..2143a1cf281f0e470fd619bcf755a43fc292dc81 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      "20251208"
+#define MAIL_RELEASE_DATE      "20251217"
 #define MAIL_VERSION_NUMBER    "3.11"
 
 #ifdef SNAPSHOT