]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.0.18-20040122
authorWietse Venema <wietse@porcupine.org>
Thu, 22 Jan 2004 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:29:30 +0000 (06:29 +0000)
19 files changed:
postfix/HISTORY
postfix/README_FILES/DEBUG_README
postfix/README_FILES/FILTER_README
postfix/RELEASE_NOTES
postfix/conf/access
postfix/conf/header_checks
postfix/conf/postfix-script
postfix/html/access.5.html
postfix/html/header_checks.5.html
postfix/man/man5/access.5
postfix/man/man5/header_checks.5
postfix/proto/access
postfix/proto/header_checks
postfix/src/global/mail_version.h
postfix/src/smtpd/smtpd.c
postfix/src/smtpd/smtpd.h
postfix/src/smtpd/smtpd_check.c
postfix/src/smtpd/smtpd_state.c
postfix/src/util/vstring_vstream.c

index b96dbdbab9d2524982e3b0b50d0434f201e5d0c8..0540862c2124dbea1a53f2fec8769f0b94205fd4 100644 (file)
@@ -8917,7 +8917,8 @@ Apologies for any names omitted.
        port is specified.  File: smtp/smtp_addr.c.
 
        Bugfix: restore errno after write failure in SIGCHLD handler.
-       Leandro Santi. File: master/master_sig.c.
+       Leandro Santi (who got the idea from Hernan Perez Masci).
+       File: master/master_sig.c.
 
        Bugfix: the auto_clnt module disconnected too early, causing
        unnecessary work by the anvil server.
@@ -8986,12 +8987,12 @@ Apologies for any names omitted.
        Cleanup: the LDAP client configuration parser is now shared
        between the LDAP, MySQL, and PGSQL clients.  Liviu Daia.
        Files: global/cfgparser.[hc], global/dict_ldap.c,
-       global/dict_mtsql.c, global/dict_pgsql.c and documentation.
+       global/dict_mysql.c, global/dict_pgsql.c and documentation.
 
        Cleanup: moved "util" modules with dependencies on higher-level
        "global" code from the util directory to the global directory:
        util/dict_open.c, global/cfgparser.[hc], global/dict_ldap.c,
-       global/dict_mtsql.c, global/dict_pgsql.c, global/mail_dict.c.
+       global/dict_mysql.c, global/dict_pgsql.c, global/mail_dict.c.
 
        Cleanup: the new queue manager nqmgr replaces the default
        queue manager qmgr, leaving behind a hard link for backwards
@@ -9073,8 +9074,34 @@ Apologies for any names omitted.
        Cleanup: support for the non-standard Errors-To: header
        is removed. File: cleanup/cleanup_message.c.
 
+20040121
+
+       Feature: "PREPEND headername: headervalue" action in Postfix
+       access maps, to facilitate external policy servers that
+       label mail instead of rejecting it. Files: smtpd/smtpd.c,
+       smtpd/smtpd_check.c.
+
+20040122
+
+       UNDO the 20040104 change (vstring_get() etc. return
+       VSTREAM_EOF when they terminate prematurely, instead of
+       returning the last character stored, to avoid mis-leading
+       warnings). File:  global/vstring_vstream.c.
+
+       Portability: test -e is not portable. File: conf/postfix-script.
+
+       Misc. documentation fixes by Victor Duchovni.
+
 Open problems:
 
+       Low: log xdelay (esp. for SMTP and delivery to command).
+
+       Med: smtpd_reject_unknown_sender=yes to control the egress
+       filter.
+
+       Med: cleanup_enable_errors_to=no to control errors-to
+       processing.
+
        Med: silly queue file bit so that the queue manager doesn't
        skip files when fast flush is requested while a queue scan
        is in progress.
index 2cd6ae26364df554200eba036efe025381baf035..10d2d3c7d39c70171c4ff490c9402f31e127f93f 100644 (file)
@@ -48,7 +48,7 @@ Error messages that come later are less useful.
 only a programmer can fix. Postfix cannot proceed until this is
 fixed.
 
-"FATAL" messages are the result of mssing files, incorrect permissions,
+"FATAL" messages are the result of missing files, incorrect permissions,
 incorrect configuration file settings. Postfix cannot proceed until
 this is fixed.
 
index 22f57299b62a603a7a4e3009e51a8dca3fb7667a..1ae78e6e27de6abec8c1b398da317234aadaf373 100644 (file)
@@ -25,7 +25,7 @@ This document describes two approaches to content filtering: simple
 and advanced. Both approaches filter all the mail by default.
 
 At the end are examples that show 1) how to filter only mail from
-remote users only, 2) how to use different filters for different
+remote users, 2) how to use different filters for different
 domains that you provide MX service for, and 3) how to set up
 selective filtering on the basis of message envelope and/or
 header/body patterns.
@@ -318,8 +318,8 @@ a dedicated listener on port localhost 10026:
 
 - Note: do not use spaces around the "=" or "," characters.
 
-- Note: the SMTP server must not have a smaller same process limit
-  than the "filter" master.cf entry.
+- Note: the SMTP server must not have a smaller process limit than
+  the "filter" master.cf entry.
 
 - The "-o content_filter=" overrides main.cf and requests no content
   filtering for incoming mail. This is required or else mail will
index 5d7088d23e5023d03e16ed497238dbfe8960a014..d576caa19f950ea91d74b05f856360daba0e3051 100644 (file)
@@ -12,6 +12,20 @@ snapshot release).  Patches change the patchlevel and the release
 date. Snapshots change only the release date, unless they include
 the same bugfixes as a patch release.
 
+Incompatible changes with Postfix snapshot 2.0.18-2004122
+==========================================================
+
+This release undoes the snapshot 2004120 changes to the Postfix
+line reading routines. These changes caused surprises with lines
+ending in EOF.
+
+Major changes with Postfix snapshot 2.0.18-20040122
+===================================================
+
+New "PREPEND headername: headervalue" action in Postfix access maps
+that can be used by external SMTPD policy servers in order to label
+mail instead of rejecting it.
+
 Incompatible changes with Postfix snapshot 2.0.17-2004120
 ==========================================================
 
index 8c82d98ec96203aaf7a0ece58bd74c47f420f2eb..65097cc9a97ababf10f8c12a0596918d7547152e 100644 (file)
 # 
 #        DEFER_IF_PERMIT optional text...
 #               Defer  the  request if some later restriction would
-#               result in a PERMIT action (there is an implied PER-
-#               MIT  at  the  end  of each restriction list). Reply
-#               with "450 optional text... when the  optional  text
-#               is  specified, otherwise reply with a generic error
-#               response message.
+#               result in a an explicit or implicit PERMIT  action.
+#               Reply  with "450 optional text... when the optional
+#               text is specified, otherwise reply with  a  generic
+#               error response message.
 # 
 #        OK     Accept the address etc. that matches the pattern.
 # 
 #        all-numerical
 #               An all-numerical result is treated as OK. This for-
-#               mat  is generated by address-based relay authoriza-
+#               mat is generated by address-based relay  authoriza-
 #               tion schemes.
 # 
-#        DUNNO  Pretend that the lookup key was not found  in  this
-#               table. This prevents Postfix from trying substrings
-#               of the lookup key (such as a subdomain name,  or  a
-#               network address subnetwork).
+#        DUNNO  Pretend  that  the  lookup  key was not found. This
+#               prevents Postfix  from  trying  substrings  of  the
+#               lookup  key (such as a subdomain name, or a network
+#               address subnetwork).
+# 
+#        PREPEND headername: headervalue
+#               Prepend the specified message header  to  the  mes-
+#               sage.  When this action is used multiple times, the
+#               first prepended header appears  before  the  second
+#               etc. prepended header.
+# 
+#               Note:  this action does not support multi-line mes-
+#               sage headers.
 # 
 #        HOLD optional text...
-#               Place  the message on the hold queue, where it will
-#               sit until someone either deletes it or releases  it
-#               for  delivery.  Log the optional text if specified,
+#               Place the message on the hold queue, where it  will
+#               sit  until someone either deletes it or releases it
+#               for delivery.  Log the optional text if  specified,
 #               otherwise log a generic message.
 # 
-#               Mail that is placed on hold can  be  examined  with
-#               the  postcat(1)  command,  and  can be destroyed or
+#               Mail  that  is  placed on hold can be examined with
+#               the postcat(1) command, and  can  be  destroyed  or
 #               released with the postsuper(1) command.
 # 
-#               Note: this action currently affects all  recipients
+#               Note:  this action currently affects all recipients
 #               of the message.
 # 
 #        DISCARD optional text...
-#               Claim  successful delivery and silently discard the
-#               message.  Log the optional text if specified,  oth-
+#               Claim successful delivery and silently discard  the
+#               message.   Log the optional text if specified, oth-
 #               erwise log a generic message.
 # 
-#               Note:  this action currently affects all recipients
+#               Note: this action currently affects all  recipients
 #               of the message.
 # 
 #        FILTER transport:destination
-#               After the message is queued, send the  entire  mes-
-#               sage  through  a  content filter.  More information
-#               about  content  filters  is  in  the  Postfix  FIL-
-#               TER_README file.
+#               After  the  message is queued, send the entire mes-
+#               sage through the specified external content filter.
+#               More  information about external content filters is
+#               in the Postfix FILTER_README file.
 # 
-#               Note:   this  action  overrides  the  main.cf  con-
+#               Note:  this  action  overrides  the  main.cf   con-
 #               tent_filter  setting,  and  currently  affects  all
 #               recipients of the message.
 # 
 #        REDIRECT user@domain
-#               After  the  message  is queued, send the message to
+#               After the message is queued, send  the  message  to
 #               the  specified  address  instead  of  the  intended
 #               recipient(s).
 # 
-#               Note:  this action overrides the FILTER action, and
+#               Note: this action overrides the FILTER action,  and
 #               currently affects all recipients of the message.
 # 
 #        restriction...
 #               reject_unauth_destination, and so on).
 # 
 # REGULAR EXPRESSION TABLES
-#        This  section  describes how the table lookups change when
+#        This section describes how the table lookups  change  when
 #        the table is given in the form of regular expressions. For
-#        a  description  of regular expression lookup table syntax,
+#        a description of regular expression lookup  table  syntax,
 #        see regexp_table(5) or pcre_table(5).
 # 
-#        Each pattern is a regular expression that  is  applied  to
+#        Each  pattern  is  a regular expression that is applied to
 #        the entire string being looked up. Depending on the appli-
-#        cation, that string  is  an  entire  client  hostname,  an
+#        cation,  that  string  is  an  entire  client hostname, an
 #        entire client IP address, or an entire mail address. Thus,
 #        no  parent  domain  or  parent  network  search  is  done,
-#        user@domain  mail  addresses  are not broken up into their
+#        user@domain mail addresses are not broken  up  into  their
 #        user@ and domain constituent parts, nor is user+foo broken
 #        up into user and foo.
 # 
-#        Patterns  are  applied  in  the  order as specified in the
-#        table, until a pattern is found that  matches  the  search
+#        Patterns are applied in the  order  as  specified  in  the
+#        table,  until  a  pattern is found that matches the search
 #        string.
 # 
-#        Actions  are  the  same as with indexed file lookups, with
-#        the additional feature that parenthesized substrings  from
+#        Actions are the same as with indexed  file  lookups,  with
+#        the  additional feature that parenthesized substrings from
 #        the pattern can be interpolated as $1, $2 and so on.
 # 
 # TCP-BASED TABLES
-#        This  section  describes how the table lookups change when
+#        This section describes how the table lookups  change  when
 #        lookups are directed to a TCP-based server. For a descrip-
-#        tion   of  the  TCP  client/server  lookup  protocol,  see
+#        tion  of  the  TCP  client/server  lookup  protocol,   see
 #        tcp_table(5).
 # 
-#        Each lookup operation uses the entire query  string  once.
-#        Depending  on  the  application,  that string is an entire
+#        Each  lookup  operation uses the entire query string once.
+#        Depending on the application, that  string  is  an  entire
 #        client hostname, an entire client IP address, or an entire
-#        mail  address.   Thus,  no parent domain or parent network
-#        search is done, user@domain mail addresses are not  broken
-#        up  into  their user@ and domain constituent parts, nor is
+#        mail address.  Thus, no parent domain  or  parent  network
+#        search  is done, user@domain mail addresses are not broken
+#        up into their user@ and domain constituent parts,  nor  is
 #        user+foo broken up into user and foo.
 # 
 #        Actions are the same as with indexed file lookups.
 # 
 # BUGS
-#        The table format does not understand quoting  conventions.
+#        The  table format does not understand quoting conventions.
 # 
 # SEE ALSO
 #        postmap(1) create lookup table
 #        tcp_table(5) TCP client/server table lookup protocol
 # 
 # LICENSE
-#        The  Secure  Mailer  license must be distributed with this
+#        The Secure Mailer license must be  distributed  with  this
 #        software.
 # 
 # AUTHOR(S)
index 9a473a8c54a12e219898637aa5942bf0c9d1b169..6b46495a9c4b64c95dae292803f13aec5f87fc45 100644 (file)
@@ -20,7 +20,7 @@
 #        implemented by the Postfix cleanup(8) server.
 # 
 #        Postfix header or body_checks are designed to stop a flood
-#        of mail from worms and viruses. They are not meant to be a
+#        of  mail from worms or viruses. They are not meant to be a
 #        substitute for content filters that decode attachments and
 #        that do other sophisticated content analyses.
 # 
 # 
 #        nested_header_checks (default: $header_checks)
 #               These  are  applied  to  each  message  header   of
-#               attached email messages.
+#               attached   email  messages  (except  for  the  MIME
+#               related headers).
 # 
 #        body_checks
-#               These  are  applied to every other line of content,
-#               including multi-part message boundaries.
+#               These are applied to all other  content,  including
+#               multi-part message boundaries.
 # 
 #        Note: message headers are examined one logical header at a
-#        time,  even  when  a  message header spans multiple lines.
+#        time, even when a message  header  spans  multiple  lines.
 #        Body lines are always examined one line at a time.
 # 
-# REGEXP AND PCRE TABLE FORMAT
-#        Header and body_checks rules are normally specified in the
-#        form of regular expression lookup tables. The best perfor-
-#        mance is  obtained  with  pcre  (Perl  Compatible  Regular
-#        Expression)  tables,  but the slower regexp (POSIX regular
-#        expressions) support is more  widely  available.  Use  the
-#        command postconf -m to find out what types of lookup table
-#        your Postfix system supports.
+# TABLE FORMAT
+#        This  document  assumes  that header and body_checks rules
+#        are specified in the form of  Postfix  regular  expression
+#        lookup  tables.  Usually  the best performance is obtained
+#        with pcre (Perl Compatible Regular Expression) tables, but
+#        the  slower  regexp (POSIX regular expressions) support is
+#        more widely available.  Use the  command  postconf  -m  to
+#        find  out what lookup table types your Postfix system sup-
+#        ports.
 # 
-#        The general format of a header or body_checks table is:
+#        The general format of a Postfix regular  expression  table
+#        is:
 # 
 #        /pattern/flags action
-#               When pattern matches the input string, execute  the
-#               corresponding  action. See below for a list of pos-
+#               When  pattern matches the input string, execute the
+#               corresponding action. See below for a list of  pos-
 #               sible actions.
 # 
 #        !/pattern/flags action
-#               When pattern does not match the input string,  exe-
+#               When  pattern does not match the input string, exe-
 #               cute the corresponding action.
 # 
 #        if /pattern/flags
 # 
 #        endif  Match the input string against the patterns between
-#               if and endif, if and only if the input string  also
+#               if  and endif, if and only if the input string also
 #               matches pattern. The if..endif can nest.
 # 
-#               Note:  do not prepend whitespace to patterns inside
+#               Note: do not prepend whitespace to patterns  inside
 #               if..endif.
 # 
 #        if !/pattern/flags
 # 
 #        endif  Match the input string against the patterns between
-#               if  and endif, if and only if the input string does
+#               if and endif, if and only if the input string  does
 #               not match pattern. The if..endif can nest.
 # 
 #        blank lines and comments
-#               Empty lines and whitespace-only lines are  ignored,
-#               as  are  lines whose first non-whitespace character
+#               Empty  lines and whitespace-only lines are ignored,
+#               as are lines whose first  non-whitespace  character
 #               is a `#'.
 # 
 #        multi-line text
-#               A pattern/action line  starts  with  non-whitespace
-#               text.  A line that starts with whitespace continues
+#               A  pattern/action  line  starts with non-whitespace
+#               text. A line that starts with whitespace  continues
 #               a logical line.
 # 
-#        For a discussion of pattern syntax and flags details,  see
-#        regexp_table(5) or pcre_table(5), respectively.
+#        For  a  discussion  of  specific  pattern  or flags syntax
+#        details, see  pcre_table(5)  or  regexp_table(5),  respec-
+#        tively.
 # 
 # TABLE SEARCH ORDER
 #        For  each  line of message input, the patterns are applied
 #               body_checks  inspection  of the current message and
 #               affects all recipients.
 # 
-#        DUNNO  Pretend that the search string was not  found,  and
-#               inspect  the  next  input  line. This action can be
-#               used to shorten the table search.
+#        DUNNO  Pretend that the input line did not match any  pat-
+#               tern,  and inspect the next input line. This action
+#               can be used to shorten the table search.
 # 
 #               For backwards compatibility reasons,  Postfix  also
 #               accepts  OK but it is (and always has been) treated
 #        FILTER transport:destination
 #               Write a content filter request record to the  queue
 #               file  and  inspect  the next input line.  After the
-#               message is queued, it  will  be  sent  through  the
-#               specified  external  content filter.  More informa-
-#               tion about external content filters is in the Post-
-#               fix FILTER_README file.
+#               complete  message  is  received  it  will  be  sent
+#               through  the  specified  external  content  filter.
+#               More information about external content filters  is
+#               in the Postfix FILTER_README file.
 # 
 #               Note:   this  action  overrides  the  main.cf  con-
 #               tent_filter setting, and affects all recipients  of
 #               the  message.  In  the  case  that  multiple FILTER
-#               actions fire, the only last one is executed.
+#               actions fire, only the last one is executed.
 # 
 #        HOLD optional text...
 #               Arrange for the message to be placed  on  the  hold
 # 
 #               Note: this action overrides the FILTER action,  and
 #               affects  all recipients of the message. If multiple
-#               REDIRECT actions fire only the  last  one  is  exe-
+#               REDIRECT actions fire, only the last  one  is  exe-
 #               cuted.
 # 
 #        REJECT optional text...
 #               Log  a  warning with the optional text... (or log a
 #               generic message) and inspect the next  input  line.
 #               This action is useful for debugging and for testing
-#               a pattern before taking more drastic actions.
+#               a pattern before applying more drastic actions.
 # 
 # BUGS
 #        Many people overlook the main limitations  of  header  and
 #        body_checks  rules.   These  rules  operate on one logical
-#        message header or body line at a time, and a decision made
-#        for one line is not carried over to the next line.
+#        message header or one body line at a time, and a  decision
+#        made for one line is not carried over to the next line.
+# 
+#        Message  headers added by the cleanup(8) daemon itself are
+#        excluded from inspection. Examples of such message headers
+#        are From:, To:, Message-ID:, Date:.
 # 
 # CONFIGURATION PARAMETERS
 #        body_checks
index 389d43d6208862cde7709ca3fdd57edbb5c9318f..b76ef35db9ab7f6b8d6cd1edee5094175b7eb111 100644 (file)
@@ -200,7 +200,7 @@ check)
        do
                test -d $dir && find $dir -type f -print | while read path
                do
-                       test -e /$path && {
+                       test -f /$path && {
                            cmp -s $path /$path || 
                                $WARN $queue_directory/$path and /$path differ
                        }
index 05ee78708318bfddf3432c028e29c53cdad00d1a..62f7477ac7046a27ec320c25e565b70e272f88c3 100644 (file)
@@ -135,61 +135,69 @@ ACCESS(5)                                               ACCESS(5)
 
        <b>DEFER_IF_PERMIT</b> <i>optional text...</i>
               Defer  the  request if some later restriction would
-              result in a PERMIT action (there is an implied PER-
-              MIT  at  the  end  of each restriction list). Reply
-              with "<b>450</b> <i>optional text...</i> when the  optional  text
-              is  specified, otherwise reply with a generic error
-              response message.
+              result in a an explicit or implicit PERMIT  action.
+              Reply  with "<b>450</b> <i>optional text...</i> when the optional
+              text is specified, otherwise reply with  a  generic
+              error response message.
 
        <b>OK</b>     Accept the address etc. that matches the pattern.
 
        <i>all-numerical</i>
               An all-numerical result is treated as OK. This for-
-              mat  is generated by address-based relay authoriza-
+              mat is generated by address-based relay  authoriza-
               tion schemes.
 
-       <b>DUNNO</b>  Pretend that the lookup key was not found  in  this
-              table. This prevents Postfix from trying substrings
-              of the lookup key (such as a subdomain name,  or  a
-              network address subnetwork).
+       <b>DUNNO</b>  Pretend  that  the  lookup  key was not found. This
+              prevents Postfix  from  trying  substrings  of  the
+              lookup  key (such as a subdomain name, or a network
+              address subnetwork).
+
+       <b>PREPEND</b> <i>headername: headervalue</i>
+              Prepend the specified message header  to  the  mes-
+              sage.  When this action is used multiple times, the
+              first prepended header appears  before  the  second
+              etc. prepended header.
+
+              Note:  this action does not support multi-line mes-
+              sage headers.
 
        <b>HOLD</b> <i>optional text...</i>
-              Place  the message on the <b>hold</b> queue, where it will
-              sit until someone either deletes it or releases  it
-              for  delivery.  Log the optional text if specified,
+              Place the message on the <b>hold</b> queue, where it  will
+              sit  until someone either deletes it or releases it
+              for delivery.  Log the optional text if  specified,
               otherwise log a generic message.
 
-              Mail that is placed on hold can  be  examined  with
-              the  <a href="postcat.1.html"><b>postcat</b>(1)</a>  command,  and  can be destroyed or
+              Mail  that  is  placed on hold can be examined with
+              the <a href="postcat.1.html"><b>postcat</b>(1)</a> command, and  can  be  destroyed  or
               released with the <a href="postsuper.1.html"><b>postsuper</b>(1)</a> command.
 
-              Note: this action currently affects all  recipients
+              Note:  this action currently affects all recipients
               of the message.
 
        <b>DISCARD</b> <i>optional text...</i>
-              Claim  successful delivery and silently discard the
-              message.  Log the optional text if specified,  oth-
+              Claim successful delivery and silently discard  the
+              message.   Log the optional text if specified, oth-
               erwise log a generic message.
 
-              Note:  this action currently affects all recipients
+              Note: this action currently affects all  recipients
               of the message.
 
        <b>FILTER</b> <i>transport:destination</i>
-              After the message is queued, send the  entire  mes-
-              sage  through  a  content filter.  More information
-              about  content  filters  is  in  the  Postfix  FIL-
-              TER_README file.
+              After  the  message is queued, send the entire mes-
+              sage through the specified external content filter.
+              More  information about external content filters is
+              in the Postfix FILTER_README file.
 
-              Note:   this  action  overrides  the  <b>main.cf  con-</b>
+              Note:  this  action  overrides  the  <b>main.cf   con-</b>
               <b>tent_filter</b>  setting,  and  currently  affects  all
               recipients of the message.
 
        <b>REDIRECT</b> <i>user@domain</i>
-              After  the  message  is queued, send the message to
+              After the message is queued, send  the  message  to
               the  specified  address  instead  of  the  intended
               recipient(s).
 
-              Note:  this action overrides the FILTER action, and
+              Note: this action overrides the FILTER action,  and
               currently affects all recipients of the message.
 
        <i>restriction...</i>
@@ -197,46 +205,46 @@ ACCESS(5)                                               ACCESS(5)
               <b>reject_unauth_destination</b>, and so on).
 
 <b>REGULAR EXPRESSION TABLES</b>
-       This  section  describes how the table lookups change when
+       This section describes how the table lookups  change  when
        the table is given in the form of regular expressions. For
-       a  description  of regular expression lookup table syntax,
+       a description of regular expression lookup  table  syntax,
        see <a href="regexp_table.5.html"><b>regexp_table</b>(5)</a> or <a href="pcre_table.5.html"><b>pcre_table</b>(5)</a>.
 
-       Each pattern is a regular expression that  is  applied  to
+       Each  pattern  is  a regular expression that is applied to
        the entire string being looked up. Depending on the appli-
-       cation, that string  is  an  entire  client  hostname,  an
+       cation,  that  string  is  an  entire  client hostname, an
        entire client IP address, or an entire mail address. Thus,
        no  parent  domain  or  parent  network  search  is  done,
-       <i>user@domain</i>  mail  addresses  are not broken up into their
+       <i>user@domain</i> mail addresses are not broken  up  into  their
        <i>user@</i> and <i>domain</i> constituent parts, nor is <i>user+foo</i> broken
        up into <i>user</i> and <i>foo</i>.
 
-       Patterns  are  applied  in  the  order as specified in the
-       table, until a pattern is found that  matches  the  search
+       Patterns are applied in the  order  as  specified  in  the
+       table,  until  a  pattern is found that matches the search
        string.
 
-       Actions  are  the  same as with indexed file lookups, with
-       the additional feature that parenthesized substrings  from
+       Actions are the same as with indexed  file  lookups,  with
+       the  additional feature that parenthesized substrings from
        the pattern can be interpolated as <b>$1</b>, <b>$2</b> and so on.
 
 <b>TCP-BASED TABLES</b>
-       This  section  describes how the table lookups change when
+       This section describes how the table lookups  change  when
        lookups are directed to a TCP-based server. For a descrip-
-       tion   of  the  TCP  client/server  lookup  protocol,  see
+       tion  of  the  TCP  client/server  lookup  protocol,   see
        <a href="tcp_table.5.html"><b>tcp_table</b>(5)</a>.
 
-       Each lookup operation uses the entire query  string  once.
-       Depending  on  the  application,  that string is an entire
+       Each  lookup  operation uses the entire query string once.
+       Depending on the application, that  string  is  an  entire
        client hostname, an entire client IP address, or an entire
-       mail  address.   Thus,  no parent domain or parent network
-       search is done, <i>user@domain</i> mail addresses are not  broken
-       up  into  their <i>user@</i> and <i>domain</i> constituent parts, nor is
+       mail address.  Thus, no parent domain  or  parent  network
+       search  is done, <i>user@domain</i> mail addresses are not broken
+       up into their <i>user@</i> and <i>domain</i> constituent parts,  nor  is
        <i>user+foo</i> broken up into <i>user</i> and <i>foo</i>.
 
        Actions are the same as with indexed file lookups.
 
 <b>BUGS</b>
-       The table format does not understand quoting  conventions.
+       The  table format does not understand quoting conventions.
 
 <b>SEE ALSO</b>
        <a href="postmap.1.html">postmap(1)</a> create lookup table
@@ -247,7 +255,7 @@ ACCESS(5)                                               ACCESS(5)
        <a href="tcp_table.5.html">tcp_table(5)</a> TCP client/server table lookup protocol
 
 <b>LICENSE</b>
-       The  Secure  Mailer  license must be distributed with this
+       The Secure Mailer license must be  distributed  with  this
        software.
 
 <b>AUTHOR(S)</b>
index d54482bb75296928f7e8d058f42b0cd8f8b89bb7..5cb3ca3708db6dd1f24fdc3c94b68305b49b7ee5 100644 (file)
@@ -21,7 +21,7 @@ HEADER_CHECKS(5)                                 HEADER_CHECKS(5)
        implemented by the Postfix <a href="cleanup.8.html"><b>cleanup</b>(8)</a> server.
 
        Postfix header or body_checks are designed to stop a flood
-       of mail from worms and viruses. They are not meant to be a
+       of  mail from worms or viruses. They are not meant to be a
        substitute for content filters that decode attachments and
        that do other sophisticated content analyses.
 
@@ -37,63 +37,67 @@ HEADER_CHECKS(5)                                 HEADER_CHECKS(5)
 
        <b>nested_header_checks</b> (default: <b>$header_checks</b>)
               These  are  applied  to  each  message  header   of
-              attached email messages.
+              attached   email  messages  (except  for  the  MIME
+              related headers).
 
        <b>body_checks</b>
-              These  are  applied to every other line of content,
-              including multi-part message boundaries.
+              These are applied to all other  content,  including
+              multi-part message boundaries.
 
        Note: message headers are examined one logical header at a
-       time,  even  when  a  message header spans multiple lines.
+       time, even when a message  header  spans  multiple  lines.
        Body lines are always examined one line at a time.
 
-<b>REGEXP AND PCRE TABLE FORMAT</b>
-       Header and body_checks rules are normally specified in the
-       form of regular expression lookup tables. The best perfor-
-       mance is  obtained  with  <b>pcre</b>  (Perl  Compatible  Regular
-       Expression)  tables,  but the slower <b>regexp</b> (POSIX regular
-       expressions) support is more  widely  available.  Use  the
-       command <b>postconf -m</b> to find out what types of lookup table
-       your Postfix system supports.
+<b>TABLE FORMAT</b>
+       This  document  assumes  that header and body_checks rules
+       are specified in the form of  Postfix  regular  expression
+       lookup  tables.  Usually  the best performance is obtained
+       with <b>pcre</b> (Perl Compatible Regular Expression) tables, but
+       the  slower  <b>regexp</b> (POSIX regular expressions) support is
+       more widely available.  Use the  command  <b>postconf  -m</b>  to
+       find  out what lookup table types your Postfix system sup-
+       ports.
 
-       The general format of a header or body_checks table is:
+       The general format of a Postfix regular  expression  table
+       is:
 
        <b>/</b><i>pattern</i><b>/</b><i>flags action</i>
-              When <i>pattern</i> matches the input string, execute  the
-              corresponding  <i>action</i>. See below for a list of pos-
+              When  <i>pattern</i> matches the input string, execute the
+              corresponding <i>action</i>. See below for a list of  pos-
               sible actions.
 
        <b>!/</b><i>pattern</i><b>/</b><i>flags action</i>
-              When <i>pattern</i> does <b>not</b> match the input string,  exe-
+              When  <i>pattern</i> does <b>not</b> match the input string, exe-
               cute the corresponding <i>action</i>.
 
        <b>if /</b><i>pattern</i><b>/</b><i>flags</i>
 
        <b>endif</b>  Match the input string against the patterns between
-              <b>if</b> and <b>endif</b>, if and only if the input string  also
+              <b>if</b>  and <b>endif</b>, if and only if the input string also
               matches <i>pattern</i>. The <b>if</b>..<b>endif</b> can nest.
 
-              Note:  do not prepend whitespace to patterns inside
+              Note: do not prepend whitespace to patterns  inside
               <b>if</b>..<b>endif</b>.
 
        <b>if !/</b><i>pattern</i><b>/</b><i>flags</i>
 
        <b>endif</b>  Match the input string against the patterns between
-              <b>if</b>  and <b>endif</b>, if and only if the input string does
+              <b>if</b> and <b>endif</b>, if and only if the input string  does
               <b>not</b> match <i>pattern</i>. The <b>if</b>..<b>endif</b> can nest.
 
        blank lines and comments
-              Empty lines and whitespace-only lines are  ignored,
-              as  are  lines whose first non-whitespace character
+              Empty  lines and whitespace-only lines are ignored,
+              as are lines whose first  non-whitespace  character
               is a `#'.
 
        multi-line text
-              A pattern/action line  starts  with  non-whitespace
-              text.  A line that starts with whitespace continues
+              A  pattern/action  line  starts with non-whitespace
+              text. A line that starts with whitespace  continues
               a logical line.
 
-       For a discussion of pattern syntax and flags details,  see
-       <a href="regexp_table.5.html"><b>regexp_table</b>(5)</a> or <a href="pcre_table.5.html"><b>pcre_table</b>(5)</a>, respectively.
+       For  a  discussion  of  specific  pattern  or flags syntax
+       details, see  <a href="pcre_table.5.html"><b>pcre_table</b>(5)</a>  or  <a href="regexp_table.5.html"><b>regexp_table</b>(5)</a>,  respec-
+       tively.
 
 <b>TABLE SEARCH ORDER</b>
        For  each  line of message input, the patterns are applied
@@ -126,9 +130,9 @@ HEADER_CHECKS(5)                                 HEADER_CHECKS(5)
               body_checks  inspection  of the current message and
               affects all recipients.
 
-       <b>DUNNO</b>  Pretend that the search string was not  found,  and
-              inspect  the  next  input  line. This action can be
-              used to shorten the table search.
+       <b>DUNNO</b>  Pretend that the input line did not match any  pat-
+              tern,  and inspect the next input line. This action
+              can be used to shorten the table search.
 
               For backwards compatibility reasons,  Postfix  also
               accepts  <b>OK</b> but it is (and always has been) treated
@@ -137,15 +141,15 @@ HEADER_CHECKS(5)                                 HEADER_CHECKS(5)
        <b>FILTER</b> <i>transport:destination</i>
               Write a content filter request record to the  queue
               file  and  inspect  the next input line.  After the
-              message is queued, it  will  be  sent  through  the
-              specified  external  content filter.  More informa-
-              tion about external content filters is in the Post-
-              fix FILTER_README file.
+              complete  message  is  received  it  will  be  sent
+              through  the  specified  external  content  filter.
+              More information about external content filters  is
+              in the Postfix FILTER_README file.
 
               Note:   this  action  overrides  the  <b>main.cf  con-</b>
               <b>tent_filter</b> setting, and affects all recipients  of
               the  message.  In  the  case  that  multiple <b>FILTER</b>
-              actions fire, the only last one is executed.
+              actions fire, only the last one is executed.
 
        <b>HOLD</b> <i>optional text...</i>
               Arrange for the message to be placed  on  the  <b>hold</b>
@@ -172,7 +176,7 @@ HEADER_CHECKS(5)                                 HEADER_CHECKS(5)
 
               Note: this action overrides the <b>FILTER</b> action,  and
               affects  all recipients of the message. If multiple
-              <b>REDIRECT</b> actions fire only the  last  one  is  exe-
+              <b>REDIRECT</b> actions fire, only the last  one  is  exe-
               cuted.
 
        <b>REJECT</b> <i>optional text...</i>
@@ -188,13 +192,17 @@ HEADER_CHECKS(5)                                 HEADER_CHECKS(5)
               Log  a  warning with the <i>optional text...</i> (or log a
               generic message) and inspect the next  input  line.
               This action is useful for debugging and for testing
-              a pattern before taking more drastic actions.
+              a pattern before applying more drastic actions.
 
 <b>BUGS</b>
        Many people overlook the main limitations  of  header  and
        body_checks  rules.   These  rules  operate on one logical
-       message header or body line at a time, and a decision made
-       for one line is not carried over to the next line.
+       message header or one body line at a time, and a  decision
+       made for one line is not carried over to the next line.
+
+       Message  headers added by the <a href="cleanup.8.html"><b>cleanup</b>(8)</a> daemon itself are
+       excluded from inspection. Examples of such message headers
+       are <b>From:</b>, <b>To:</b>, <b>Message-ID:</b>, <b>Date:</b>.
 
 <b>CONFIGURATION PARAMETERS</b>
        <b>body_checks</b>
index 6bb7b1a4edbb3932037cd9dca3df2a94f3b4d985..82af7e26f576825f610b8351fc2d8189f8a8db74 100644 (file)
@@ -131,8 +131,8 @@ optional text is specified, otherwise reply with a generic error
 response message.
 .IP "\fBDEFER_IF_PERMIT \fIoptional text...\fR
 Defer the request if some later restriction would result in a
-PERMIT action (there is an implied PERMIT at the end of each
-restriction list). Reply with "\fB450\fI optional text...\fR when the
+an explicit or implicit PERMIT action.
+Reply with "\fB450\fI optional text...\fR when the
 optional text is specified, otherwise reply with a generic error
 response message.
 .IP \fBOK\fR
@@ -141,9 +141,15 @@ Accept the address etc. that matches the pattern.
 An all-numerical result is treated as OK. This format is
 generated by address-based relay authorization schemes.
 .IP \fBDUNNO\fR
-Pretend that the lookup key was not found in this table. This
+Pretend that the lookup key was not found. This
 prevents Postfix from trying substrings of the lookup key
 (such as a subdomain name, or a network address subnetwork).
+.IP "\fBPREPEND \fIheadername: headervalue\fR"
+Prepend the specified message header to the message.
+When this action is used multiple times, the first prepended
+header appears before the second etc. prepended header.
+.sp
+Note: this action does not support multi-line message headers.
 .IP "\fBHOLD \fIoptional text...\fR"
 Place the message on the \fBhold\fR queue, where it will sit
 until someone either deletes it or releases it for delivery.
@@ -163,8 +169,8 @@ message.
 Note: this action currently affects all recipients of the message.
 .IP "\fBFILTER \fItransport:destination\fR"
 After the message is queued, send the entire message through
-a content filter.  More information about content filters
-is in the Postfix FILTER_README file.
+the specified external content filter.  More information about
+external content filters is in the Postfix FILTER_README file.
 .sp
 Note: this action overrides the \fBmain.cf content_filter\fR setting,
 and currently affects all recipients of the message.
index 1b09d1b5d0b8e9bc5333832bd97d7c0d7c8806ed..a2ec8840a5abd8f08d10787b59f86ac275af29e1 100644 (file)
@@ -28,7 +28,7 @@ at a time.
 This feature is implemented by the Postfix \fBcleanup\fR(8) server.
 
 Postfix header or body_checks are designed to stop a flood of mail
-from worms and viruses. They are not meant to be a substitute for
+from worms or viruses. They are not meant to be a substitute for
 content filters that decode attachments and that do other
 sophisticated content analyses.
 
@@ -39,27 +39,29 @@ the MIME related headers).
 .IP "\fBmime_header_checks\fR (default: \fB$header_checks\fR)"
 These are applied each MIME related message header only.
 .IP "\fBnested_header_checks\fR (default: \fB$header_checks\fR)"
-These are applied to each message header of attached email messages.
+These are applied to each message header of attached email
+messages (except for the MIME related headers).
 .IP \fBbody_checks\fR
-These are applied to every other line of content, including multi-part
+These are applied to all other content, including multi-part
 message boundaries.
 .PP
 Note: message headers are examined one logical header at a time,
 even when a message header spans multiple lines. Body lines are
 always examined one line at a time.
-.SH REGEXP AND PCRE TABLE FORMAT
+.SH TABLE FORMAT
 .na
 .nf
 .ad
 .fi
-Header and body_checks rules are normally specified in the form of
-regular expression lookup tables. The best performance is obtained
-with \fBpcre\fR (Perl Compatible Regular Expression) tables, but
-the slower \fBregexp\fR (POSIX regular expressions) support is
-more widely available. Use the command \fBpostconf -m\fR to find
-out what types of lookup table your Postfix system supports.
+This document assumes that header and body_checks rules are specified
+in the form of Postfix regular expression lookup tables. Usually the
+best performance is obtained with \fBpcre\fR (Perl Compatible Regular
+Expression) tables, but the slower \fBregexp\fR (POSIX regular
+expressions) support is more widely available.
+Use the command \fBpostconf -m\fR to find out what lookup table
+types your Postfix system supports.
 
-The general format of a header or body_checks table is:
+The general format of a Postfix regular expression table is:
 .IP "\fB/\fIpattern\fB/\fIflags action\fR"
 When \fIpattern\fR matches the input string, execute
 the corresponding \fIaction\fR. See below for a list
@@ -87,8 +89,8 @@ are lines whose first non-whitespace character is a `#'.
 A pattern/action line starts with non-whitespace text. A line that
 starts with whitespace continues a logical line.
 .PP
-For a discussion of pattern syntax and flags details,
-see \fBregexp_table\fR(5) or \fBpcre_table\fR(5), respectively.
+For a discussion of specific pattern or flags syntax details,
+see \fBpcre_table\fR(5) or \fBregexp_table\fR(5), respectively.
 .SH TABLE SEARCH ORDER
 .na
 .nf
@@ -127,7 +129,7 @@ message.
 Note: this action disables further header or body_checks inspection
 of the current message and affects all recipients.
 .IP \fBDUNNO\fR
-Pretend that the search string was not found, and inspect the
+Pretend that the input line did not match any pattern, and inspect the
 next input line. This action can be used to shorten the table search.
 .sp
 For backwards compatibility reasons, Postfix also accepts
@@ -135,13 +137,13 @@ For backwards compatibility reasons, Postfix also accepts
 .IP "\fBFILTER \fItransport:destination\fR"
 Write a content filter request record to the queue file and
 inspect the next input line.
-After the message is queued, it will be sent through
+After the complete message is received it will be sent through
 the specified external content filter.  More information about
 external content filters is in the Postfix FILTER_README file.
 .sp
 Note: this action overrides the \fBmain.cf content_filter\fR setting,
 and affects all recipients of the message. In the case that multiple
-\fBFILTER\fR actions fire, the only last one is executed.
+\fBFILTER\fR actions fire, only the last one is executed.
 .IP "\fBHOLD \fIoptional text...\fR"
 Arrange for the message to be placed on the \fBhold\fR queue,
 and inspect the next input line.  The message remains on \fBhold\fR
@@ -165,7 +167,7 @@ intended recipient(s).
 .sp
 Note: this action overrides the \fBFILTER\fR action, and affects
 all recipients of the message. If multiple \fBREDIRECT\fR actions
-fire only the last one is executed.
+fire, only the last one is executed.
 .IP "\fBREJECT \fIoptional text...\fR
 Reject the entire message. Reply with \fIoptional text...\fR when
 the optional text is specified, otherwise reply with a generic error
@@ -177,14 +179,18 @@ of the current message and affects all recipients.
 Log a warning with the \fIoptional text...\fR (or log a
 generic message) and inspect the next input line. This
 action is useful for debugging and for testing a pattern
-before taking more drastic actions.
+before applying more drastic actions.
 .SH BUGS
 .ad
 .fi
 Many people overlook the main limitations of header and body_checks
-rules.  These rules operate on one logical message header or body
+rules.  These rules operate on one logical message header or one body
 line at a time, and a decision made for one line is not carried over
 to the next line.
+
+Message headers added by the \fBcleanup\fR(8) daemon itself
+are excluded from inspection. Examples of such message headers
+are \fBFrom:\fR, \fBTo:\fR, \fBMessage-ID:\fR, \fBDate:\fR.
 .SH CONFIGURATION PARAMETERS
 .na
 .nf
index 700d4f3397794afa27ab0113c551980b30a637a3..2bb8f901dce31b6fabbbd9dca59d57981c391f31 100644 (file)
 #      response message.
 # .IP "\fBDEFER_IF_PERMIT \fIoptional text...\fR
 #      Defer the request if some later restriction would result in a
-#      PERMIT action (there is an implied PERMIT at the end of each
-#      restriction list). Reply with "\fB450\fI optional text...\fR when the
+#      an explicit or implicit PERMIT action.
+#      Reply with "\fB450\fI optional text...\fR when the
 #      optional text is specified, otherwise reply with a generic error
 #      response message.
 # .IP \fBOK\fR
 #      An all-numerical result is treated as OK. This format is
 #      generated by address-based relay authorization schemes.
 # .IP \fBDUNNO\fR
-#      Pretend that the lookup key was not found in this table. This
+#      Pretend that the lookup key was not found. This
 #      prevents Postfix from trying substrings of the lookup key
 #      (such as a subdomain name, or a network address subnetwork).
+# .IP "\fBPREPEND \fIheadername: headervalue\fR"
+#      Prepend the specified message header to the message.
+#      When this action is used multiple times, the first prepended
+#      header appears before the second etc. prepended header.
+# .sp
+#      Note: this action does not support multi-line message headers.
 # .IP "\fBHOLD \fIoptional text...\fR"
 #      Place the message on the \fBhold\fR queue, where it will sit
 #      until someone either deletes it or releases it for delivery.
 #      Note: this action currently affects all recipients of the message.
 # .IP "\fBFILTER \fItransport:destination\fR"
 #      After the message is queued, send the entire message through
-#       a content filter.  More information about content filters
-#      is in the Postfix FILTER_README file.
+#       the specified external content filter.  More information about
+#      external content filters is in the Postfix FILTER_README file.
 # .sp
 #      Note: this action overrides the \fBmain.cf content_filter\fR setting,
 #      and currently affects all recipients of the message.
 #      are directed to a TCP-based server. For a description of the TCP
 #      client/server lookup protocol, see \fBtcp_table\fR(5).
 #
-#      Each lookup operation uses the entire query string once. 
+#      Each lookup operation uses the entire query string once.
 #      Depending on the application, that string is an entire client
 #      hostname, an entire client IP address, or an entire mail address.
 #      Thus, no parent domain or parent network search is done,
index de9d487d3b65cc1d1f64e4f4a007b4f7b707279e..8cb3b4c863d97136fbd5ac90a44abfddfa8454f6 100644 (file)
@@ -22,7 +22,7 @@
 #      This feature is implemented by the Postfix \fBcleanup\fR(8) server.
 #
 #      Postfix header or body_checks are designed to stop a flood of mail
-#      from worms and viruses. They are not meant to be a substitute for
+#      from worms or viruses. They are not meant to be a substitute for
 #      content filters that decode attachments and that do other
 #      sophisticated content analyses.
 #
 # .IP "\fBmime_header_checks\fR (default: \fB$header_checks\fR)"
 #      These are applied each MIME related message header only.
 # .IP "\fBnested_header_checks\fR (default: \fB$header_checks\fR)"
-#      These are applied to each message header of attached email messages.
+#      These are applied to each message header of attached email
+#      messages (except for the MIME related headers).
 # .IP \fBbody_checks\fR
-#      These are applied to every other line of content, including multi-part
+#      These are applied to all other content, including multi-part
 #      message boundaries.
 # .PP
 #      Note: message headers are examined one logical header at a time,
 #      even when a message header spans multiple lines. Body lines are
 #      always examined one line at a time.
-# REGEXP AND PCRE TABLE FORMAT
+# TABLE FORMAT
 # .ad
 # .fi
-#      Header and body_checks rules are normally specified in the form of
-#      regular expression lookup tables. The best performance is obtained
-#      with \fBpcre\fR (Perl Compatible Regular Expression) tables, but
-#      the slower \fBregexp\fR (POSIX regular expressions) support is
-#      more widely available. Use the command \fBpostconf -m\fR to find
-#      out what types of lookup table your Postfix system supports.
+#      This document assumes that header and body_checks rules are specified
+#      in the form of Postfix regular expression lookup tables. Usually the
+#      best performance is obtained with \fBpcre\fR (Perl Compatible Regular
+#      Expression) tables, but the slower \fBregexp\fR (POSIX regular
+#      expressions) support is more widely available.
+#      Use the command \fBpostconf -m\fR to find out what lookup table
+#      types your Postfix system supports.
 #
-#      The general format of a header or body_checks table is:
+#      The general format of a Postfix regular expression table is:
 # .IP "\fB/\fIpattern\fB/\fIflags action\fR"
 #      When \fIpattern\fR matches the input string, execute
 #      the corresponding \fIaction\fR. See below for a list
@@ -79,8 +81,8 @@
 #      A pattern/action line starts with non-whitespace text. A line that
 #      starts with whitespace continues a logical line.
 # .PP
-#      For a discussion of pattern syntax and flags details,
-#      see \fBregexp_table\fR(5) or \fBpcre_table\fR(5), respectively.
+#      For a discussion of specific pattern or flags syntax details,
+#      see \fBpcre_table\fR(5) or \fBregexp_table\fR(5), respectively.
 # TABLE SEARCH ORDER
 # .ad
 # .fi
 #      Note: this action disables further header or body_checks inspection
 #      of the current message and affects all recipients.
 # .IP \fBDUNNO\fR
-#      Pretend that the search string was not found, and inspect the
+#      Pretend that the input line did not match any pattern, and inspect the
 #      next input line. This action can be used to shorten the table search.
 # .sp
 #      For backwards compatibility reasons, Postfix also accepts
 # .IP "\fBFILTER \fItransport:destination\fR"
 #      Write a content filter request record to the queue file and
 #      inspect the next input line.
-#      After the message is queued, it will be sent through
+#      After the complete message is received it will be sent through
 #      the specified external content filter.  More information about
 #      external content filters is in the Postfix FILTER_README file.
 # .sp
 #      Note: this action overrides the \fBmain.cf content_filter\fR setting,
 #      and affects all recipients of the message. In the case that multiple
-#      \fBFILTER\fR actions fire, the only last one is executed.
+#      \fBFILTER\fR actions fire, only the last one is executed.
 # .IP "\fBHOLD \fIoptional text...\fR"
 #      Arrange for the message to be placed on the \fBhold\fR queue,
 #      and inspect the next input line.  The message remains on \fBhold\fR
 # .sp
 #      Note: this action overrides the \fBFILTER\fR action, and affects
 #      all recipients of the message. If multiple \fBREDIRECT\fR actions
-#      fire only the last one is executed.
+#      fire, only the last one is executed.
 # .IP "\fBREJECT \fIoptional text...\fR
 #      Reject the entire message. Reply with \fIoptional text...\fR when
 #      the optional text is specified, otherwise reply with a generic error
 #      Log a warning with the \fIoptional text...\fR (or log a
 #      generic message) and inspect the next input line. This
 #      action is useful for debugging and for testing a pattern
-#      before taking more drastic actions.
+#      before applying more drastic actions.
 # BUGS
 #      Many people overlook the main limitations of header and body_checks
-#      rules.  These rules operate on one logical message header or body
+#      rules.  These rules operate on one logical message header or one body
 #      line at a time, and a decision made for one line is not carried over
 #      to the next line.
+#
+#      Message headers added by the \fBcleanup\fR(8) daemon itself
+#      are excluded from inspection. Examples of such message headers
+#      are \fBFrom:\fR, \fBTo:\fR, \fBMessage-ID:\fR, \fBDate:\fR.
 # CONFIGURATION PARAMETERS
 # .ad
 # .fi
index f220878f74a4572f496123e30049cc67dbdc100b..11c705be3da027e41a574c96bfae2ba974fbbf12 100644 (file)
@@ -20,8 +20,8 @@
   * Patches change the patchlevel and the release date. Snapshots change the
   * release date only, unless they include the same bugfix as a patch release.
   */
-#define MAIL_RELEASE_DATE      "20040120"
-#define MAIL_VERSION_NUMBER    "2.0.17"
+#define MAIL_RELEASE_DATE      "20040122"
+#define MAIL_VERSION_NUMBER    "2.0.18"
 
 #define VAR_MAIL_VERSION       "mail_version"
 #ifdef SNAPSHOT
index 527f2ddaddbe1c2fa60c172127a53673228c12c1..a94406b20a1ecbba1e1af66d735ea0098aa860dc 100644 (file)
@@ -1189,6 +1189,8 @@ static void mail_reset(SMTPD_STATE *state)
     }
     if (state->xforward.flags)
        smtpd_xforward_reset(state);
+    if (state->prepend)
+       state->prepend = argv_free(state->prepend);
 }
 
 /* rcpt_cmd - process RCPT TO command */
@@ -1319,6 +1321,7 @@ static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
     int     (*out_fprintf) (VSTREAM *, int, const char *,...);
     VSTREAM *out_stream;
     int     out_error;
+    char  **cpp;
 
     /*
      * Sanity checks. With ESMTP command pipelining the client can send DATA
@@ -1385,6 +1388,13 @@ static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
        rec_fputs(state->cleanup, REC_TYPE_MESG, "");
     }
 
+    /*
+     * PREPEND message headers.
+     */
+    if (state->prepend)
+       for (cpp = state->prepend->argv; *cpp; cpp++)
+           out_fprintf(out_stream, REC_TYPE_NORM, "%s", *cpp);
+
     /*
      * Suppress our own Received: header in the unlikely case that we are an
      * intermediate proxy.
index c5bbe139d3fe56a9a8aba8ef72d27a5252e0fb86..6d9946c103f7815325b52e262648953eae3e3afb 100644 (file)
@@ -119,6 +119,7 @@ typedef struct SMTPD_STATE {
     char   *saved_redirect;            /* postponed redirect action */
     int     saved_flags;               /* postponed hold/discard */
     VSTRING *expand_buf;               /* scratch space for $name expansion */
+    ARGV   *prepend;                   /* prepended headers */
 
     /*
      * Pass-through proxy client.
index 0a97b6d436da6ee2d01463977c66827d9ba88db8..3030ccea645ea8e322fe2229f340897da660e3b9 100644 (file)
@@ -1760,6 +1760,8 @@ static int reject_unverified_address(SMTPD_STATE *state, const char *addr,
 
 #ifndef TEST
 
+static int not_in_client_helo(SMTPD_STATE *, const char *, const char *, const char *);
+
 static int can_delegate_action(SMTPD_STATE *state, const char *table,
                                const char *action, const char *reply_class)
 {
@@ -1774,6 +1776,14 @@ static int can_delegate_action(SMTPD_STATE *state, const char *table,
                 table, VAR_SMTPD_PROXY_FILT, action);
        return (0);
     }
+    return (not_in_client_helo(state, table, action, reply_class));
+}
+
+/* not_in_client_helo - not in client or helo restriction context */
+
+static int not_in_client_helo(SMTPD_STATE *state, const char *table,
+                               const char *action, const char *reply_class)
+{
 
     /*
      * If delay_reject=no, then client and helo restrictions take effect
@@ -1954,6 +1964,27 @@ static int check_table_result(SMTPD_STATE *state, const char *table,
        return (SMTPD_CHECK_DUNNO);
     }
 
+    /*
+     * PREPEND prepends the specified message header text.
+     */
+    if (STREQUAL(value, "PREPEND", cmd_len)) {
+#ifndef TEST
+       /* XXX what about ETRN. */
+       if (not_in_client_helo(state, table, "REDIRECT", reply_class) == 0)
+           return (SMTPD_CHECK_DUNNO);
+#endif
+       if (*cmd_text == 0 || is_header(cmd_text) == 0) {
+           msg_warn("access map %s entry \"%s\" requires header: text",
+                    table, datum);
+           return (SMTPD_CHECK_DUNNO);
+       } else {
+           if (state->prepend == 0)
+               state->prepend = argv_alloc(1);
+           argv_add(state->prepend, cmd_text, (char *) 0);
+           return (SMTPD_CHECK_DUNNO);
+       }
+    }
+
     /*
      * All-numeric result probably means OK - some out-of-band authentication
      * mechanism uses this as time stamp.
index d64601deacf7edd20be2f747b9e994c51192be66..e8afdb9852380cfd26a58d618d2132d395f1e0ab 100644 (file)
@@ -100,6 +100,7 @@ void    smtpd_state_init(SMTPD_STATE *state, VSTREAM *stream)
     state->defer_if_permit.reason = 0;
     state->discard = 0;
     state->expand_buf = 0;
+    state->prepend = 0;
     state->proxy = 0;
     state->proxy_buffer = 0;
     state->proxy_mail = 0;
index 20ec1a1316defb87cc5fd608941ea365c90f8525..2f644bf1dc7f994310a49c280dac302ffe942031 100644 (file)
@@ -95,7 +95,7 @@ int     vstring_get(VSTRING *vp, VSTREAM *fp)
            break;
     }
     VSTRING_TERMINATE(vp);
-    return (c == VSTREAM_EOF ? c : VSTRING_GET_RESULT(vp));
+    return (VSTRING_GET_RESULT(vp));
 }
 
 /* vstring_get_nonl - read line from file, strip newline */
@@ -108,7 +108,7 @@ int     vstring_get_nonl(VSTRING *vp, VSTREAM *fp)
     while ((c = VSTREAM_GETC(fp)) != VSTREAM_EOF && c != '\n')
        VSTRING_ADDCH(vp, c);
     VSTRING_TERMINATE(vp);
-    return (c == '\n' || c == VSTREAM_EOF ? c : VSTRING_GET_RESULT(vp));
+    return (c == '\n' ? c : VSTRING_GET_RESULT(vp));
 }
 
 /* vstring_get_null - read null-terminated string from file */
@@ -121,7 +121,7 @@ int     vstring_get_null(VSTRING *vp, VSTREAM *fp)
     while ((c = VSTREAM_GETC(fp)) != VSTREAM_EOF && c != 0)
        VSTRING_ADDCH(vp, c);
     VSTRING_TERMINATE(vp);
-    return (c == 0 || c == VSTREAM_EOF ? c : VSTRING_GET_RESULT(vp));
+    return (c == 0 ? c : VSTRING_GET_RESULT(vp));
 }
 
 /* vstring_get_bound - read line from file, keep newline, up to bound */
@@ -140,7 +140,7 @@ int     vstring_get_bound(VSTRING *vp, VSTREAM *fp, int bound)
            break;
     }
     VSTRING_TERMINATE(vp);
-    return (c == VSTREAM_EOF ? c : VSTRING_GET_RESULT(vp));
+    return (VSTRING_GET_RESULT(vp));
 }
 
 /* vstring_get_nonl_bound - read line from file, strip newline, up to bound */
@@ -156,7 +156,7 @@ int     vstring_get_nonl_bound(VSTRING *vp, VSTREAM *fp, int bound)
     while (bound-- > 0 && (c = VSTREAM_GETC(fp)) != VSTREAM_EOF && c != '\n')
        VSTRING_ADDCH(vp, c);
     VSTRING_TERMINATE(vp);
-    return (c == '\n' || c == VSTREAM_EOF ? c : VSTRING_GET_RESULT(vp));
+    return (c == '\n' ? c : VSTRING_GET_RESULT(vp));
 }
 
 /* vstring_get_null_bound - read null-terminated string from file */
@@ -172,7 +172,7 @@ int     vstring_get_null_bound(VSTRING *vp, VSTREAM *fp, int bound)
     while (bound-- > 0 && (c = VSTREAM_GETC(fp)) != VSTREAM_EOF && c != 0)
        VSTRING_ADDCH(vp, c);
     VSTRING_TERMINATE(vp);
-    return (c == 0 || c == VSTREAM_EOF ? c : VSTRING_GET_RESULT(vp));
+    return (c == 0 ? c : VSTRING_GET_RESULT(vp));
 }
 
 #ifdef TEST