From: Wietse Venema Date: Thu, 22 Jan 2004 05:00:00 +0000 (-0500) Subject: postfix-2.0.18-20040122 X-Git-Tag: v2.1-RC1-20040331~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50637b38fbdaba91331281192a8e58ae7e8b4f96;p=thirdparty%2Fpostfix.git postfix-2.0.18-20040122 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index b96dbdbab..0540862c2 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -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. diff --git a/postfix/README_FILES/DEBUG_README b/postfix/README_FILES/DEBUG_README index 2cd6ae263..10d2d3c7d 100644 --- a/postfix/README_FILES/DEBUG_README +++ b/postfix/README_FILES/DEBUG_README @@ -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. diff --git a/postfix/README_FILES/FILTER_README b/postfix/README_FILES/FILTER_README index 22f57299b..1ae78e6e2 100644 --- a/postfix/README_FILES/FILTER_README +++ b/postfix/README_FILES/FILTER_README @@ -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 diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 5d7088d23..d576caa19 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -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 ========================================================== diff --git a/postfix/conf/access b/postfix/conf/access index 8c82d98ec..65097cc9a 100644 --- a/postfix/conf/access +++ b/postfix/conf/access @@ -134,61 +134,69 @@ # # 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... @@ -196,46 +204,46 @@ # 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 @@ -246,7 +254,7 @@ # 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) diff --git a/postfix/conf/header_checks b/postfix/conf/header_checks index 9a473a8c5..6b46495a9 100644 --- a/postfix/conf/header_checks +++ b/postfix/conf/header_checks @@ -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. # @@ -36,63 +36,67 @@ # # 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 @@ -125,9 +129,9 @@ # 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 @@ -136,15 +140,15 @@ # 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 @@ -171,7 +175,7 @@ # # 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... @@ -187,13 +191,17 @@ # 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 diff --git a/postfix/conf/postfix-script b/postfix/conf/postfix-script index 389d43d62..b76ef35db 100644 --- a/postfix/conf/postfix-script +++ b/postfix/conf/postfix-script @@ -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 } diff --git a/postfix/html/access.5.html b/postfix/html/access.5.html index 05ee78708..62f7477ac 100644 --- a/postfix/html/access.5.html +++ b/postfix/html/access.5.html @@ -135,61 +135,69 @@ ACCESS(5) ACCESS(5) 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... @@ -197,46 +205,46 @@ ACCESS(5) ACCESS(5) 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 @@ -247,7 +255,7 @@ ACCESS(5) ACCESS(5) 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) diff --git a/postfix/html/header_checks.5.html b/postfix/html/header_checks.5.html index d54482bb7..5cb3ca370 100644 --- a/postfix/html/header_checks.5.html +++ b/postfix/html/header_checks.5.html @@ -21,7 +21,7 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) 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. @@ -37,63 +37,67 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) 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 @@ -126,9 +130,9 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) 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 @@ -137,15 +141,15 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) 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 @@ -172,7 +176,7 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) 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... @@ -188,13 +192,17 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) 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 diff --git a/postfix/man/man5/access.5 b/postfix/man/man5/access.5 index 6bb7b1a4e..82af7e26f 100644 --- a/postfix/man/man5/access.5 +++ b/postfix/man/man5/access.5 @@ -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. diff --git a/postfix/man/man5/header_checks.5 b/postfix/man/man5/header_checks.5 index 1b09d1b5d..a2ec8840a 100644 --- a/postfix/man/man5/header_checks.5 +++ b/postfix/man/man5/header_checks.5 @@ -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 diff --git a/postfix/proto/access b/postfix/proto/access index 700d4f339..2bb8f901d 100644 --- a/postfix/proto/access +++ b/postfix/proto/access @@ -115,8 +115,8 @@ # 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 @@ -125,9 +125,15 @@ # 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. @@ -147,8 +153,8 @@ # 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. @@ -190,7 +196,7 @@ # 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, diff --git a/postfix/proto/header_checks b/postfix/proto/header_checks index de9d487d3..8cb3b4c86 100644 --- a/postfix/proto/header_checks +++ b/postfix/proto/header_checks @@ -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. # @@ -33,25 +33,27 @@ # .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 @@ -113,7 +115,7 @@ # 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 @@ -121,13 +123,13 @@ # .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 @@ -151,7 +153,7 @@ # .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 @@ -163,12 +165,16 @@ # 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 diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index f220878f7..11c705be3 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -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 diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 527f2ddad..a94406b20 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -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. diff --git a/postfix/src/smtpd/smtpd.h b/postfix/src/smtpd/smtpd.h index c5bbe139d..6d9946c10 100644 --- a/postfix/src/smtpd/smtpd.h +++ b/postfix/src/smtpd/smtpd.h @@ -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. diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 0a97b6d43..3030ccea6 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -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. diff --git a/postfix/src/smtpd/smtpd_state.c b/postfix/src/smtpd/smtpd_state.c index d64601dea..e8afdb985 100644 --- a/postfix/src/smtpd/smtpd_state.c +++ b/postfix/src/smtpd/smtpd_state.c @@ -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; diff --git a/postfix/src/util/vstring_vstream.c b/postfix/src/util/vstring_vstream.c index 20ec1a131..2f644bf1d 100644 --- a/postfix/src/util/vstring_vstream.c +++ b/postfix/src/util/vstring_vstream.c @@ -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