From 8f6da007395f861a6385e6fe5aa313d2aea1c5b9 Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Mon, 14 Nov 2005 00:00:00 -0500 Subject: [PATCH] postfix-2.3-20051114 --- postfix/HISTORY | 32 ++- postfix/RELEASE_NOTES | 29 +++ postfix/conf/postfix-files | 1 + postfix/html/Makefile.in | 6 +- postfix/html/bounce.5.html | 196 ++++++++++++++++ postfix/html/bounce.8.html | 16 +- postfix/html/postconf.1.html | 52 ++++- postfix/html/postconf.5.html | 10 +- postfix/html/postfix-manuals.html | 2 + postfix/html/postfix.1.html | 1 + postfix/man/Makefile.in | 5 +- postfix/man/man1/postconf.1 | 36 ++- postfix/man/man1/postfix.1 | 1 + postfix/man/man5/bounce.5 | 210 ++++++++++++++++++ postfix/man/man5/postconf.5 | 9 + postfix/man/man8/bounce.8 | 5 +- postfix/mantools/postlink | 8 +- postfix/proto/bounce | 189 ++++++++++++++++ postfix/proto/postconf.proto | 10 +- postfix/src/bounce/Makefile.in | 20 +- .../bounce/{fix-template.pl => annotate.pl} | 68 +++--- postfix/src/bounce/bounce.c | 29 ++- postfix/src/bounce/bounce_notify_util.c | 34 +-- postfix/src/bounce/bounce_service.h | 43 ++-- postfix/src/bounce/bounce_template.c | 119 +++++++--- postfix/src/global/mail_version.h | 2 +- postfix/src/master/multi_server.c | 16 +- postfix/src/master/single_server.c | 12 +- postfix/src/master/trigger_server.c | 12 +- postfix/src/postconf/Makefile.in | 1 + postfix/src/postconf/postconf.c | 83 ++++++- postfix/src/postfix/postfix.c | 1 + 32 files changed, 1084 insertions(+), 174 deletions(-) create mode 100644 postfix/html/bounce.5.html create mode 100644 postfix/man/man5/bounce.5 create mode 100644 postfix/proto/bounce rename postfix/src/bounce/{fix-template.pl => annotate.pl} (56%) diff --git a/postfix/HISTORY b/postfix/HISTORY index 8c4e6961e..57780f515 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -11368,13 +11368,31 @@ Apologies for any names omitted. 20051112 - Feature (grumble): configurable bounce message templates - based on contribution by Nicolas Riendeau. I kept the general - format of his templates, but placed them together in one - file to reduce process initialization overhead. Files: - bounce/bounce_template.c, bounce/dict_ml.c (to be moved to - library if useful enough). A sample bounce message template - file is installed as $config_directory/bounce.cf.default. + Feature: configurable bounce message templates based on + contribution by Nicolas Riendeau. I kept the general format + of his templates, but placed them together in one file to + reduce process initialization overhead (most requests to + the bounce daemon are not for sending bounce messages). + Files: bounce/bounce_template.c, bounce/dict_ml.c (to be + moved to library if useful enough). A sample bounce message + template file is installed as $config_directory/bounce.cf.default. + +20051113 + + Feature: "postconf -b filename" to preview the non-default + bounce message templates with $name expansions in the text. + The actual work is of course done by the bounce daemon. + +20051114 + + Feature: -V option to make Postfix daemons to log to stderr. + This is used when a daemon is invoked in stand-alone mode + by a (non-daemon) command. + + Feature: "postconf -t" displays DSN templates, headers and + all; use postconf -t ''" to view built-ins. + + Cleanup: renamed fail_template into failure_template. Open problems: diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 29630648f..1ae66908b 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -17,6 +17,35 @@ Incompatibility with Postfix 2.1 and earlier If you upgrade from Postfix 2.1 or earlier, read RELEASE_NOTES-2.2 before proceeding. +Major changes with snapshot 20051113 +==================================== + +Configurable bounce messages, based on a format that was developed +by Nicolas Riendeau. The file with templates is specified with the +bounce_template_file parameter. Details are in the bounce(5) manual +page, and examples of the built-in templates can be found in a file +bounce.cf.default in the Postfix configuration directory. The +template for the default bounce message looks like this: + + failure_template = < + + If you do so, please include this problem report. You can + delete your own text from the attached returned message. + + The $mail_name program + EOF + Incompatibility with snapshot 20051106 ====================================== diff --git a/postfix/conf/postfix-files b/postfix/conf/postfix-files index 0ff7c876e..ee99c10ee 100644 --- a/postfix/conf/postfix-files +++ b/postfix/conf/postfix-files @@ -143,6 +143,7 @@ $manpage_directory/man1/sendmail.1:f:root:-:644 $manpage_directory/man5/access.5:f:root:-:644 $manpage_directory/man5/aliases.5:f:root:-:644 $manpage_directory/man5/body_checks.5:f:root:-:644 +$manpage_directory/man5/bounce.5:f:root:-:644 $manpage_directory/man5/canonical.5:f:root:-:644 $manpage_directory/man5/cidr_table.5:f:root:-:644 $manpage_directory/man5/generics.5:f:root:-:644:o diff --git a/postfix/html/Makefile.in b/postfix/html/Makefile.in index 139345aed..2f8100480 100644 --- a/postfix/html/Makefile.in +++ b/postfix/html/Makefile.in @@ -18,7 +18,7 @@ CONFIG = access.5.html aliases.5.html canonical.5.html relocated.5.html \ transport.5.html virtual.5.html pcre_table.5.html regexp_table.5.html \ cidr_table.5.html tcp_table.5.html header_checks.5.html \ ldap_table.5.html mysql_table.5.html pgsql_table.5.html \ - master.5.html nisplus_table.5.html generic.5.html + master.5.html nisplus_table.5.html generic.5.html bounce.5.html OTHER = postfix-manuals.html AWK = awk '{ print; if (NR == 2) print ".pl 9999\n.ll 65" }' MAN2HTML = man2html -t "Postfix manual - `IFS=.; set \`echo $@\`; echo \"$$1($$2)\"`" @@ -229,6 +229,10 @@ aliases.5.html: ../proto/aliases PATH=../mantools:$$PATH; \ srctoman - $? | $(AWK) | nroff -man | uniq | $(MAN2HTML) | postlink >$@ +bounce.5.html: ../proto/bounce + PATH=../mantools:$$PATH; \ + srctoman - $? | $(AWK) | nroff -man | uniq | $(MAN2HTML) | postlink >$@ + canonical.5.html: ../proto/canonical PATH=../mantools:$$PATH; \ srctoman - $? | $(AWK) | nroff -man | uniq | $(MAN2HTML) | postlink >$@ diff --git a/postfix/html/bounce.5.html b/postfix/html/bounce.5.html new file mode 100644 index 000000000..5101a569b --- /dev/null +++ b/postfix/html/bounce.5.html @@ -0,0 +1,196 @@ + + + + Postfix manual - bounce(5) +
+BOUNCE(5)                                                            BOUNCE(5)
+
+NAME
+       bounce - Postfix bounce message template format
+
+SYNOPSIS
+       bounce_template_file = /etc/postfix/bounce.cf
+
+       postconf -b [template_file]
+
+DESCRIPTION
+       The  Postfix  bounce(8)  server  produces  delivery status
+       notification  (DSN)  messages  for   undeliverable   mail,
+       delayed  mail, successful delivery or address verification
+       requests.
+
+       By default, these notifications are generated from  built-
+       in  templates with message headers and message text. Sites
+       can override the  built-in  information  by  specifying  a
+       bounce template file with the bounce_template_file config-
+       uration parameter.
+
+       This document describes the general procedure to create  a
+       bounce  template file, followed by the specific details of
+       bounce template formats.
+
+GENERAL PROCEDURE
+       To create customized bounce template file, create a tempo-
+       rary  copy  of the file /etc/postfix/bounce.cf.default and
+       edit the temporary file.
+
+       To preview the results of $name expansions in the template
+       text, use the command
+
+           postconf -b temporary_file
+
+       Errors  in  the  template will be reported to the standard
+       error stream and to the syslog daemon.
+
+       While previewing the  text,  be  sure  to  pay  particular
+       attention  to  the expansion of time value parameters that
+       appear in the delayed mail notification text.
+
+       Once the result is satisfactory, copy the template to  the
+       Postfix  configuration  directory  and  specify in main.cf
+       something like:
+
+       /etc/postfix/main.cf:
+               bounce_template_file = /etc/postfix/bounce.cf
+
+TEMPLATE FILE FORMAT
+       The template file can specify templates for  failed  mail,
+       delayed mail, successful delivery or for address verifica-
+       tion.   These  templates   are   named   failure_template,
+       delay_template,   success_template   and  verify_template,
+       respectively.  You can but do not have to specify all four
+       templates in a bounce template file.
+
+       Each template starts with "template_name = <<EOF" and ends
+       with a line that contains the word  "EOF"  only.  You  can
+       change the word EOF, but you can't enclose it in quotes as
+       with the shell or with  Perl  (template_name  =  <<'EOF').
+       Here is an example:
+
+         # The failure template is used for undeliverable mail.
+
+         failure_template = <<EOF
+         Charset: us-ascii
+         From: MAILER-DAEMON (Mail Delivery System)
+         Subject: Undelivered Mail Returned to Sender
+         Postmaster-Subject: Postmaster Copy: Undelivered Mail
+
+         This is the $mail_name program at host $myhostname.
+
+         I'm sorry to have to inform you that your message could not
+         be delivered to one or more recipients. It's attached below.
+
+         For further assistance, please send mail to <postmaster>
+
+         If you do so, please include this problem report. You can
+         delete your own text from the attached returned message.
+
+                                        The $mail_name program
+         EOF
+
+       No  special meaning is given to the backslash character or
+       to leading whitespace; these are always taken literally.
+
+       Outside the <<  context,  lines  beginning  with  "#"  are
+       ignored,  as  are  empty  lines,  and  lines consisting of
+       whitespace only.
+
+       Examples of  all  templates  can  be  found  in  the  file
+       bounce.cf.default  in the Postfix configuration directory.
+
+TEMPLATE HEADER FORMAT
+       The  first  portion  of  a  bounce  template  consists  of
+       optional  template  headers.   These either become message
+       headers in the delivery status  notification,  or  control
+       the  formatting of the notification. Headers not specified
+       in a template will be left at their default value.
+
+       The following headers are supported:
+
+       Charset:
+              The MIME character  set  of  the  template  message
+              text.   See  the  "TEMPLATE  MESSAGE  TEXT  FORMAT"
+              description below.
+
+       From:  The sender address that the recipient will see.
+
+       Subject:
+              The subject that the recipient will see.
+
+       Postmaster-Subject:
+              The subject that will be used in Postmaster  copies
+              of  undeliverable  or  delayed  mail notifications.
+              These  copies  are  sent  under  control   of   the
+              notify_classes configuration parameter.
+
+       The usage and specification of template message headers is
+       subject to the following restrictions:
+
+       o      Template message header names can be  specified  in
+              upper  case,  lower  case  or  mixed  case. Postfix
+              always uses the spelling as shown  in  the  example
+              above.
+
+       o      Template  message  headers  must  not span multiple
+              lines.
+
+       o      Template message headers must not  contain  main.cf
+              $parameters.
+
+       o      Template message headers must contain ASCII charac-
+              ters only.
+
+TEMPLATE MESSAGE TEXT FORMAT
+       The second portion of a bounce template consists  of  mes-
+       sage  text.  As  the above example shows, template message
+       text may contain main.cf $parameters. Besides the  parame-
+       ters that are defined in main.cf, the following parameters
+       are treated specially depending  on  the  suffix  that  is
+       appended to their name.
+
+       delay_warning_time_suffix
+              Expands  into  the  value of the delay_warning_time
+              parameter, expressed in the time unit specified  by
+              suffix,  which  is  one of seconds, minutes, hours,
+              days, or weeks.
+
+       maximal_queue_lifetime_suffix
+              Expands into the value of  the  maximal_queue_life-
+              time  parameter,  expressed in the time unit speci-
+              fied by suffix.  See above under delay_warning_time
+              for possible suffix values.
+
+       The  usage  and  specification of template message text is
+       subject to the following restrictions:
+
+       o      The template message text is not sent in Postmaster
+              copies of delivery status notifications.
+
+       o      If  the  template  message  text contains non-ASCII
+              characters, Postfix requires that the Charset: tem-
+              plate  header  is  updated.  Specify an appropriate
+              superset of US-ASCII.  A superset is needed because
+              Postfix  appends  ASCII text after the message tem-
+              plate when it sends a delivery status notification.
+
+SEE ALSO
+       bounce(8), Postfix delivery status notifications
+       postconf(5), configuration parameters
+
+LICENSE
+       The  Secure  Mailer  license must be distributed with this
+       software.
+
+HISTORY
+       The Postfix bounce template format was  originally  devel-
+       oped by Nicolas Riendeau.
+
+AUTHOR(S)
+       Wietse Venema
+       IBM T.J. Watson Research
+       P.O. Box 704
+       Yorktown Heights, NY 10598, USA
+
+                                                                     BOUNCE(5)
+
diff --git a/postfix/html/bounce.8.html b/postfix/html/bounce.8.html index 7fa056803..b63647871 100644 --- a/postfix/html/bounce.8.html +++ b/postfix/html/bounce.8.html @@ -7,19 +7,18 @@ BOUNCE(8) BOUNCE(8) NAME - bounce - Postfix message bounce or defer daemon + bounce - Postfix delivery status reports SYNOPSIS bounce [generic Postfix daemon options] DESCRIPTION The bounce(8) daemon maintains per-message log files with - non-delivery status information. Each log file is named - after the queue file that it corresponds to, and is kept - in a queue subdirectory named after the service name in - the master.cf file (either bounce, defer or trace). This - program expects to be run from the master(8) process man- - ager. + delivery status information. Each log file is named after + the queue file that it corresponds to, and is kept in a + queue subdirectory named after the service name in the + master.cf file (either bounce, defer or trace). This pro- + gram expects to be run from the master(8) process manager. The bounce(8) daemon processes two types of service requests: @@ -78,7 +77,7 @@ BOUNCE(8) BOUNCE(8) The maximal amount of original message text that is sent in a non-delivery notification. - bounce_template_file (empty) + bounce_template_file (empty) Pathname of a configuration file with bounce mes- sage templates. @@ -152,6 +151,7 @@ BOUNCE(8) BOUNCE(8) /var/spool/postfix/trace/* delivery status records SEE ALSO + bounce(5), bounce message template format qmgr(8), queue manager postconf(5), configuration parameters master(5), generic daemon options diff --git a/postfix/html/postconf.1.html b/postfix/html/postconf.1.html index da2895a55..55d8c2cec 100644 --- a/postfix/html/postconf.1.html +++ b/postfix/html/postconf.1.html @@ -14,14 +14,31 @@ POSTCONF(1) POSTCONF(1) postconf [-ev] [-c config_dir] [parameter=value ...] + postconf [-btv] [-c config_dir] [template_file] + DESCRIPTION - The postconf(1) command prints the actual value of parame- - ter (all known parameters by default) one parameter per - line, changes its value, or prints other information about + The postconf(1) command displays the actual values of con- + figuration parameters, changes configuration parameter + values, or displays other configuration information about the Postfix mail system. Options: + -b [template_file] + Display the message text that appears at the begin- + ning of delivery status notification (DSN) mes- + sages, with $name expressions replaced by actual + values. To override the built-in message text, + specify a template file at the end of the command + line, or specify a template file in main.cf with + the bounce_template_file parameter. To force + selection of the built-in message text templates, + specify an empty template file name (in shell lan- + guage: ""). + + This feature is available with Postfix 2.3 and + later. + -c config_dir The main.cf configuration file is in the named directory instead of the default configuration @@ -151,15 +168,27 @@ POSTCONF(1) POSTCONF(1) is a group file entry in group(5) format. - Other table types may exist depending on how Postfix was - built. + Other table types may exist depending on how Post- + fix was built. -n Print parameter settings that are not left at their built-in default value, because they are explicitly specified in main.cf. + -t [template_file] + Display the templates for delivery status notifica- + tion (DSN) messages. To override the built-in tem- + plates, specify a template file at the end of the + command line, or specify a template file in main.cf + with the bounce_template_file parameter. To force + selection of the built-in templates, specify an + empty template file name (in shell language: ""). + + This feature is available with Postfix 2.3 and + later. + -v Enable verbose logging for debugging purposes. Mul- - tiple -v options make the software increasingly + tiple -v options make the software increasingly verbose. DIAGNOSTICS @@ -170,20 +199,25 @@ POSTCONF(1) POSTCONF(1) Directory with Postfix configuration files. CONFIGURATION PARAMETERS - The following main.cf parameters are especially relevant + The following main.cf parameters are especially relevant to this program. - The text below provides only a parameter summary. See + The text below provides only a parameter summary. See postconf(5) for more details including examples. config_directory (see 'postconf -d' output) - The default location of the Postfix main.cf and + The default location of the Postfix main.cf and master.cf configuration files. + bounce_template_file (empty) + Pathname of a configuration file with bounce mes- + sage templates. + FILES /etc/postfix/main.cf, Postfix configuration parameters SEE ALSO + bounce(5), bouce template file format postconf(5), configuration parameters README FILES diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 1d721f539..d3ff4cfdf 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -1108,7 +1108,15 @@ proportionally.

(default: empty)

Pathname of a configuration file with bounce message templates. -

+These override the bounce(8) server built-in templates of delivery +status notification (DSN) messages for undeliverable mail, for +delayed mail, for successful delivery, or for mail delivery +verification.

+ +

Template message body text may contain $name references to +Postfix configuration parameters. The result of $name expansion can +be previewed with "postconf -b file_name" before the file +is placed into the Postfix configuration directory.

This feature is available in Postfix 2.3 and later.

diff --git a/postfix/html/postfix-manuals.html b/postfix/html/postfix-manuals.html index 042ee6502..ed013d06f 100644 --- a/postfix/html/postfix-manuals.html +++ b/postfix/html/postfix-manuals.html @@ -111,6 +111,8 @@ the following convention: