diff --git a/postfix/HISTORY b/postfix/HISTORY index 4be10b660..d2b98f48c 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -28199,4 +28199,24 @@ Apologies for any names omitted. with guidance to enforce that the From: header address matches the envelope sender (MAIL FROM) address. File: proto/postconf.proto. + +20240909 + Bitrot: some platforms prefer the pkgconf command over pkg-config, + which in turn has superseded icu-config. File: makedefs. + +20230910 + + Cleanup: the enable_threaded_bounces feature was re-implemented. + This simplifies the code and improves the handling of + multiline Message-Id: headers (no software should generate + those, but...). Files: bounce/bounce_notify_util.c, + cleanup/cleanup.h, cleanup/cleanup_extracted.c, + cleanup/cleanup_message.c, cleanup/cleanup_state.c, + global/mail_proto.h, multiple bounce testfiles. + +20240917 + + Minor feature: "postcat -f" option to prepend the filename + to each output line. This simplifies test data development. + File: postcat/postcat.c. diff --git a/postfix/WISHLIST b/postfix/WISHLIST index 92296ad80..f2112a779 100644 --- a/postfix/WISHLIST +++ b/postfix/WISHLIST @@ -6,6 +6,12 @@ Wish list: Disable -DSNAPSHOT and -DNONPROD in makedefs. + Add tests for Message-ID extraction in the cleanup daemon. + + The postdrop code should be more explicit about what + attrributes it will pass through. rec_attr_map() is not + supposed to be an approver. + Many master.cf services don't expect wakeup calls, resulting in weird warnings. Maybe the master daemon could signal the wakeup intent through a child process command-line option, @@ -16,6 +22,13 @@ Wish list: using FIFOs anymore, and trigger servers could use a proper (attribute, value) protocol. + The Sendmail feature _FFR_MDS_NEGOTIATE allows negotiating + a larger milter command data size limit. To be investigated: + what parts of the protocol are included in this limit when + sending a message header (header name, protocol formatting, + etc.) and how this will interact with the Postfix built-in + header_size_limit (default: 102400). + SEND_ATTR_FUNC should send the name of the object being sent, so that SCAN_ATTR_FUNC can check it. diff --git a/postfix/html/makedefs.1.html b/postfix/html/makedefs.1.html index ce6725713..3d66aa648 100644 --- a/postfix/html/makedefs.1.html +++ b/postfix/html/makedefs.1.html @@ -66,33 +66,34 @@ MAKEDEFS(1) MAKEDEFS(1) -DNO_EAI Do not build with EAI (SMTPUTF8) support. By default, EAI - support is compiled in when the "pkg-config" command is - found, or the deprecated "icu-config" command. + support is compiled in when the "pkgconf" or "pkg-config" + command are found, or the deprecated "icu-config" com- + mand. -DNO_INLINE Do not require support for C99 "inline" functions. - Instead, implement argument typechecks for - non-(printf/scanf)-like functions with ternary operators + Instead, implement argument typechecks for + non-(printf/scanf)-like functions with ternary operators and unreachable code. -DNO_IPV6 Do not build with IPv6 support. By default, IPv6 support - is compiled in on platforms that are known to have IPv6 + is compiled in on platforms that are known to have IPv6 support. - Note: this directive is for debugging and testing only. - It is not guaranteed to work on all platforms. If you - don't want IPv6 support, set "inet_protocols = ipv4" in + Note: this directive is for debugging and testing only. + It is not guaranteed to work on all platforms. If you + don't want IPv6 support, set "inet_protocols = ipv4" in main.cf. -DNO_IP_CYRUS_SASL_AUTH - Don't pass remote SMTP client and Postfix SMTP server IP - address and port information to the Cyrus SASL library. + Don't pass remote SMTP client and Postfix SMTP server IP + address and port information to the Cyrus SASL library. This is compatible with Postfix < 3.2. -DNO_KQUEUE - Do not build with FreeBSD/NetBSD/OpenBSD/MacOSX KQUEUE - support. By default, KQUEUE support is compiled in on + Do not build with FreeBSD/NetBSD/OpenBSD/MacOSX KQUEUE + support. By default, KQUEUE support is compiled in on platforms that are known to support it. -DNO_NIS @@ -112,45 +113,45 @@ MAKEDEFS(1) MAKEDEFS(1) Disable support for POSIX getpwnam_r/getpwuid_r. -DNO_RES_NCALLS - Do not build with the threadsafe resolver(5) API + Do not build with the threadsafe resolver(5) API (res_ninit() etc.). -DNO_SIGSETJMP - Use setjmp()/longjmp() instead of sigsetjmp()/sig- - longjmp(). By default, Postfix uses sigsetjmp()/sig- + Use setjmp()/longjmp() instead of sigsetjmp()/sig- + longjmp(). By default, Postfix uses sigsetjmp()/sig- longjmp() when they appear to work. -DNO_SNPRINTF - Use sprintf() instead of snprintf(). By default, Postfix + Use sprintf() instead of snprintf(). By default, Postfix uses snprintf() except on ancient systems. DEBUG=debug_level - Specifies a non-default debugging level. The default is -g. + Specifies a non-default debugging level. The default is -g. Specify DEBUG= to turn off debugging. OPT=optimization_level - Specifies a non-default optimization level. The default is -O. + Specifies a non-default optimization level. The default is -O. Specify OPT= to turn off optimization. POSTFIX_INSTALL_OPTS=-option... - Specifies options for the postfix-install command, separated by - whitespace. Currently, the only supported option is + Specifies options for the postfix-install command, separated by + whitespace. Currently, the only supported option is -keep-build-mtime. SHLIB_CFLAGS=flags - Override the compiler flags (typically, "-fPIC") for Postfix + Override the compiler flags (typically, "-fPIC") for Postfix dynamically-linked libraries and database plugins. This feature was introduced with Postfix 3.0. SHLIB_RPATH=rpath - Override the runpath (typically, "'-Wl,-rpath,${SHLIB_DIR}'") + Override the runpath (typically, "'-Wl,-rpath,${SHLIB_DIR}'") for Postfix dynamically-linked libraries. This feature was introduced with Postfix 3.0. SHLIB_SUFFIX=suffix - Override the filename suffix (typically, ".so") for Postfix + Override the filename suffix (typically, ".so") for Postfix dynamically-linked libraries and database plugins. This feature was introduced with Postfix 3.0. @@ -158,7 +159,7 @@ MAKEDEFS(1) MAKEDEFS(1) shared=yes shared=no - Enable (disable) Postfix builds with dynamically-linked + Enable (disable) Postfix builds with dynamically-linked libraries typically named $shlib_directory/libpostfix-*.so.*. This feature was introduced with Postfix 3.0. @@ -166,39 +167,39 @@ MAKEDEFS(1) MAKEDEFS(1) dynamicmaps=yes dynamicmaps=no - Enable (disable) Postfix builds with the configuration file + Enable (disable) Postfix builds with the configuration file $meta_directory/dynamicmaps.cf and dynamically-loadable database - plugins typically named postfix-*.so.*. The setting "dynam- - icmaps=yes" implicitly enables Postfix dynamically-linked + plugins typically named postfix-*.so.*. The setting "dynam- + icmaps=yes" implicitly enables Postfix dynamically-linked libraries. This feature was introduced with Postfix 3.0. pie=yes - pie=no Enable (disable) Postfix builds with position-independent exe- + pie=no Enable (disable) Postfix builds with position-independent exe- cutables, on platforms where this is supported. This feature was introduced with Postfix 3.0. installation_parameter=value... - Override the compiled-in default value of the specified instal- - lation parameter(s). The following parameters are supported in + Override the compiled-in default value of the specified instal- + lation parameter(s). The following parameters are supported in this context: - command_directory config_directory daemon_directory data_direc- - tory default_database_type html_directory mail_spool_directory - mailq_path manpage_directory meta_directory newaliases_path - queue_directory readme_directory sendmail_path shlib_directory + command_directory config_directory daemon_directory data_direc- + tory default_database_type html_directory mail_spool_directory + mailq_path manpage_directory meta_directory newaliases_path + queue_directory readme_directory sendmail_path shlib_directory openssl_path - See the postconf(5) manpage for a description of these parame- + See the postconf(5) manpage for a description of these parame- ters. This feature was introduced with Postfix 3.0. WARN=warning_flags - Specifies non-default gcc compiler warning options for use when + Specifies non-default gcc compiler warning options for use when "make" is invoked in a source subdirectory only. LICENSE diff --git a/postfix/html/postcat.1.html b/postfix/html/postcat.1.html index 71b763e4f..0d228d48a 100644 --- a/postfix/html/postcat.1.html +++ b/postfix/html/postcat.1.html @@ -11,7 +11,7 @@ POSTCAT(1) POSTCAT(1) postcat - show Postfix queue file contents SYNOPSIS - postcat [-bdehnoqv] [-c config_dir] [files...] + postcat [-bdefhnoqv] [-c config_dir] [files...] DESCRIPTION The postcat(1) command prints the contents of the named files in @@ -41,6 +41,8 @@ POSTCAT(1) POSTCAT(1) This feature is available in Postfix 2.7 and later. + -f Prepend the file name to each output line. + -h Show message header content. The -h option produces output from the beginning of the message up to, but not including, the first non-header line. diff --git a/postfix/makedefs b/postfix/makedefs index e21e648ad..a048d09ce 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -61,7 +61,8 @@ # are known to support it. # .IP \fB-DNO_EAI\fR # Do not build with EAI (SMTPUTF8) support. By default, EAI -# support is compiled in when the "pkg-config" command is +# support is compiled in when the "pkgconf" or "pkg-config" +# command are # found, or the deprecated "icu-config" command. # .IP \fB-DNO_INLINE\fR # Do not require support for C99 "inline" functions. Instead, @@ -878,8 +879,10 @@ esac case "$CCARGS" in *-DNO_EAI*) CCARGS="$CCARGS "'-DDEF_SMTPUTF8_ENABLE=\"no\"';; *) icu_cppflags=`((pkg-config --cflags icu-uc icu-i18n) || + (pkgconf --cflags icu-uc icu-i18n) || (icu-config --cppflags)) 2>/dev/null` && { icu_ldflags=`((pkg-config --libs icu-uc icu-i18n) || + (pkgconf --libs icu-uc icu-i18n) || (icu-config --ldflags)) 2>/dev/null` && { trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15 cat >makedefs.test.c <<'EOF' diff --git a/postfix/man/man1/makedefs.1 b/postfix/man/man1/makedefs.1 index c921ac258..1f3f452d3 100644 --- a/postfix/man/man1/makedefs.1 +++ b/postfix/man/man1/makedefs.1 @@ -64,7 +64,8 @@ By default, EPOLL support is compiled in on platforms that are known to support it. .IP \fB\-DNO_EAI\fR Do not build with EAI (SMTPUTF8) support. By default, EAI -support is compiled in when the "pkg\-config" command is +support is compiled in when the "pkgconf" or "pkg\-config" +command are found, or the deprecated "icu\-config" command. .IP \fB\-DNO_INLINE\fR Do not require support for C99 "inline" functions. Instead, diff --git a/postfix/man/man1/postcat.1 b/postfix/man/man1/postcat.1 index f6541eb7c..ae4ef526c 100644 --- a/postfix/man/man1/postcat.1 +++ b/postfix/man/man1/postcat.1 @@ -8,7 +8,7 @@ show Postfix queue file contents .SH "SYNOPSIS" .na .nf -\fBpostcat\fR [\fB\-bdehnoqv\fR] [\fB\-c \fIconfig_dir\fR] [\fIfiles\fR...] +\fBpostcat\fR [\fB\-bdefhnoqv\fR] [\fB\-c \fIconfig_dir\fR] [\fIfiles\fR...] .SH DESCRIPTION .ad .fi @@ -39,6 +39,8 @@ Print the decimal type of each record. Show message envelope content. .sp This feature is available in Postfix 2.7 and later. +.IP \fB\-f\fR +Prepend the file name to each output line. .IP \fB\-h\fR Show message header content. The \fB\-h\fR option produces output from the beginning of the message up to, but not diff --git a/postfix/proto/stop.double-history b/postfix/proto/stop.double-history index 843e59ede..3e1bff20c 100644 --- a/postfix/proto/stop.double-history +++ b/postfix/proto/stop.double-history @@ -128,3 +128,5 @@ proto proto mysql_table proto pgsql_table proto ldap_table an unknown or unimplemented command File smtpd smtpd c inside more consistent Files proto master pipe pipe c unimplemented commands in the SMTP server File smtpd smtpd c + cleanup cleanup h cleanup cleanup_extracted c + File postcat postcat c diff --git a/postfix/proto/stop.spell-cc b/postfix/proto/stop.spell-cc index 1314e0c0e..7397881e6 100644 --- a/postfix/proto/stop.spell-cc +++ b/postfix/proto/stop.spell-cc @@ -1841,3 +1841,4 @@ foqvx ILP xxfi optionsv +bdefhnoqv diff --git a/postfix/proto/stop.spell-history b/postfix/proto/stop.spell-history index 87de3f6f1..e28ab4175 100644 --- a/postfix/proto/stop.spell-history +++ b/postfix/proto/stop.spell-history @@ -81,3 +81,4 @@ cgi mozilla Dilyan Palauzov +pkgconf diff --git a/postfix/src/bounce/Makefile.in b/postfix/src/bounce/Makefile.in index 25bbc5cdf..c0b4c383c 100644 --- a/postfix/src/bounce/Makefile.in +++ b/postfix/src/bounce/Makefile.in @@ -39,12 +39,7 @@ Makefile: Makefile.in test: $(TESTPROG) tests: update template_test obs_template_test 2template_test \ - with-msgid-with-long-line_test \ - with-msgid-with-eoh-event_test \ - with-msgid-no-eoh-event_test \ - no-msgid-with-eoh-event_test \ - no-msgid-no-eoh-event_test \ - with-msgid-with-filter_test + with-message-id_test no-message-id_test root_tests: @@ -72,9 +67,9 @@ template_test: $(PROG) template_test.ref echo myhostname=example.com >>main.cf echo header_from_format=standard >>main.cf touch -t 197101010000 main.cf - MAIL_CONFIG=. ./$(PROG) -SVzndump_templates >template_test.tmp + MAIL_CONFIG=. $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -SVzndump_templates >template_test.tmp diff template_test.ref template_test.tmp - MAIL_CONFIG=. ./$(PROG) -SVzndump_templates \ + MAIL_CONFIG=. $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -SVzndump_templates \ -o bounce_template_file=template_test.ref > template_test.tmp diff template_test.ref template_test.tmp rm -f template_test.tmp main.cf @@ -84,7 +79,7 @@ obs_template_test: $(PROG) obs_template_test.ref echo myhostname=example.com >>main.cf echo header_from_format=obsolete >>main.cf touch -t 197101010000 main.cf - MAIL_CONFIG=. ./$(PROG) -SVzndump_templates >template_test.tmp + MAIL_CONFIG=. $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -SVzndump_templates >template_test.tmp diff obs_template_test.ref template_test.tmp rm -f template_test.tmp main.cf @@ -92,29 +87,31 @@ obs_template_test: $(PROG) obs_template_test.ref echo queue_directory=. >main.cf echo myhostname=example.com >>main.cf touch -t 197101010000 main.cf - MAIL_CONFIG=. ./$(PROG) -SVzndump_templates \ + MAIL_CONFIG=. $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -SVzndump_templates \ -o bounce_template_file=2template_test.in > template_test.tmp diff template_test.ref template_test.tmp rm -f template_test.tmp main.cf -with-msgid-with-long-line_test: bounce_notify_util_tester \ - msgfile-with-msgid-with-long-line logfile-with-msgid-with-long-line \ - with-msgid-with-long-line-no-thread.ref \ - with-msgid-with-long-line-with-thread.ref +# This tests only the handling of an extracted message ID. The +# tests for extracting a message ID belong with the cleanup code. +with-message-id_test: bounce_notify_util_tester \ + msgfile-with-message-id logfile-with-message-id \ + with-message-id-no-thread.ref \ + with-message-id-with-thread.ref rm -rf queue main.cf echo 'enable_threaded_bounces = no' >main.cf echo 'queue_directory = queue' >>main.cf echo 'myhostname = mail.example' >>main.cf touch -t 197101010000 main.cf mkdir -p queue/active queue/bounce - cp logfile-with-msgid-with-long-line queue/bounce/msgid - cp msgfile-with-msgid-with-long-line queue/active/msgid + cp logfile-with-message-id queue/bounce/msgid + cp msgfile-with-message-id queue/active/msgid $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ -c. bounce active msgid 2>&1 | \ sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > with-msgid-with-long-line-no-thread.tmp - diff with-msgid-with-long-line-no-thread.ref with-msgid-with-long-line-no-thread.tmp - rm -f with-msgid-with-long-line-no-thread.tmp + > with-message-id-no-thread.tmp + diff with-message-id-no-thread.ref with-message-id-no-thread.tmp + rm -f with-message-id-no-thread.tmp : rm -rf queue main.cf echo 'enable_threaded_bounces = yes' >main.cf @@ -122,34 +119,34 @@ with-msgid-with-long-line_test: bounce_notify_util_tester \ echo 'myhostname = mail.example' >>main.cf touch -t 197101010000 main.cf mkdir -p queue/active queue/bounce - cp logfile-with-msgid-with-long-line queue/bounce/msgid - cp msgfile-with-msgid-with-long-line queue/active/msgid + cp logfile-with-message-id queue/bounce/msgid + cp msgfile-with-message-id queue/active/msgid $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ -c. bounce active msgid 2>&1 | \ sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > with-msgid-with-long-line-with-thread.tmp - diff with-msgid-with-long-line-with-thread.ref with-msgid-with-long-line-with-thread.tmp - rm -f with-msgid-with-long-line-with-thread.tmp + > with-message-id-with-thread.tmp + diff with-message-id-with-thread.ref with-message-id-with-thread.tmp + rm -f with-message-id-with-thread.tmp rm -rf queue main.cf -with-msgid-with-eoh-event_test: bounce_notify_util_tester \ - msgfile-with-msgid-with-eoh-event logfile-with-msgid-with-eoh-event \ - with-msgid-with-eoh-event-no-thread.ref \ - with-msgid-with-eoh-event-with-thread.ref +no-message-id_test: bounce_notify_util_tester \ + msgfile-no-message-id logfile-no-message-id \ + no-message-id-no-thread.ref \ + no-message-id-with-thread.ref rm -rf queue main.cf echo 'enable_threaded_bounces = no' >main.cf echo 'queue_directory = queue' >>main.cf echo 'myhostname = mail.example' >>main.cf touch -t 197101010000 main.cf mkdir -p queue/active queue/bounce - cp logfile-with-msgid-with-eoh-event queue/bounce/msgid - cp msgfile-with-msgid-with-eoh-event queue/active/msgid + cp logfile-no-message-id queue/bounce/msgid + cp msgfile-no-message-id queue/active/msgid $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ -c. bounce active msgid 2>&1 | \ sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > with-msgid-with-eoh-event-no-thread.tmp - diff with-msgid-with-eoh-event-no-thread.ref with-msgid-with-eoh-event-no-thread.tmp - rm -f with-msgid-with-eoh-event-no-thread.tmp + > no-message-id-no-thread.tmp + diff no-message-id-no-thread.ref no-message-id-no-thread.tmp + rm -f no-message-id-no-thread.tmp : rm -rf queue main.cf echo 'enable_threaded_bounces = yes' >main.cf @@ -157,154 +154,14 @@ with-msgid-with-eoh-event_test: bounce_notify_util_tester \ echo 'myhostname = mail.example' >>main.cf touch -t 197101010000 main.cf mkdir -p queue/active queue/bounce - cp logfile-with-msgid-with-eoh-event queue/bounce/msgid - cp msgfile-with-msgid-with-eoh-event queue/active/msgid + cp logfile-no-message-id queue/bounce/msgid + cp msgfile-no-message-id queue/active/msgid $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ -c. bounce active msgid 2>&1 | \ sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > with-msgid-with-eoh-event-with-thread.tmp - diff with-msgid-with-eoh-event-with-thread.ref with-msgid-with-eoh-event-with-thread.tmp - rm -f with-msgid-with-eoh-event-with-thread.tmp - rm -rf queue main.cf - -with-msgid-no-eoh-event_test: bounce_notify_util_tester \ - msgfile-with-msgid-no-eoh-event logfile-with-msgid-no-eoh-event \ - with-msgid-no-eoh-event-no-thread.ref \ - with-msgid-no-eoh-event-with-thread.ref - rm -rf queue main.cf - echo 'enable_threaded_bounces = no' >main.cf - echo 'queue_directory = queue' >>main.cf - echo 'myhostname = mail.example' >>main.cf - touch -t 197101010000 main.cf - mkdir -p queue/active queue/bounce - cp logfile-with-msgid-no-eoh-event queue/bounce/msgid - cp msgfile-with-msgid-no-eoh-event queue/active/msgid - $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ - -c. bounce active msgid 2>&1 | \ - sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > with-msgid-no-eoh-event-no-thread.tmp - diff with-msgid-no-eoh-event-no-thread.ref with-msgid-no-eoh-event-no-thread.tmp - rm -f with-msgid-no-eoh-event-no-thread.tmp - : - rm -rf queue main.cf - echo 'enable_threaded_bounces = yes' >main.cf - echo 'queue_directory = queue' >>main.cf - echo 'myhostname = mail.example' >>main.cf - touch -t 197101010000 main.cf - mkdir -p queue/active queue/bounce - cp logfile-with-msgid-no-eoh-event queue/bounce/msgid - cp msgfile-with-msgid-no-eoh-event queue/active/msgid - $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ - -c. bounce active msgid 2>&1 | \ - sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > with-msgid-no-eoh-event-with-thread.tmp - diff with-msgid-no-eoh-event-with-thread.ref with-msgid-no-eoh-event-with-thread.tmp - rm -f with-msgid-no-eoh-event-with-thread.tmp - rm -rf queue main.cf - -no-msgid-with-eoh-event_test: bounce_notify_util_tester \ - msgfile-no-msgid-with-eoh-event logfile-no-msgid-with-eoh-event \ - no-msgid-with-eoh-event-no-thread.ref \ - no-msgid-with-eoh-event-with-thread.ref - rm -rf queue main.cf - echo 'enable_threaded_bounces = no' >main.cf - echo 'queue_directory = queue' >>main.cf - echo 'myhostname = mail.example' >>main.cf - touch -t 197101010000 main.cf - mkdir -p queue/active queue/bounce - cp logfile-no-msgid-with-eoh-event queue/bounce/msgid - cp msgfile-no-msgid-with-eoh-event queue/active/msgid - $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ - -c. bounce active msgid 2>&1 | \ - sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > no-msgid-with-eoh-event-no-thread.tmp - diff no-msgid-with-eoh-event-no-thread.ref no-msgid-with-eoh-event-no-thread.tmp - rm -f no-msgid-with-eoh-event-no-thread.tmp - : - rm -rf queue main.cf - echo 'enable_threaded_bounces = yes' >main.cf - echo 'queue_directory = queue' >>main.cf - echo 'myhostname = mail.example' >>main.cf - touch -t 197101010000 main.cf - mkdir -p queue/active queue/bounce - cp logfile-no-msgid-with-eoh-event queue/bounce/msgid - cp msgfile-no-msgid-with-eoh-event queue/active/msgid - $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ - -c. bounce active msgid 2>&1 | \ - sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > no-msgid-with-eoh-event-with-thread.tmp - diff no-msgid-with-eoh-event-with-thread.ref no-msgid-with-eoh-event-with-thread.tmp - rm -f no-msgid-with-eoh-event-with-thread.tmp - rm -rf queue main.cf - -no-msgid-no-eoh-event_test: bounce_notify_util_tester \ - msgfile-no-msgid-no-eoh-event logfile-no-msgid-no-eoh-event \ - no-msgid-no-eoh-event-no-thread.ref \ - no-msgid-no-eoh-event-with-thread.ref - rm -rf queue main.cf - echo 'enable_threaded_bounces = no' >main.cf - echo 'queue_directory = queue' >>main.cf - echo 'myhostname = mail.example' >>main.cf - touch -t 197101010000 main.cf - mkdir -p queue/active queue/bounce - cp logfile-no-msgid-no-eoh-event queue/bounce/msgid - cp msgfile-no-msgid-no-eoh-event queue/active/msgid - $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ - -c. bounce active msgid 2>&1 | \ - sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > no-msgid-no-eoh-event-no-thread.tmp - diff no-msgid-no-eoh-event-no-thread.ref no-msgid-no-eoh-event-no-thread.tmp - rm -f no-msgid-no-eoh-event-no-thread.tmp - : - rm -rf queue main.cf - echo 'enable_threaded_bounces = yes' >main.cf - echo 'queue_directory = queue' >>main.cf - echo 'myhostname = mail.example' >>main.cf - touch -t 197101010000 main.cf - mkdir -p queue/active queue/bounce - cp logfile-no-msgid-no-eoh-event queue/bounce/msgid - cp msgfile-no-msgid-no-eoh-event queue/active/msgid - $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ - -c. bounce active msgid 2>&1 | \ - sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > no-msgid-no-eoh-event-with-thread.tmp - diff no-msgid-no-eoh-event-with-thread.ref no-msgid-no-eoh-event-with-thread.tmp - rm -f no-msgid-no-eoh-event-with-thread.tmp - rm -rf queue main.cf - -with-msgid-with-filter_test: bounce_notify_util_tester \ - msgfile-with-msgid-with-filter logfile-with-msgid-with-filter \ - with-msgid-with-filter-no-thread.ref \ - with-msgid-with-filter-with-thread.ref - rm -rf queue main.cf - echo 'enable_threaded_bounces = no' >main.cf - echo 'queue_directory = queue' >>main.cf - echo 'myhostname = mail.example' >>main.cf - touch -t 197101010000 main.cf - mkdir -p queue/active queue/bounce - cp logfile-with-msgid-with-filter queue/bounce/msgid - cp msgfile-with-msgid-with-filter queue/active/msgid - $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ - -c. bounce active msgid 2>&1 | \ - sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > with-msgid-with-filter-no-thread.tmp - diff with-msgid-with-filter-no-thread.ref with-msgid-with-filter-no-thread.tmp - rm -f with-msgid-with-filter-no-thread.tmp - : - rm -rf queue main.cf - echo 'enable_threaded_bounces = yes' >main.cf - echo 'queue_directory = queue' >>main.cf - echo 'myhostname = mail.example' >>main.cf - touch -t 197101010000 main.cf - mkdir -p queue/active queue/bounce - cp logfile-with-msgid-with-filter queue/bounce/msgid - cp msgfile-with-msgid-with-filter queue/active/msgid - $(SHLIB_ENV) $(VALGRIND) ./bounce_notify_util_tester \ - -c. bounce active msgid 2>&1 | \ - sed 's;msgid.[0-9]*/mail.example;msgid.unix-time/mail.example;' \ - > with-msgid-with-filter-with-thread.tmp - diff with-msgid-with-filter-with-thread.ref with-msgid-with-filter-with-thread.tmp - rm -f with-msgid-with-filter-with-thread.tmp + > no-message-id-with-thread.tmp + diff no-message-id-with-thread.ref no-message-id-with-thread.tmp + rm -f no-message-id-with-thread.tmp rm -rf queue main.cf depend: $(MAKES) diff --git a/postfix/src/bounce/bounce_notify_util.c b/postfix/src/bounce/bounce_notify_util.c index 248235954..bfc92c567 100644 --- a/postfix/src/bounce/bounce_notify_util.c +++ b/postfix/src/bounce/bounce_notify_util.c @@ -230,10 +230,7 @@ static BOUNCE_INFO *bounce_mail_alloc(const char *service, { BOUNCE_INFO *bounce_info; int rec_type; - int prev_type; - int all_headers_seen = 0; int skip_message_segment = 0; - int in_envelope = 1; /* * Bundle up a bunch of parameters and initialize information that will @@ -322,9 +319,8 @@ static BOUNCE_INFO *bounce_mail_alloc(const char *service, DELIVER_LOCK_MODE) < 0) msg_fatal("cannot get shared lock on %s: %m", VSTREAM_PATH(bounce_info->orig_fp)); - for (prev_type = 0; - (rec_type = rec_get(bounce_info->orig_fp, bounce_info->buf, 0)) > 0; - prev_type = rec_type) { + while ((rec_type = + rec_get(bounce_info->orig_fp, bounce_info->buf, 0)) > 0) { /* * Postfix version dependent: data offset in SIZE record. @@ -368,76 +364,28 @@ static BOUNCE_INFO *bounce_mail_alloc(const char *service, msg_warn("%s: no sender before message content record", bounce_info->queue_id); bounce_info->orig_offs = vstream_ftell(bounce_info->orig_fp); - if (var_threaded_bounce == 0) - skip_message_segment = 1; - else - in_envelope = 0; + skip_message_segment = 1; } /* - * Extract Message-ID for threaded bounces. + * Extract Message-ID from extracted segment, for use in threaded + * bounces. */ - else if (in_envelope == 0 - && (rec_type == REC_TYPE_NORM || rec_type == REC_TYPE_CONT)) { - const HEADER_OPTS *hdr; - char *cp; + else if (rec_type == REC_TYPE_ATTR && var_threaded_bounce) { + char *cp = STR(bounce_info->buf); + ssize_t len = sizeof(MAIL_ATTR_MESSAGE_ID); + char *err; - /* - * Skip records that we cannot use. Degrade if we could not - * skip over the message content. - */ - if (var_threaded_bounce == 0 || all_headers_seen - || prev_type == REC_TYPE_CONT) { - /* void */ ; - } - - /* - * Extract message-id header value. - */ - else if (is_header(STR(bounce_info->buf))) { - if ((hdr = header_opts_find( - vstring_str(bounce_info->buf))) != 0 - && hdr->type == HDR_MESSAGE_ID) { - vstring_truncate(bounce_info->buf, - trimblanks(STR(bounce_info->buf), - LEN(bounce_info->buf)) - - STR(bounce_info->buf)); - cp = STR(bounce_info->buf) + strlen(hdr->name) + 1; - while (ISSPACE(*cp)) - cp++; - if (*cp == '<' && vstring_end(bounce_info->buf)[-1] == '>') - vstring_strcpy(bounce_info->orig_msgid, cp); - else - msg_warn("%s: ignoring malformed Message-ID", - bounce_info->queue_id); + if (strncmp(cp, MAIL_ATTR_MESSAGE_ID "=", len) == 0) { + cp += len; + if ((err = extpar(&cp, "<>", EXTPAR_FLAG_NONE)) != 0) { + msg_warn("%s: malformed Message-ID attribute: %s", + bounce_info->queue_id, err); + myfree(err); + } else { + vstring_sprintf(bounce_info->orig_msgid, "<%s>", cp); } } - - /* - * Skip remainder of multiline header. - */ - else if (ISSPACE(*STR(bounce_info->buf))) { - /* void */ ; - } - - /* - * Start of body. - */ - else { - all_headers_seen = 1; - skip_message_segment = 1; - } - } - - /* - * In case we ever want to process records from the extracted - * segment, and in case there was no "start of body" event. - */ - else if (rec_type == REC_TYPE_XTRA) { - if (VSTRING_LEN(bounce_info->orig_msgid) == 0) - if (var_threaded_bounce) - all_headers_seen = 1; - in_envelope = 1; } /* @@ -446,7 +394,7 @@ static BOUNCE_INFO *bounce_mail_alloc(const char *service, if (bounce_info->orig_offs > 0 && bounce_info->arrival_time > 0 && VSTRING_LEN(bounce_info->sender) > 0 - && (var_threaded_bounce == 0 || all_headers_seen + && (var_threaded_bounce == 0 || VSTRING_LEN(bounce_info->orig_msgid) > 0)) { break; } diff --git a/postfix/src/bounce/logfile-no-msgid-no-eoh-event b/postfix/src/bounce/logfile-no-message-id similarity index 94% rename from postfix/src/bounce/logfile-no-msgid-no-eoh-event rename to postfix/src/bounce/logfile-no-message-id index 50233c817..d10c97fc4 100644 --- a/postfix/src/bounce/logfile-no-msgid-no-eoh-event +++ b/postfix/src/bounce/logfile-no-message-id @@ -1,7 +1,7 @@ recipient = rcpt-address original_recipient = rcpt-orig_addr -offset = 272 +offset = 281 notify_flags = rcpt-dsn_notify status = dsn-status action = dsn-action diff --git a/postfix/src/bounce/logfile-with-message-id b/postfix/src/bounce/logfile-with-message-id new file mode 100644 index 000000000..2ca93c3ac --- /dev/null +++ b/postfix/src/bounce/logfile-with-message-id @@ -0,0 +1,13 @@ + +recipient = rcpt-address +original_recipient = rcpt-orig_addr +offset = 280 +notify_flags = rcpt-dsn_notify +status = dsn-status +action = dsn-action +diag_type = dsn-dtype +diag_text = dsn-dtext +mta_type = dsn-mtype +mta_mname = dsn-mname +reason = dsn-reason + diff --git a/postfix/src/bounce/msgfile-no-message-id b/postfix/src/bounce/msgfile-no-message-id new file mode 100755 index 000000000..2e803238f Binary files /dev/null and b/postfix/src/bounce/msgfile-no-message-id differ diff --git a/postfix/src/bounce/msgfile-no-msgid-no-eoh-event b/postfix/src/bounce/msgfile-no-msgid-no-eoh-event deleted file mode 100755 index 694f5dbbf..000000000 Binary files a/postfix/src/bounce/msgfile-no-msgid-no-eoh-event and /dev/null differ diff --git a/postfix/src/bounce/msgfile-no-msgid-with-eoh-event b/postfix/src/bounce/msgfile-no-msgid-with-eoh-event deleted file mode 100755 index b3b795e86..000000000 Binary files a/postfix/src/bounce/msgfile-no-msgid-with-eoh-event and /dev/null differ diff --git a/postfix/src/bounce/msgfile-with-message-id b/postfix/src/bounce/msgfile-with-message-id new file mode 100755 index 000000000..4495ee2ea Binary files /dev/null and b/postfix/src/bounce/msgfile-with-message-id differ diff --git a/postfix/src/bounce/msgfile-with-msgid-no-eoh-event b/postfix/src/bounce/msgfile-with-msgid-no-eoh-event deleted file mode 100755 index cc16c666f..000000000 Binary files a/postfix/src/bounce/msgfile-with-msgid-no-eoh-event and /dev/null differ diff --git a/postfix/src/bounce/msgfile-with-msgid-with-eoh-event b/postfix/src/bounce/msgfile-with-msgid-with-eoh-event deleted file mode 100755 index ffe30c46f..000000000 Binary files a/postfix/src/bounce/msgfile-with-msgid-with-eoh-event and /dev/null differ diff --git a/postfix/src/bounce/msgfile-with-msgid-with-filter b/postfix/src/bounce/msgfile-with-msgid-with-filter deleted file mode 100755 index d6e77c4a7..000000000 Binary files a/postfix/src/bounce/msgfile-with-msgid-with-filter and /dev/null differ diff --git a/postfix/src/bounce/msgfile-with-msgid-with-long-line b/postfix/src/bounce/msgfile-with-msgid-with-long-line deleted file mode 100755 index 69d2801c0..000000000 Binary files a/postfix/src/bounce/msgfile-with-msgid-with-long-line and /dev/null differ diff --git a/postfix/src/bounce/with-msgid-with-filter-no-thread.ref b/postfix/src/bounce/no-message-id-no-thread.ref similarity index 78% rename from postfix/src/bounce/with-msgid-with-filter-no-thread.ref rename to postfix/src/bounce/no-message-id-no-thread.ref index adcd50752..bc5f5098f 100644 --- a/postfix/src/bounce/with-msgid-with-filter-no-thread.ref +++ b/postfix/src/bounce/no-message-id-no-thread.ref @@ -24,7 +24,7 @@ Reporting-MTA: dns; mail.example Original-Envelope-Id: TEST-ENVID X-Postfix-Queue-ID: msgid X-Postfix-Sender: rfc822; sender@sender.example -Arrival-Date: Sat, 05 Dec 2020 13:31:48 -0500 (EST) +Arrival-Date: Wed, 11 Sep 2024 18:05:54 -0400 (EDT) Final-Recipient: rfc822; rcpt-address Original-Recipient: rfc822; rcpt-orig_addr @@ -38,11 +38,12 @@ Content-Description: Undelivered Message Content-Type: message/rfc822 Return-Path: -Received: by wzv.porcupine.org (Postfix, from userid 0) - id 4CpJ7m6tprz4w4Y; Sat, 5 Dec 2020 18:31:48 +0000 (UTC) -From: -To: -Message-Id: <12345@mta-name.example> -Subject: with-msgid-no-eoh-event +Received: by wzv.porcupine.org (Postfix, from userid 1000) + id 4X3vqF3bwhz5Yqq; Wed, 11 Sep 2024 18:05:54 -0400 (EDT) +From: sender@sender.example +To: recipient@recipient.example +Subject: no-message-id + +asdasdd --msgid.unix-time/mail.example-- diff --git a/postfix/src/bounce/with-msgid-no-eoh-event-no-thread.ref b/postfix/src/bounce/no-message-id-with-thread.ref similarity index 76% rename from postfix/src/bounce/with-msgid-no-eoh-event-no-thread.ref rename to postfix/src/bounce/no-message-id-with-thread.ref index 020d9a4c1..bc5f5098f 100644 --- a/postfix/src/bounce/with-msgid-no-eoh-event-no-thread.ref +++ b/postfix/src/bounce/no-message-id-with-thread.ref @@ -24,7 +24,7 @@ Reporting-MTA: dns; mail.example Original-Envelope-Id: TEST-ENVID X-Postfix-Queue-ID: msgid X-Postfix-Sender: rfc822; sender@sender.example -Arrival-Date: Sun, 29 Nov 2020 10:30:41 -0500 (EST) +Arrival-Date: Wed, 11 Sep 2024 18:05:54 -0400 (EDT) Final-Recipient: rfc822; rcpt-address Original-Recipient: rfc822; rcpt-orig_addr @@ -38,12 +38,12 @@ Content-Description: Undelivered Message Content-Type: message/rfc822 Return-Path: -Received: by wzv.porcupine.org (Postfix, from userid 0) - id 4CkXPY0myNz4w4g; Sun, 29 Nov 2020 15:30:41 +0000 (UTC) -From: -To: -Message-Id: <12345@mta-name.example> -Subject: with-msgid-no-eoh-event -Date: Sun, 29 Nov 2020 15:30:41 +0000 (UTC) +Received: by wzv.porcupine.org (Postfix, from userid 1000) + id 4X3vqF3bwhz5Yqq; Wed, 11 Sep 2024 18:05:54 -0400 (EDT) +From: sender@sender.example +To: recipient@recipient.example +Subject: no-message-id + +asdasdd --msgid.unix-time/mail.example-- diff --git a/postfix/src/bounce/with-msgid-with-eoh-event-no-thread.ref b/postfix/src/bounce/with-message-id-no-thread.ref similarity index 75% rename from postfix/src/bounce/with-msgid-with-eoh-event-no-thread.ref rename to postfix/src/bounce/with-message-id-no-thread.ref index 70afb5f33..a013965ce 100644 --- a/postfix/src/bounce/with-msgid-with-eoh-event-no-thread.ref +++ b/postfix/src/bounce/with-message-id-no-thread.ref @@ -24,7 +24,7 @@ Reporting-MTA: dns; mail.example Original-Envelope-Id: TEST-ENVID X-Postfix-Queue-ID: msgid X-Postfix-Sender: rfc822; sender@sender.example -Arrival-Date: Sun, 29 Nov 2020 10:30:41 -0500 (EST) +Arrival-Date: Wed, 11 Sep 2024 18:05:54 -0400 (EDT) Final-Recipient: rfc822; rcpt-address Original-Recipient: rfc822; rcpt-orig_addr @@ -38,14 +38,14 @@ Content-Description: Undelivered Message Content-Type: message/rfc822 Return-Path: -Received: by wzv.porcupine.org (Postfix, from userid 0) - id 4CkXPY10M8z4w4l; Sun, 29 Nov 2020 15:30:41 +0000 (UTC) -From: -To: -Message-Id: <12345@mta-name.example> -Subject: with-msgid-with-eoh-event -Date: Sun, 29 Nov 2020 15:30:41 +0000 (UTC) +Received: by wzv.porcupine.org (Postfix, from userid 1000) + id 4X3vqF3RdBz5Yqn; Wed, 11 Sep 2024 18:05:54 -0400 (EDT) +From: sender@sender.example +To: recipient@recipient.example +Subject: existing-message-id +Message-Id: +Date: Wed, 11 Sep 2024 18:05:54 -0400 (EDT) -body text +asdasdd --msgid.unix-time/mail.example-- diff --git a/postfix/src/bounce/with-msgid-with-filter-with-thread.ref b/postfix/src/bounce/with-message-id-with-thread.ref similarity index 74% rename from postfix/src/bounce/with-msgid-with-filter-with-thread.ref rename to postfix/src/bounce/with-message-id-with-thread.ref index ec3de87fb..47172400c 100644 --- a/postfix/src/bounce/with-msgid-with-filter-with-thread.ref +++ b/postfix/src/bounce/with-message-id-with-thread.ref @@ -1,8 +1,8 @@ From: Mail Delivery System Subject: Undelivered Mail Returned to Sender To: test-recipient -References: <12345@mta-name.example> -In-Reply-To: <12345@mta-name.example> +References: +In-Reply-To: Auto-Submitted: auto-replied MIME-Version: 1.0 Content-Type: multipart/report; report-type=delivery-status; @@ -26,7 +26,7 @@ Reporting-MTA: dns; mail.example Original-Envelope-Id: TEST-ENVID X-Postfix-Queue-ID: msgid X-Postfix-Sender: rfc822; sender@sender.example -Arrival-Date: Sat, 05 Dec 2020 13:31:48 -0500 (EST) +Arrival-Date: Wed, 11 Sep 2024 18:05:54 -0400 (EDT) Final-Recipient: rfc822; rcpt-address Original-Recipient: rfc822; rcpt-orig_addr @@ -40,11 +40,14 @@ Content-Description: Undelivered Message Content-Type: message/rfc822 Return-Path: -Received: by wzv.porcupine.org (Postfix, from userid 0) - id 4CpJ7m6tprz4w4Y; Sat, 5 Dec 2020 18:31:48 +0000 (UTC) -From: -To: -Message-Id: <12345@mta-name.example> -Subject: with-msgid-no-eoh-event +Received: by wzv.porcupine.org (Postfix, from userid 1000) + id 4X3vqF3RdBz5Yqn; Wed, 11 Sep 2024 18:05:54 -0400 (EDT) +From: sender@sender.example +To: recipient@recipient.example +Subject: existing-message-id +Message-Id: +Date: Wed, 11 Sep 2024 18:05:54 -0400 (EDT) + +asdasdd --msgid.unix-time/mail.example-- diff --git a/postfix/src/bounce/with-msgid-no-eoh-event-with-thread.ref b/postfix/src/bounce/with-msgid-no-eoh-event-with-thread.ref deleted file mode 100644 index d2aadd088..000000000 --- a/postfix/src/bounce/with-msgid-no-eoh-event-with-thread.ref +++ /dev/null @@ -1,51 +0,0 @@ -From: Mail Delivery System -Subject: Undelivered Mail Returned to Sender -To: test-recipient -References: <12345@mta-name.example> -In-Reply-To: <12345@mta-name.example> -Auto-Submitted: auto-replied -MIME-Version: 1.0 -Content-Type: multipart/report; report-type=delivery-status; - boundary="msgid.unix-time/mail.example" -Content-Transfer-Encoding: 7bit - -This is a MIME-encapsulated message. - ---msgid.unix-time/mail.example -Content-Description: Notification -Content-Type: text/plain; charset=us-ascii - - - (expanded from ): dsn-reason - ---msgid.unix-time/mail.example -Content-Description: Delivery report -Content-Type: message/delivery-status - -Reporting-MTA: dns; mail.example -Original-Envelope-Id: TEST-ENVID -X-Postfix-Queue-ID: msgid -X-Postfix-Sender: rfc822; sender@sender.example -Arrival-Date: Sun, 29 Nov 2020 10:30:41 -0500 (EST) - -Final-Recipient: rfc822; rcpt-address -Original-Recipient: rfc822; rcpt-orig_addr -Action: failed -Status: dsn-status -Remote-MTA: dsn-mtype; dsn-mname -Diagnostic-Code: dsn-dtype; dsn-dtext - ---msgid.unix-time/mail.example -Content-Description: Undelivered Message -Content-Type: message/rfc822 - -Return-Path: -Received: by wzv.porcupine.org (Postfix, from userid 0) - id 4CkXPY0myNz4w4g; Sun, 29 Nov 2020 15:30:41 +0000 (UTC) -From: -To: -Message-Id: <12345@mta-name.example> -Subject: with-msgid-no-eoh-event -Date: Sun, 29 Nov 2020 15:30:41 +0000 (UTC) - ---msgid.unix-time/mail.example-- diff --git a/postfix/src/bounce/with-msgid-with-eoh-event-with-thread.ref b/postfix/src/bounce/with-msgid-with-eoh-event-with-thread.ref deleted file mode 100644 index e46afbe9f..000000000 --- a/postfix/src/bounce/with-msgid-with-eoh-event-with-thread.ref +++ /dev/null @@ -1,53 +0,0 @@ -From: Mail Delivery System -Subject: Undelivered Mail Returned to Sender -To: test-recipient -References: <12345@mta-name.example> -In-Reply-To: <12345@mta-name.example> -Auto-Submitted: auto-replied -MIME-Version: 1.0 -Content-Type: multipart/report; report-type=delivery-status; - boundary="msgid.unix-time/mail.example" -Content-Transfer-Encoding: 7bit - -This is a MIME-encapsulated message. - ---msgid.unix-time/mail.example -Content-Description: Notification -Content-Type: text/plain; charset=us-ascii - - - (expanded from ): dsn-reason - ---msgid.unix-time/mail.example -Content-Description: Delivery report -Content-Type: message/delivery-status - -Reporting-MTA: dns; mail.example -Original-Envelope-Id: TEST-ENVID -X-Postfix-Queue-ID: msgid -X-Postfix-Sender: rfc822; sender@sender.example -Arrival-Date: Sun, 29 Nov 2020 10:30:41 -0500 (EST) - -Final-Recipient: rfc822; rcpt-address -Original-Recipient: rfc822; rcpt-orig_addr -Action: failed -Status: dsn-status -Remote-MTA: dsn-mtype; dsn-mname -Diagnostic-Code: dsn-dtype; dsn-dtext - ---msgid.unix-time/mail.example -Content-Description: Undelivered Message -Content-Type: message/rfc822 - -Return-Path: -Received: by wzv.porcupine.org (Postfix, from userid 0) - id 4CkXPY10M8z4w4l; Sun, 29 Nov 2020 15:30:41 +0000 (UTC) -From: -To: -Message-Id: <12345@mta-name.example> -Subject: with-msgid-with-eoh-event -Date: Sun, 29 Nov 2020 15:30:41 +0000 (UTC) - -body text - ---msgid.unix-time/mail.example-- diff --git a/postfix/src/bounce/with-msgid-with-long-line-no-thread.ref b/postfix/src/bounce/with-msgid-with-long-line-no-thread.ref deleted file mode 100644 index fa5268bb8..000000000 --- a/postfix/src/bounce/with-msgid-with-long-line-no-thread.ref +++ /dev/null @@ -1,50 +0,0 @@ -From: Mail Delivery System -Subject: Undelivered Mail Returned to Sender -To: test-recipient -Auto-Submitted: auto-replied -MIME-Version: 1.0 -Content-Type: multipart/report; report-type=delivery-status; - boundary="msgid.unix-time/mail.example" -Content-Transfer-Encoding: 7bit - -This is a MIME-encapsulated message. - ---msgid.unix-time/mail.example -Content-Description: Notification -Content-Type: text/plain; charset=us-ascii - - - (expanded from ): dsn-reason - ---msgid.unix-time/mail.example -Content-Description: Delivery report -Content-Type: message/delivery-status - -Reporting-MTA: dns; mail.example -Original-Envelope-Id: TEST-ENVID -X-Postfix-Queue-ID: msgid -X-Postfix-Sender: rfc822; sender@sender.example -Arrival-Date: Sun, 29 Nov 2020 10:30:41 -0500 (EST) - -Final-Recipient: rfc822; rcpt-address -Original-Recipient: rfc822; rcpt-orig_addr -Action: failed -Status: dsn-status -Remote-MTA: dsn-mtype; dsn-mname -Diagnostic-Code: dsn-dtype; dsn-dtext - ---msgid.unix-time/mail.example -Content-Description: Undelivered Message -Content-Type: message/rfc822 - -Return-Path: -Received: by wzv.porcupine.org (Postfix, from userid 0) - id 4CkXPY194lz4w4n; Sun, 29 Nov 2020 15:30:41 +0000 (UTC) -From: -To: -Whatever: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -Message-Id: <12345@mta-name.example> -Subject: with-msgid-with-long-line -Date: Sun, 29 Nov 2020 15:30:41 +0000 (UTC) - ---msgid.unix-time/mail.example-- diff --git a/postfix/src/bounce/with-msgid-with-long-line-with-thread.ref b/postfix/src/bounce/with-msgid-with-long-line-with-thread.ref deleted file mode 100644 index 04e96d68c..000000000 --- a/postfix/src/bounce/with-msgid-with-long-line-with-thread.ref +++ /dev/null @@ -1,52 +0,0 @@ -From: Mail Delivery System -Subject: Undelivered Mail Returned to Sender -To: test-recipient -References: <12345@mta-name.example> -In-Reply-To: <12345@mta-name.example> -Auto-Submitted: auto-replied -MIME-Version: 1.0 -Content-Type: multipart/report; report-type=delivery-status; - boundary="msgid.unix-time/mail.example" -Content-Transfer-Encoding: 7bit - -This is a MIME-encapsulated message. - ---msgid.unix-time/mail.example -Content-Description: Notification -Content-Type: text/plain; charset=us-ascii - - - (expanded from ): dsn-reason - ---msgid.unix-time/mail.example -Content-Description: Delivery report -Content-Type: message/delivery-status - -Reporting-MTA: dns; mail.example -Original-Envelope-Id: TEST-ENVID -X-Postfix-Queue-ID: msgid -X-Postfix-Sender: rfc822; sender@sender.example -Arrival-Date: Sun, 29 Nov 2020 10:30:41 -0500 (EST) - -Final-Recipient: rfc822; rcpt-address -Original-Recipient: rfc822; rcpt-orig_addr -Action: failed -Status: dsn-status -Remote-MTA: dsn-mtype; dsn-mname -Diagnostic-Code: dsn-dtype; dsn-dtext - ---msgid.unix-time/mail.example -Content-Description: Undelivered Message -Content-Type: message/rfc822 - -Return-Path: -Received: by wzv.porcupine.org (Postfix, from userid 0) - id 4CkXPY194lz4w4n; Sun, 29 Nov 2020 15:30:41 +0000 (UTC) -From: -To: -Whatever: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -Message-Id: <12345@mta-name.example> -Subject: with-msgid-with-long-line -Date: Sun, 29 Nov 2020 15:30:41 +0000 (UTC) - ---msgid.unix-time/mail.example-- diff --git a/postfix/src/cleanup/cleanup.h b/postfix/src/cleanup/cleanup.h index baecaadb7..8b0b310e4 100644 --- a/postfix/src/cleanup/cleanup.h +++ b/postfix/src/cleanup/cleanup.h @@ -94,6 +94,7 @@ typedef struct CLEANUP_STATE { char *hdr_rewrite_context; /* header rewrite context */ char *filter; /* from header/body patterns */ char *redirect; /* from header/body patterns */ + char *message_id; /* from Message-ID header */ char *dsn_envid; /* DSN envelope ID */ int dsn_ret; /* DSN full/hdrs */ int dsn_notify; /* DSN never/delay/fail/success */ diff --git a/postfix/src/cleanup/cleanup_extracted.c b/postfix/src/cleanup/cleanup_extracted.c index e6c21227f..a0cbc5a64 100644 --- a/postfix/src/cleanup/cleanup_extracted.c +++ b/postfix/src/cleanup/cleanup_extracted.c @@ -184,6 +184,10 @@ void cleanup_extracted_process(CLEANUP_STATE *state, int type, cleanup_out_string(state, REC_TYPE_FILT, state->filter); if (state->redirect != 0) cleanup_out_string(state, REC_TYPE_RDR, state->redirect); + if (state->message_id != 0) { + cleanup_out_format(state, REC_TYPE_ATTR, "%s=%s", + MAIL_ATTR_MESSAGE_ID, state->message_id); + } if ((encoding = nvtable_find(state->attr, MAIL_ATTR_ENCODING)) != 0) cleanup_out_format(state, REC_TYPE_ATTR, "%s=%s", MAIL_ATTR_ENCODING, encoding); @@ -307,8 +311,8 @@ void cleanup_extracted_finish(CLEANUP_STATE *state) cleanup_addr_bcc(state, var_always_bcc); /* - * Flush non-Milter header/body_checks BCC recipients. Clear hbc_rcpt - * so that it can be used for other purposes. + * Flush non-Milter header/body_checks BCC recipients. Clear hbc_rcpt so + * that it can be used for other purposes. */ if (state->hbc_rcpt) { if (CLEANUP_OUT_OK(state) && state->recip != 0) { diff --git a/postfix/src/cleanup/cleanup_message.c b/postfix/src/cleanup/cleanup_message.c index 0d31598c0..0ff602c5d 100644 --- a/postfix/src/cleanup/cleanup_message.c +++ b/postfix/src/cleanup/cleanup_message.c @@ -626,8 +626,14 @@ static void cleanup_header_callback(void *context, int header_class, */ else { state->headers_seen |= (1 << hdr_opts->type); - if (hdr_opts->type == HDR_MESSAGE_ID) + if (hdr_opts->type == HDR_MESSAGE_ID) { + ssize_t len; + msg_info("%s: message-id=%s", state->queue_id, hdrval); + if (state->message_id == 0 && (len = balpar(hdrval, "<>")) > 0) + /* This Message ID may end up in threaded bounces. */ + state->message_id = printable(mystrndup(hdrval, len), ' '); + } if (hdr_opts->type == HDR_RESENT_MESSAGE_ID) msg_info("%s: resent-message-id=%s", state->queue_id, hdrval); if (hdr_opts->type == HDR_RECEIVED) { @@ -730,6 +736,10 @@ static void cleanup_header_done_callback(void *context) vstring_str(state->temp1)); state->headers_seen |= (1 << (state->resent[0] ? HDR_RESENT_MESSAGE_ID : HDR_MESSAGE_ID)); + if (state->resent[0] == 0 && state->message_id == 0) + state->message_id = concatenate("<", vstring_str(state->temp1), + ">", (char *) 0); + } if ((state->headers_seen & (1 << HDR_MESSAGE_ID)) == 0) msg_info("%s: message-id=<>", state->queue_id); diff --git a/postfix/src/cleanup/cleanup_state.c b/postfix/src/cleanup/cleanup_state.c index 99adf84b9..efe80e66e 100644 --- a/postfix/src/cleanup/cleanup_state.c +++ b/postfix/src/cleanup/cleanup_state.c @@ -117,6 +117,7 @@ CLEANUP_STATE *cleanup_state_alloc(VSTREAM *src) state->hdr_rewrite_context = MAIL_ATTR_RWR_LOCAL; state->filter = 0; state->redirect = 0; + state->message_id = 0; state->dsn_envid = 0; state->dsn_ret = 0; state->dsn_notify = 0; @@ -179,6 +180,8 @@ void cleanup_state_free(CLEANUP_STATE *state) myfree(state->filter); if (state->redirect) myfree(state->redirect); + if (state->message_id) + myfree(state->message_id); if (state->dsn_envid) myfree(state->dsn_envid); if (state->dsn_orcpt) diff --git a/postfix/src/global/mail_proto.h b/postfix/src/global/mail_proto.h index bea0886d1..7cc6452a3 100644 --- a/postfix/src/global/mail_proto.h +++ b/postfix/src/global/mail_proto.h @@ -260,6 +260,8 @@ extern char *mail_pathname(const char *, const char *); #define MAIL_ATTR_ORG_NONE "unknown" /* origin unknown */ #define MAIL_ATTR_ORG_LOCAL "local" /* local submission */ +#define MAIL_ATTR_MESSAGE_ID "message_id" /* Used for threaded bounce */ + /* * XCLIENT/XFORWARD in SMTP. */ diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index fed3f2005..52a5cc1ad 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -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 "20240902" +#define MAIL_RELEASE_DATE "20240917" #define MAIL_VERSION_NUMBER "3.10" #ifdef SNAPSHOT diff --git a/postfix/src/postcat/postcat.c b/postfix/src/postcat/postcat.c index 26b46a91b..1461578fc 100644 --- a/postfix/src/postcat/postcat.c +++ b/postfix/src/postcat/postcat.c @@ -4,7 +4,7 @@ /* SUMMARY /* show Postfix queue file contents /* SYNOPSIS -/* \fBpostcat\fR [\fB-bdehnoqv\fR] [\fB-c \fIconfig_dir\fR] [\fIfiles\fR...] +/* \fBpostcat\fR [\fB-bdefhnoqv\fR] [\fB-c \fIconfig_dir\fR] [\fIfiles\fR...] /* DESCRIPTION /* The \fBpostcat\fR(1) command prints the contents of the /* named \fIfiles\fR in human-readable form. The files are @@ -33,6 +33,8 @@ /* Show message envelope content. /* .sp /* This feature is available in Postfix 2.7 and later. +/* .IP \fB-f\fR +/* Prepend the file name to each output line. /* .IP \fB-h\fR /* Show message header content. The \fB-h\fR option produces /* output from the beginning of the message up to, but not @@ -147,6 +149,7 @@ #define PC_FLAG_PRINT_RTYPE_DEC (1<<5) /* print decimal record type */ #define PC_FLAG_PRINT_RTYPE_SYM (1<<6) /* print symbolic record type */ #define PC_FLAG_RAW (1<<7) /* don't follow pointers */ +#define PC_FLAG_PRINT_PATHNAME (1<<8) /* print pathname */ #define PC_MASK_PRINT_TEXT (PC_FLAG_PRINT_HEADER | PC_FLAG_PRINT_BODY) #define PC_MASK_PRINT_ALL (PC_FLAG_PRINT_ENV | PC_MASK_PRINT_TEXT) @@ -244,6 +247,8 @@ static void postcat(VSTREAM *fp, VSTRING *buffer, int flags) * changed. */ #define PRINT_MARKER(flags, fp, offset, type, text) do { \ + if ((flags) & PC_FLAG_PRINT_PATHNAME) \ + vstream_printf("%s: ", VSTREAM_PATH(fp)); \ if ((flags) & PC_FLAG_PRINT_OFFSET) \ vstream_printf("%9lu ", (unsigned long) (offset)); \ if (flags & PC_FLAG_PRINT_RTYPE_DEC) \ @@ -253,6 +258,8 @@ static void postcat(VSTREAM *fp, VSTRING *buffer, int flags) } while (0) #define PRINT_RECORD(flags, offset, type, value) do { \ + if ((flags) & PC_FLAG_PRINT_PATHNAME) \ + vstream_printf("%s: ", VSTREAM_PATH(fp)); \ if ((flags) & PC_FLAG_PRINT_OFFSET) \ vstream_printf("%9lu ", (unsigned long) (offset)); \ if (flags & PC_FLAG_PRINT_RTYPE_DEC) \ @@ -363,6 +370,8 @@ static void postcat(VSTREAM *fp, VSTRING *buffer, int flags) */ if (do_print == 0) continue; + if (flags & PC_FLAG_PRINT_PATHNAME) + vstream_printf("%s: ", VSTREAM_PATH(fp)); if (flags & PC_FLAG_PRINT_OFFSET) vstream_printf("%9lu ", (unsigned long) offset); if (flags & PC_FLAG_PRINT_RTYPE_DEC) @@ -491,7 +500,7 @@ int main(int argc, char **argv) /* * Parse JCL. */ - while ((ch = GETOPT(argc, argv, "bc:dehoqrs:v")) > 0) { + while ((ch = GETOPT(argc, argv, "bc:defhoqrs:v")) > 0) { switch (ch) { case 'b': flags |= PC_FLAG_PRINT_BODY; @@ -503,6 +512,9 @@ int main(int argc, char **argv) case 'd': flags |= PC_FLAG_PRINT_RTYPE_DEC; break; + case 'f': + flags |= PC_FLAG_PRINT_PATHNAME; + break; case 'e': flags |= PC_FLAG_PRINT_ENV; break;