2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 13:48:06 +00:00

postfix-2.12-20141119

This commit is contained in:
Wietse Venema 2014-11-19 00:00:00 -05:00 committed by Viktor Dukhovni
parent 7455b66d10
commit 92625903ff
24 changed files with 563 additions and 276 deletions

View File

@ -20778,3 +20778,24 @@ Apologies for any names omitted.
Cleanup: use more meaningful name for global variable so Cleanup: use more meaningful name for global variable so
that it isn't shadowed by a local variable. Based on that it isn't shadowed by a local variable. Based on
complaints from the BEAM static analyzer. smtpstone/smtp-sink.c. complaints from the BEAM static analyzer. smtpstone/smtp-sink.c.
20141119
Cleanup: base64 test driver. File: base64_code.c.
Cleanup: make the CONST_CHAR_STAR typedef project-wide.
Files: global/attr_override.h, util/sys_defs.h.
Feature: BCC action in header/body_checks and milter_header_checks.
Files: proto/header_checks, cleanup/cleanup.h,
cleanup/cleanup_extracted.c, cleanup/cleanup_message.c,
cleanup/cleanup_milter.c, cleanup/cleanup_milter.in16a,
cleanup/cleanup_milter.ref16a1, cleanup/cleanup_milter.ref16a2,
cleanup/cleanup_milter.reg16a, cleanup/cleanup_state.c,
cleanup/test-queue-file16, global/attr_override.h,
global/cleanup_strflags.c, global/cleanup_user.h,
util/sys_defs.h.
Cleanup: don't write back-to-back queue file pointer records
when the "add recipient" action was a NOOP (e.g., because
the recipient was a duplicate). File: cleanup/cleanup_milter.c.

View File

@ -8,6 +8,8 @@ Wish list:
Things to do after the stable release: Things to do after the stable release:
Make the access map BCC action consistent with header_checks.
Find a way to show non-default OPT, DEBUG etc. settings at Find a way to show non-default OPT, DEBUG etc. settings at
the top of the makedefs.out file. the top of the makedefs.out file.

View File

@ -175,13 +175,34 @@
# Action names are case insensitive. They are shown in upper # Action names are case insensitive. They are shown in upper
# case for consistency with other Postfix documentation. # case for consistency with other Postfix documentation.
# #
# BCC user@domain
# Add the specified address as a BCC recipient. The
# address must have a local part and domain part. The
# number of BCC addresses that can be added is lim-
# ited only by the amount of available storage space.
#
# Note 1: the BCC address is added as if it was spec-
# ified with NOTIFY=NONE. The sender will not be
# notified when the BCC address is undeliverable, as
# long as all down-stream software implements RFC
# 3461.
#
# Note 2: this ignores duplicate addresses (with the
# same delivery status notification options).
#
# This feature is available in Postfix 2.12 and
# later.
#
# This feature is not supported with smtp header/body
# checks.
#
# DISCARD optional text... # DISCARD optional text...
# Claim successful delivery and silently discard the # Claim successful delivery and silently discard the
# message. Log the optional text if specified, oth- # message. Log the optional text if specified, oth-
# erwise log a generic message. # erwise log a generic message.
# #
# Note: this action disables further header or # Note: this action disables further header or
# body_checks inspection of the current message and # body_checks inspection of the current message and
# affects all recipients. To discard only one recip- # affects all recipients. To discard only one recip-
# ient without discarding the entire message, use the # ient without discarding the entire message, use the
# transport(5) table to direct mail to the discard(8) # transport(5) table to direct mail to the discard(8)
@ -192,43 +213,43 @@
# This feature is not supported with smtp header/body # This feature is not supported with smtp header/body
# checks. # checks.
# #
# DUNNO Pretend that the input line did not match any pat- # DUNNO Pretend that the input line did not match any pat-
# tern, and inspect the next input line. This action # tern, and inspect the next input line. This action
# can be used to shorten the table search. # can be used to shorten the table search.
# #
# For backwards compatibility reasons, Postfix also # For backwards compatibility reasons, Postfix also
# accepts OK but it is (and always has been) treated # accepts OK but it is (and always has been) treated
# as DUNNO. # as DUNNO.
# #
# This feature is available in Postfix 2.1 and later. # This feature is available in Postfix 2.1 and later.
# #
# FILTER transport:destination # FILTER transport:destination
# After the message is queued, send the entire mes- # After the message is queued, send the entire mes-
# sage through the specified external content filter. # sage through the specified external content filter.
# The transport name specifies the first field of a # The transport name specifies the first field of a
# mail delivery agent definition in master.cf; the # mail delivery agent definition in master.cf; the
# syntax of the next-hop destination is described in # syntax of the next-hop destination is described in
# the manual page of the corresponding delivery # the manual page of the corresponding delivery
# agent. More information about external content # agent. More information about external content
# filters is in the Postfix FILTER_README file. # filters is in the Postfix FILTER_README file.
# #
# Note 1: do not use $number regular expression sub- # Note 1: do not use $number regular expression sub-
# stitutions for transport or destination unless you # stitutions for transport or destination unless you
# know that the information has a trusted origin. # know that the information has a trusted origin.
# #
# Note 2: this action overrides the main.cf con- # Note 2: this action overrides the main.cf con-
# tent_filter setting, and affects all recipients of # tent_filter setting, and affects all recipients of
# the message. In the case that multiple FILTER # the message. In the case that multiple FILTER
# actions fire, only the last one is executed. # actions fire, only the last one is executed.
# #
# Note 3: the purpose of the FILTER command is to # Note 3: the purpose of the FILTER command is to
# override message routing. To override the recipi- # override message routing. To override the recipi-
# ent's transport but not the next-hop destination, # ent's transport but not the next-hop destination,
# specify an empty filter destination (Postfix 2.7 # specify an empty filter destination (Postfix 2.7
# and later), or specify a transport:destination that # and later), or specify a transport:destination that
# delivers through a different Postfix instance # delivers through a different Postfix instance
# (Postfix 2.6 and earlier). Other options are using # (Postfix 2.6 and earlier). Other options are using
# the recipient-dependent transport_maps or the sen- # the recipient-dependent transport_maps or the sen-
# der-dependent sender_dependent_default_transport- # der-dependent sender_dependent_default_transport-
# _maps features. # _maps features.
# #
@ -238,23 +259,23 @@
# checks. # checks.
# #
# HOLD optional text... # HOLD optional text...
# Arrange for the message to be placed on the hold # Arrange for the message to be placed on the hold
# queue, and inspect the next input line. The mes- # queue, and inspect the next input line. The mes-
# sage remains on hold until someone either deletes # sage remains on hold until someone either deletes
# it or releases it for delivery. Log the optional # it or releases it for delivery. Log the optional
# text if specified, otherwise log a generic message. # text if specified, otherwise log a generic message.
# #
# Mail that is placed on hold can be examined with # Mail that is placed on hold can be examined with
# the postcat(1) command, and can be destroyed or # the postcat(1) command, and can be destroyed or
# released with the postsuper(1) command. # released with the postsuper(1) command.
# #
# Note: use "postsuper -r" to release mail that was # Note: use "postsuper -r" to release mail that was
# kept on hold for a significant fraction of $maxi- # kept on hold for a significant fraction of $maxi-
# mal_queue_lifetime or $bounce_queue_lifetime, or # mal_queue_lifetime or $bounce_queue_lifetime, or
# longer. Use "postsuper -H" only for mail that will # longer. Use "postsuper -H" only for mail that will
# not expire within a few delivery attempts. # not expire within a few delivery attempts.
# #
# Note: this action affects all recipients of the # Note: this action affects all recipients of the
# message. # message.
# #
# This feature is available in Postfix 2.0 and later. # This feature is available in Postfix 2.0 and later.
@ -267,30 +288,30 @@
# #
# INFO optional text... # INFO optional text...
# Log an "info:" record with the optional text... (or # Log an "info:" record with the optional text... (or
# log a generic text), and inspect the next input # log a generic text), and inspect the next input
# line. This action is useful for routine logging or # line. This action is useful for routine logging or
# for debugging. # for debugging.
# #
# This feature is available in Postfix 2.8 and later. # This feature is available in Postfix 2.8 and later.
# #
# PREPEND text... # PREPEND text...
# Prepend one line with the specified text, and # Prepend one line with the specified text, and
# inspect the next input line. # inspect the next input line.
# #
# Notes: # Notes:
# #
# o The prepended text is output on a separate # o The prepended text is output on a separate
# line, immediately before the input that # line, immediately before the input that
# triggered the PREPEND action. # triggered the PREPEND action.
# #
# o The prepended text is not considered part of # o The prepended text is not considered part of
# the input stream: it is not subject to # the input stream: it is not subject to
# header/body checks or address rewriting, and # header/body checks or address rewriting, and
# it does not affect the way that Postfix adds # it does not affect the way that Postfix adds
# missing message headers. # missing message headers.
# #
# o When prepending text before a message header # o When prepending text before a message header
# line, the prepended text must begin with a # line, the prepended text must begin with a
# valid message header label. # valid message header label.
# #
# o This action cannot be used to prepend multi- # o This action cannot be used to prepend multi-
@ -302,14 +323,14 @@
# ter_header_checks. # ter_header_checks.
# #
# REDIRECT user@domain # REDIRECT user@domain
# Write a message redirection request to the queue # Write a message redirection request to the queue
# file, and inspect the next input line. After the # file, and inspect the next input line. After the
# message is queued, it will be sent to the specified # message is queued, it will be sent to the specified
# address instead of the intended recipient(s). # address instead of the intended recipient(s).
# #
# Note: this action overrides the FILTER action, and # Note: this action overrides the FILTER action, and
# affects all recipients of the message. If multiple # 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. # cuted.
# #
# This feature is available in Postfix 2.1 and later. # This feature is available in Postfix 2.1 and later.
@ -318,33 +339,33 @@
# checks. # checks.
# #
# REPLACE text... # REPLACE text...
# Replace the current line with the specified text, # Replace the current line with the specified text,
# and inspect the next input line. # and inspect the next input line.
# #
# This feature is available in Postfix 2.2 and later. # This feature is available in Postfix 2.2 and later.
# The description below applies to Postfix 2.2.2 and # The description below applies to Postfix 2.2.2 and
# later. # later.
# #
# Notes: # Notes:
# #
# o When replacing a message header line, the # o When replacing a message header line, the
# replacement text must begin with a valid # replacement text must begin with a valid
# header label. # header label.
# #
# o The replaced text remains part of the input # o The replaced text remains part of the input
# stream. Unlike the result from the PREPEND # stream. Unlike the result from the PREPEND
# action, a replaced message header may be # action, a replaced message header may be
# subject to address rewriting and may affect # subject to address rewriting and may affect
# the way that Postfix adds missing message # the way that Postfix adds missing message
# headers. # headers.
# #
# REJECT optional text... # REJECT optional text...
# Reject the entire message. Reply with optional # Reject the entire message. Reply with optional
# text... when the optional text is specified, other- # text... when the optional text is specified, other-
# wise reply with a generic error message. # wise reply with a generic error message.
# #
# Note: this action disables further header or # Note: this action disables further header or
# body_checks inspection of the current message and # body_checks inspection of the current message and
# affects all recipients. # affects all recipients.
# #
# Postfix version 2.3 and later support enhanced sta- # Postfix version 2.3 and later support enhanced sta-
@ -356,38 +377,38 @@
# checks. # checks.
# #
# WARN optional text... # WARN optional text...
# Log a "warning:" record with the optional text... # Log a "warning:" record with the optional text...
# (or log a generic text), and inspect the next input # (or log a generic text), and inspect the next input
# line. This action is useful for debugging and for # line. This action is useful for debugging and for
# testing a pattern before applying more drastic # testing a pattern before applying more drastic
# actions. # actions.
# #
# BUGS # BUGS
# Empty lines never match, because some map types mis-behave # Empty lines never match, because some map types mis-behave
# when given a zero-length search string. This limitation # when given a zero-length search string. This limitation
# may be removed for regular expression tables in a future # may be removed for regular expression tables in a future
# release. # release.
# #
# Many people overlook the main limitations of header and # Many people overlook the main limitations of header and
# body_checks rules. # body_checks rules.
# #
# o These rules operate on one logical message header # o These rules operate on one logical message header
# or one body line at a time. A decision made for one # or one body line at a time. A decision made for one
# line is not carried over to the next line. # line is not carried over to the next line.
# #
# o If text in the message body is encoded (RFC 2045) # o If text in the message body is encoded (RFC 2045)
# then the rules need to be specified for the encoded # then the rules need to be specified for the encoded
# form. # form.
# #
# o Likewise, when message headers are encoded (RFC # o Likewise, when message headers are encoded (RFC
# 2047) then the rules need to be specified for the # 2047) then the rules need to be specified for the
# encoded form. # encoded form.
# #
# Message headers added by the cleanup(8) daemon itself are # Message headers added by the cleanup(8) daemon itself are
# excluded from inspection. Examples of such message headers # excluded from inspection. Examples of such message headers
# are From:, To:, Message-ID:, Date:. # are From:, To:, Message-ID:, Date:.
# #
# Message headers deleted by the cleanup(8) daemon will be # Message headers deleted by the cleanup(8) daemon will be
# examined before they are deleted. Examples are: Bcc:, Con- # examined before they are deleted. Examples are: Bcc:, Con-
# tent-Length:, Return-Path:. # tent-Length:, Return-Path:.
# #
@ -395,11 +416,11 @@
# body_checks # body_checks
# Lookup tables with content filter rules for message # Lookup tables with content filter rules for message
# body lines. These filters see one physical line at # body lines. These filters see one physical line at
# a time, in chunks of at most $line_length_limit # a time, in chunks of at most $line_length_limit
# bytes. # bytes.
# #
# body_checks_size_limit # body_checks_size_limit
# The amount of content per message body segment # The amount of content per message body segment
# (attachment) that is subjected to $body_checks fil- # (attachment) that is subjected to $body_checks fil-
# tering. # tering.
# #
@ -409,35 +430,35 @@
# #
# nested_header_checks (default: $header_checks) # nested_header_checks (default: $header_checks)
# Lookup tables with content filter rules for message # Lookup tables with content filter rules for message
# header lines: respectively, these are applied to # header lines: respectively, these are applied to
# the initial message headers (not including MIME # the initial message headers (not including MIME
# headers), to the MIME headers anywhere in the mes- # headers), to the MIME headers anywhere in the mes-
# sage, and to the initial headers of attached mes- # sage, and to the initial headers of attached mes-
# sages. # sages.
# #
# Note: these filters see one logical message header # Note: these filters see one logical message header
# at a time, even when a message header spans multi- # at a time, even when a message header spans multi-
# ple lines. Message headers that are longer than # ple lines. Message headers that are longer than
# $header_size_limit characters are truncated. # $header_size_limit characters are truncated.
# #
# disable_mime_input_processing # disable_mime_input_processing
# While receiving mail, give no special treatment to # While receiving mail, give no special treatment to
# MIME related message headers; all text after the # MIME related message headers; all text after the
# initial message headers is considered to be part of # initial message headers is considered to be part of
# the message body. This means that header_checks is # the message body. This means that header_checks is
# applied to all the initial message headers, and # applied to all the initial message headers, and
# that body_checks is applied to the remainder of the # that body_checks is applied to the remainder of the
# message. # message.
# #
# Note: when used in this manner, body_checks will # Note: when used in this manner, body_checks will
# process a multi-line message header one line at a # process a multi-line message header one line at a
# time. # time.
# #
# EXAMPLES # EXAMPLES
# Header pattern to block attachments with bad file name # Header pattern to block attachments with bad file name
# extensions. For convenience, the PCRE /x flag is speci- # extensions. For convenience, the PCRE /x flag is speci-
# fied, so that there is no need to collapse the pattern # fied, so that there is no need to collapse the pattern
# into a single line of text. The purpose of the # into a single line of text. The purpose of the
# [[:xdigit:]] sub-expressions is to recognize Windows CLSID # [[:xdigit:]] sub-expressions is to recognize Windows CLSID
# strings. # strings.
# #
@ -476,7 +497,7 @@
# RFC 2047, message header encoding for non-ASCII text # RFC 2047, message header encoding for non-ASCII text
# #
# README FILES # README FILES
# Use "postconf readme_directory" or "postconf html_direc- # Use "postconf readme_directory" or "postconf html_direc-
# tory" to locate this information. # tory" to locate this information.
# DATABASE_README, Postfix lookup table overview # DATABASE_README, Postfix lookup table overview
# CONTENT_INSPECTION_README, Postfix content inspection overview # CONTENT_INSPECTION_README, Postfix content inspection overview
@ -484,7 +505,7 @@
# BACKSCATTER_README, blocking returned forged mail # BACKSCATTER_README, blocking returned forged mail
# #
# LICENSE # LICENSE
# The Secure Mailer license must be distributed with this # The Secure Mailer license must be distributed with this
# software. # software.
# #
# AUTHOR(S) # AUTHOR(S)

View File

@ -164,13 +164,31 @@ HEADER_CHECKS(5) HEADER_CHECKS(5)
Action names are case insensitive. They are shown in upper case for Action names are case insensitive. They are shown in upper case for
consistency with other Postfix documentation. consistency with other Postfix documentation.
<b>BCC</b> <i>user@domain</i>
Add the specified address as a BCC recipient. The address must
have a local part and domain part. The number of BCC addresses
that can be added is limited only by the amount of available
storage space.
Note 1: the BCC address is added as if it was specified with
NOTIFY=NONE. The sender will not be notified when the BCC
address is undeliverable, as long as all down-stream software
implements <a href="http://tools.ietf.org/html/rfc3461">RFC 3461</a>.
Note 2: this ignores duplicate addresses (with the same delivery
status notification options).
This feature is available in Postfix 2.12 and later.
This feature is not supported with smtp header/body checks.
<b>DISCARD</b> <i>optional text...</i> <b>DISCARD</b> <i>optional text...</i>
Claim successful delivery and silently discard the message. Log Claim successful delivery and silently discard the message. Log
the optional text if specified, otherwise log a generic message. the optional text if specified, otherwise log a generic message.
Note: this action disables further header or <a href="postconf.5.html#body_checks">body_checks</a> inspec- Note: this action disables further header or <a href="postconf.5.html#body_checks">body_checks</a> inspec-
tion of the current message and affects all recipients. To dis- tion of the current message and affects all recipients. To dis-
card only one recipient without discarding the entire message, card only one recipient without discarding the entire message,
use the <a href="transport.5.html">transport(5)</a> table to direct mail to the <a href="discard.8.html">discard(8)</a> ser- use the <a href="transport.5.html">transport(5)</a> table to direct mail to the <a href="discard.8.html">discard(8)</a> ser-
vice. vice.
@ -178,8 +196,8 @@ HEADER_CHECKS(5) HEADER_CHECKS(5)
This feature is not supported with smtp header/body checks. This feature is not supported with smtp header/body checks.
<b>DUNNO</b> Pretend that the input line did not match any pattern, and <b>DUNNO</b> Pretend that the input line did not match any pattern, and
inspect the next input line. This action can be used to shorten inspect the next input line. This action can be used to shorten
the table search. the table search.
For backwards compatibility reasons, Postfix also accepts <b>OK</b> but For backwards compatibility reasons, Postfix also accepts <b>OK</b> but
@ -189,29 +207,29 @@ HEADER_CHECKS(5) HEADER_CHECKS(5)
<b>FILTER</b> <i>transport:destination</i> <b>FILTER</b> <i>transport:destination</i>
After the message is queued, send the entire message through the After the message is queued, send the entire message through the
specified external content filter. The <i>transport</i> name specifies specified external content filter. The <i>transport</i> name specifies
the first field of a mail delivery agent definition in <a href="master.5.html">mas- the first field of a mail delivery agent definition in <a href="master.5.html">mas-
ter.cf</a>; the syntax of the next-hop <i>destination</i> is described in ter.cf</a>; the syntax of the next-hop <i>destination</i> is described in
the manual page of the corresponding delivery agent. More the manual page of the corresponding delivery agent. More
information about external content filters is in the Postfix information about external content filters is in the Postfix
<a href="FILTER_README.html">FILTER_README</a> file. <a href="FILTER_README.html">FILTER_README</a> file.
Note 1: do not use $<i>number</i> regular expression substitutions for Note 1: do not use $<i>number</i> regular expression substitutions for
<i>transport</i> or <i>destination</i> unless you know that the information <i>transport</i> or <i>destination</i> unless you know that the information
has a trusted origin. has a trusted origin.
Note 2: this action overrides the <a href="postconf.5.html">main.cf</a> <b><a href="postconf.5.html#content_filter">content_filter</a></b> set- Note 2: this action overrides the <a href="postconf.5.html">main.cf</a> <b><a href="postconf.5.html#content_filter">content_filter</a></b> set-
ting, and affects all recipients of the message. In the case ting, and affects all recipients of the message. In the case
that multiple <b>FILTER</b> actions fire, only the last one is exe- that multiple <b>FILTER</b> actions fire, only the last one is exe-
cuted. cuted.
Note 3: the purpose of the FILTER command is to override message Note 3: the purpose of the FILTER command is to override message
routing. To override the recipient's <i>transport</i> but not the routing. To override the recipient's <i>transport</i> but not the
next-hop <i>destination</i>, specify an empty filter <i>destination</i> (Post- next-hop <i>destination</i>, specify an empty filter <i>destination</i> (Post-
fix 2.7 and later), or specify a <i>transport:destination</i> that fix 2.7 and later), or specify a <i>transport:destination</i> that
delivers through a different Postfix instance (Postfix 2.6 and delivers through a different Postfix instance (Postfix 2.6 and
earlier). Other options are using the recipient-dependent <b><a href="postconf.5.html#transport_maps">trans</a>-</b> earlier). Other options are using the recipient-dependent <b><a href="postconf.5.html#transport_maps">trans</a>-</b>
<b><a href="postconf.5.html#transport_maps">port_maps</a></b> or the sender-dependent <b><a href="postconf.5.html#sender_dependent_default_transport_maps">sender_dependent_default-</b> <b><a href="postconf.5.html#transport_maps">port_maps</a></b> or the sender-dependent <b><a href="postconf.5.html#sender_dependent_default_transport_maps">sender_dependent_default-</b>
<b>_transport_maps</a></b> features. <b>_transport_maps</a></b> features.
This feature is available in Postfix 2.0 and later. This feature is available in Postfix 2.0 and later.
@ -219,18 +237,18 @@ HEADER_CHECKS(5) HEADER_CHECKS(5)
This feature is not supported with smtp header/body checks. This feature is not supported with smtp header/body checks.
<b>HOLD</b> <i>optional text...</i> <b>HOLD</b> <i>optional text...</i>
Arrange for the message to be placed on the <b>hold</b> queue, and Arrange for the message to be placed on the <b>hold</b> queue, and
inspect the next input line. The message remains on <b>hold</b> until inspect the next input line. The message remains on <b>hold</b> until
someone either deletes it or releases it for delivery. Log the someone either deletes it or releases it for delivery. Log the
optional text if specified, otherwise log a generic message. 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> 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, and can be destroyed or released with the <a href="postsuper.1.html"><b>postsuper</b>(1)</a>
command. command.
Note: use "<b>postsuper -r</b>" to release mail that was kept on hold Note: use "<b>postsuper -r</b>" to release mail that was kept on hold
for a significant fraction of <b>$<a href="postconf.5.html#maximal_queue_lifetime">maximal_queue_lifetime</a></b> or for a significant fraction of <b>$<a href="postconf.5.html#maximal_queue_lifetime">maximal_queue_lifetime</a></b> or
<b>$<a href="postconf.5.html#bounce_queue_lifetime">bounce_queue_lifetime</a></b>, or longer. Use "<b>postsuper -H</b>" only for <b>$<a href="postconf.5.html#bounce_queue_lifetime">bounce_queue_lifetime</a></b>, or longer. Use "<b>postsuper -H</b>" only for
mail that will not expire within a few delivery attempts. mail that will not expire within a few delivery attempts.
Note: this action affects all recipients of the message. Note: this action affects all recipients of the message.
@ -239,32 +257,32 @@ HEADER_CHECKS(5) HEADER_CHECKS(5)
This feature is not supported with smtp header/body checks. This feature is not supported with smtp header/body checks.
<b>IGNORE</b> Delete the current line from the input, and inspect the next <b>IGNORE</b> Delete the current line from the input, and inspect the next
input line. input line.
<b>INFO</b> <i>optional text...</i> <b>INFO</b> <i>optional text...</i>
Log an "info:" record with the <i>optional text...</i> (or log a Log an "info:" record with the <i>optional text...</i> (or log a
generic text), and inspect the next input line. This action is generic text), and inspect the next input line. This action is
useful for routine logging or for debugging. useful for routine logging or for debugging.
This feature is available in Postfix 2.8 and later. This feature is available in Postfix 2.8 and later.
<b>PREPEND</b> <i>text...</i> <b>PREPEND</b> <i>text...</i>
Prepend one line with the specified text, and inspect the next Prepend one line with the specified text, and inspect the next
input line. input line.
Notes: Notes:
<b>o</b> The prepended text is output on a separate line, immedi- <b>o</b> The prepended text is output on a separate line, immedi-
ately before the input that triggered the <b>PREPEND</b> action. ately before the input that triggered the <b>PREPEND</b> action.
<b>o</b> The prepended text is not considered part of the input <b>o</b> The prepended text is not considered part of the input
stream: it is not subject to header/body checks or stream: it is not subject to header/body checks or
address rewriting, and it does not affect the way that address rewriting, and it does not affect the way that
Postfix adds missing message headers. Postfix adds missing message headers.
<b>o</b> When prepending text before a message header line, the <b>o</b> When prepending text before a message header line, the
prepended text must begin with a valid message header prepended text must begin with a valid message header
label. label.
<b>o</b> This action cannot be used to prepend multi-line text. <b>o</b> This action cannot be used to prepend multi-line text.
@ -274,13 +292,13 @@ HEADER_CHECKS(5) HEADER_CHECKS(5)
This feature is not supported with <a href="postconf.5.html#milter_header_checks">milter_header_checks</a>. This feature is not supported with <a href="postconf.5.html#milter_header_checks">milter_header_checks</a>.
<b>REDIRECT</b> <i>user@domain</i> <b>REDIRECT</b> <i>user@domain</i>
Write a message redirection request to the queue file, and Write a message redirection request to the queue file, and
inspect the next input line. After the message is queued, it inspect the next input line. After the message is queued, it
will be sent to the specified address instead of the intended will be sent to the specified address instead of the intended
recipient(s). recipient(s).
Note: this action overrides the <b>FILTER</b> action, and affects all Note: this action overrides the <b>FILTER</b> action, and affects all
recipients of the message. If multiple <b>REDIRECT</b> actions fire, recipients of the message. If multiple <b>REDIRECT</b> actions fire,
only the last one is executed. only the last one is executed.
This feature is available in Postfix 2.1 and later. This feature is available in Postfix 2.1 and later.
@ -288,7 +306,7 @@ HEADER_CHECKS(5) HEADER_CHECKS(5)
This feature is not supported with smtp header/body checks. This feature is not supported with smtp header/body checks.
<b>REPLACE</b> <i>text...</i> <b>REPLACE</b> <i>text...</i>
Replace the current line with the specified text, and inspect Replace the current line with the specified text, and inspect
the next input line. the next input line.
This feature is available in Postfix 2.2 and later. The descrip- This feature is available in Postfix 2.2 and later. The descrip-
@ -296,65 +314,65 @@ HEADER_CHECKS(5) HEADER_CHECKS(5)
Notes: Notes:
<b>o</b> When replacing a message header line, the replacement <b>o</b> When replacing a message header line, the replacement
text must begin with a valid header label. text must begin with a valid header label.
<b>o</b> The replaced text remains part of the input stream. <b>o</b> The replaced text remains part of the input stream.
Unlike the result from the <b>PREPEND</b> action, a replaced Unlike the result from the <b>PREPEND</b> action, a replaced
message header may be subject to address rewriting and message header may be subject to address rewriting and
may affect the way that Postfix adds missing message may affect the way that Postfix adds missing message
headers. headers.
<b>REJECT</b> <i>optional text...</i> <b>REJECT</b> <i>optional text...</i>
Reject the entire message. Reply with <i>optional text...</i> when the Reject the entire message. Reply with <i>optional text...</i> when the
optional text is specified, otherwise reply with a generic error optional text is specified, otherwise reply with a generic error
message. message.
Note: this action disables further header or <a href="postconf.5.html#body_checks">body_checks</a> inspec- Note: this action disables further header or <a href="postconf.5.html#body_checks">body_checks</a> inspec-
tion of the current message and affects all recipients. tion of the current message and affects all recipients.
Postfix version 2.3 and later support enhanced status codes. Postfix version 2.3 and later support enhanced status codes.
When no code is specified at the beginning of <i>optional text...</i>, When no code is specified at the beginning of <i>optional text...</i>,
Postfix inserts a default enhanced status code of "5.7.1". Postfix inserts a default enhanced status code of "5.7.1".
This feature is not supported with smtp header/body checks. This feature is not supported with smtp header/body checks.
<b>WARN</b> <i>optional text...</i> <b>WARN</b> <i>optional text...</i>
Log a "warning:" record with the <i>optional text...</i> (or log a Log a "warning:" record with the <i>optional text...</i> (or log a
generic text), and inspect the next input line. This action is generic text), and inspect the next input line. This action is
useful for debugging and for testing a pattern before applying useful for debugging and for testing a pattern before applying
more drastic actions. more drastic actions.
<b>BUGS</b> <b>BUGS</b>
Empty lines never match, because some map types mis-behave when given a Empty lines never match, because some map types mis-behave when given a
zero-length search string. This limitation may be removed for regular zero-length search string. This limitation may be removed for regular
expression tables in a future release. expression tables in a future release.
Many people overlook the main limitations of header and <a href="postconf.5.html#body_checks">body_checks</a> Many people overlook the main limitations of header and <a href="postconf.5.html#body_checks">body_checks</a>
rules. rules.
<b>o</b> These rules operate on one logical message header or one body <b>o</b> These rules operate on one logical message header or one body
line at a time. A decision made for one line is not carried over line at a time. A decision made for one line is not carried over
to the next line. to the next line.
<b>o</b> If text in the message body is encoded (<a href="http://tools.ietf.org/html/rfc2045">RFC 2045</a>) then the rules <b>o</b> If text in the message body is encoded (<a href="http://tools.ietf.org/html/rfc2045">RFC 2045</a>) then the rules
need to be specified for the encoded form. need to be specified for the encoded form.
<b>o</b> Likewise, when message headers are encoded (<a href="http://tools.ietf.org/html/rfc2047">RFC 2047</a>) then the <b>o</b> Likewise, when message headers are encoded (<a href="http://tools.ietf.org/html/rfc2047">RFC 2047</a>) then the
rules need to be specified for the encoded form. rules need to be specified for the encoded form.
Message headers added by the <a href="cleanup.8.html"><b>cleanup</b>(8)</a> daemon itself are excluded from 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-</b> inspection. Examples of such message headers are <b>From:</b>, <b>To:</b>, <b>Message-</b>
<b>ID:</b>, <b>Date:</b>. <b>ID:</b>, <b>Date:</b>.
Message headers deleted by the <a href="cleanup.8.html"><b>cleanup</b>(8)</a> daemon will be examined Message headers deleted by the <a href="cleanup.8.html"><b>cleanup</b>(8)</a> daemon will be examined
before they are deleted. Examples are: <b>Bcc:</b>, <b>Content-Length:</b>, <b>Return-</b> before they are deleted. Examples are: <b>Bcc:</b>, <b>Content-Length:</b>, <b>Return-</b>
<b>Path:</b>. <b>Path:</b>.
<b>CONFIGURATION PARAMETERS</b> <b>CONFIGURATION PARAMETERS</b>
<b><a href="postconf.5.html#body_checks">body_checks</a></b> <b><a href="postconf.5.html#body_checks">body_checks</a></b>
Lookup tables with content filter rules for message body lines. Lookup tables with content filter rules for message body lines.
These filters see one physical line at a time, in chunks of at These filters see one physical line at a time, in chunks of at
most <b>$<a href="postconf.5.html#line_length_limit">line_length_limit</a></b> bytes. most <b>$<a href="postconf.5.html#line_length_limit">line_length_limit</a></b> bytes.
<b><a href="postconf.5.html#body_checks_size_limit">body_checks_size_limit</a></b> <b><a href="postconf.5.html#body_checks_size_limit">body_checks_size_limit</a></b>
@ -366,31 +384,31 @@ HEADER_CHECKS(5) HEADER_CHECKS(5)
<b><a href="postconf.5.html#mime_header_checks">mime_header_checks</a></b> (default: <b>$<a href="postconf.5.html#header_checks">header_checks</a></b>) <b><a href="postconf.5.html#mime_header_checks">mime_header_checks</a></b> (default: <b>$<a href="postconf.5.html#header_checks">header_checks</a></b>)
<b><a href="postconf.5.html#nested_header_checks">nested_header_checks</a></b> (default: <b>$<a href="postconf.5.html#header_checks">header_checks</a></b>) <b><a href="postconf.5.html#nested_header_checks">nested_header_checks</a></b> (default: <b>$<a href="postconf.5.html#header_checks">header_checks</a></b>)
Lookup tables with content filter rules for message header Lookup tables with content filter rules for message header
lines: respectively, these are applied to the initial message lines: respectively, these are applied to the initial message
headers (not including MIME headers), to the MIME headers any- headers (not including MIME headers), to the MIME headers any-
where in the message, and to the initial headers of attached where in the message, and to the initial headers of attached
messages. messages.
Note: these filters see one logical message header at a time, Note: these filters see one logical message header at a time,
even when a message header spans multiple lines. Message headers even when a message header spans multiple lines. Message headers
that are longer than <b>$<a href="postconf.5.html#header_size_limit">header_size_limit</a></b> characters are trun- that are longer than <b>$<a href="postconf.5.html#header_size_limit">header_size_limit</a></b> characters are trun-
cated. cated.
<b><a href="postconf.5.html#disable_mime_input_processing">disable_mime_input_processing</a></b> <b><a href="postconf.5.html#disable_mime_input_processing">disable_mime_input_processing</a></b>
While receiving mail, give no special treatment to MIME related While receiving mail, give no special treatment to MIME related
message headers; all text after the initial message headers is message headers; all text after the initial message headers is
considered to be part of the message body. This means that considered to be part of the message body. This means that
<b><a href="postconf.5.html#header_checks">header_checks</a></b> is applied to all the initial message headers, and <b><a href="postconf.5.html#header_checks">header_checks</a></b> is applied to all the initial message headers, and
that <b><a href="postconf.5.html#body_checks">body_checks</a></b> is applied to the remainder of the message. that <b><a href="postconf.5.html#body_checks">body_checks</a></b> is applied to the remainder of the message.
Note: when used in this manner, <b><a href="postconf.5.html#body_checks">body_checks</a></b> will process a Note: when used in this manner, <b><a href="postconf.5.html#body_checks">body_checks</a></b> will process a
multi-line message header one line at a time. multi-line message header one line at a time.
<b>EXAMPLES</b> <b>EXAMPLES</b>
Header pattern to block attachments with bad file name extensions. For Header pattern to block attachments with bad file name extensions. For
convenience, the PCRE /x flag is specified, so that there is no need to convenience, the PCRE /x flag is specified, so that there is no need to
collapse the pattern into a single line of text. The purpose of the collapse the pattern into a single line of text. The purpose of the
[[:xdigit:]] sub-expressions is to recognize Windows CLSID strings. [[:xdigit:]] sub-expressions is to recognize Windows CLSID strings.
/etc/postfix/<a href="postconf.5.html">main.cf</a>: /etc/postfix/<a href="postconf.5.html">main.cf</a>:

View File

@ -184,6 +184,23 @@ available for negated patterns.
.fi .fi
Action names are case insensitive. They are shown in upper case Action names are case insensitive. They are shown in upper case
for consistency with other Postfix documentation. for consistency with other Postfix documentation.
.IP "\fBBCC \fIuser@domain\fR"
Add the specified address as a BCC recipient. The address
must have a local part and domain part. The number of BCC
addresses that can be added is limited only by the amount
of available storage space.
Note 1: the BCC address is added as if it was specified with
NOTIFY=NONE. The sender will not be notified when the BCC
address is undeliverable, as long as all down-stream software
implements RFC 3461.
Note 2: this ignores duplicate addresses (with the same
delivery status notification options).
.sp
This feature is available in Postfix 2.12 and later.
.sp
This feature is not supported with smtp header/body checks.
.IP "\fBDISCARD \fIoptional text...\fR" .IP "\fBDISCARD \fIoptional text...\fR"
Claim successful delivery and silently discard the message. Claim successful delivery and silently discard the message.
Log the optional text if specified, otherwise log a generic Log the optional text if specified, otherwise log a generic

View File

@ -162,6 +162,23 @@
# .fi # .fi
# Action names are case insensitive. They are shown in upper case # Action names are case insensitive. They are shown in upper case
# for consistency with other Postfix documentation. # for consistency with other Postfix documentation.
# .IP "\fBBCC \fIuser@domain\fR"
# Add the specified address as a BCC recipient. The address
# must have a local part and domain part. The number of BCC
# addresses that can be added is limited only by the amount
# of available storage space.
#
# Note 1: the BCC address is added as if it was specified with
# NOTIFY=NONE. The sender will not be notified when the BCC
# address is undeliverable, as long as all down-stream software
# implements RFC 3461.
#
# Note 2: this ignores duplicate addresses (with the same
# delivery status notification options).
# .sp
# This feature is available in Postfix 2.12 and later.
# .sp
# This feature is not supported with smtp header/body checks.
# \" .IP "\fBDELAY \fItime\fR" # \" .IP "\fBDELAY \fItime\fR"
# \" Place the message into the deferred queue, and delay the # \" Place the message into the deferred queue, and delay the
# \" initial delivery attempt by \fItime\fR. The time value may # \" initial delivery attempt by \fItime\fR. The time value may

View File

@ -84,7 +84,8 @@ milter_tests: cleanup_milter_test bug_tests \
cleanup_milter_test14g \ cleanup_milter_test14g \
cleanup_milter_test15a cleanup_milter_test15b cleanup_milter_test15c \ cleanup_milter_test15a cleanup_milter_test15b cleanup_milter_test15c \
cleanup_milter_test15d cleanup_milter_test15e cleanup_milter_test15f \ cleanup_milter_test15d cleanup_milter_test15e cleanup_milter_test15f \
cleanup_milter_test15g cleanup_milter_test15h cleanup_milter_test15i cleanup_milter_test15g cleanup_milter_test15h cleanup_milter_test15i \
cleanup_milter_test16a cleanup_milter_test16b
root_tests: root_tests:
@ -355,7 +356,8 @@ cleanup_milter_test13d: cleanup_milter test-queue-file13d cleanup_milter.in13d \
rm -f test-queue-file13d.tmp cleanup_milter.tmp rm -f test-queue-file13d.tmp cleanup_milter.tmp
cleanup_milter_test14a: cleanup_milter test-queue-file14 cleanup_milter.in14a \ cleanup_milter_test14a: cleanup_milter test-queue-file14 cleanup_milter.in14a \
cleanup_milter.ref14a1 ../postcat/postcat cleanup_milter.ref14a2 cleanup_milter.ref14a1 ../postcat/postcat cleanup_milter.ref14a2 \
cleanup_milter.reg14a
cp test-queue-file14 test-queue-file14a.tmp cp test-queue-file14 test-queue-file14a.tmp
chmod u+w test-queue-file14a.tmp chmod u+w test-queue-file14a.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14a 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14a 2>cleanup_milter.tmp1
@ -365,7 +367,8 @@ cleanup_milter_test14a: cleanup_milter test-queue-file14 cleanup_milter.in14a \
rm -f test-queue-file14a.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file14a.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test14b: cleanup_milter test-queue-file14 cleanup_milter.in14b \ cleanup_milter_test14b: cleanup_milter test-queue-file14 cleanup_milter.in14b \
cleanup_milter.ref14b1 ../postcat/postcat cleanup_milter.ref14b2 cleanup_milter.ref14b1 ../postcat/postcat cleanup_milter.ref14b2 \
cleanup_milter.reg14b
cp test-queue-file14 test-queue-file14b.tmp cp test-queue-file14 test-queue-file14b.tmp
chmod u+w test-queue-file14b.tmp chmod u+w test-queue-file14b.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14b 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14b 2>cleanup_milter.tmp1
@ -375,7 +378,8 @@ cleanup_milter_test14b: cleanup_milter test-queue-file14 cleanup_milter.in14b \
rm -f test-queue-file14b.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file14b.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test14c: cleanup_milter test-queue-file14 cleanup_milter.in14c \ cleanup_milter_test14c: cleanup_milter test-queue-file14 cleanup_milter.in14c \
cleanup_milter.ref14c1 ../postcat/postcat cleanup_milter.ref14c2 cleanup_milter.ref14c1 ../postcat/postcat cleanup_milter.ref14c2 \
cleanup_milter.reg14c
cp test-queue-file14 test-queue-file14c.tmp cp test-queue-file14 test-queue-file14c.tmp
chmod u+w test-queue-file14c.tmp chmod u+w test-queue-file14c.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14c 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14c 2>cleanup_milter.tmp1
@ -385,7 +389,8 @@ cleanup_milter_test14c: cleanup_milter test-queue-file14 cleanup_milter.in14c \
rm -f test-queue-file14c.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file14c.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test14d: cleanup_milter test-queue-file14 cleanup_milter.in14d \ cleanup_milter_test14d: cleanup_milter test-queue-file14 cleanup_milter.in14d \
cleanup_milter.ref14d1 ../postcat/postcat cleanup_milter.ref14d2 cleanup_milter.ref14d1 ../postcat/postcat cleanup_milter.ref14d2 \
cleanup_milter.reg14d
cp test-queue-file14 test-queue-file14d.tmp cp test-queue-file14 test-queue-file14d.tmp
chmod u+w test-queue-file14d.tmp chmod u+w test-queue-file14d.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14d 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14d 2>cleanup_milter.tmp1
@ -395,7 +400,8 @@ cleanup_milter_test14d: cleanup_milter test-queue-file14 cleanup_milter.in14d \
rm -f test-queue-file14d.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file14d.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test14e: cleanup_milter test-queue-file14 cleanup_milter.in14e \ cleanup_milter_test14e: cleanup_milter test-queue-file14 cleanup_milter.in14e \
cleanup_milter.ref14e1 ../postcat/postcat cleanup_milter.ref14e2 cleanup_milter.ref14e1 ../postcat/postcat cleanup_milter.ref14e2 \
cleanup_milter.reg14e
cp test-queue-file14 test-queue-file14e.tmp cp test-queue-file14 test-queue-file14e.tmp
chmod u+w test-queue-file14e.tmp chmod u+w test-queue-file14e.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14e 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14e 2>cleanup_milter.tmp1
@ -405,7 +411,8 @@ cleanup_milter_test14e: cleanup_milter test-queue-file14 cleanup_milter.in14e \
rm -f test-queue-file14e.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file14e.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test14f: cleanup_milter test-queue-file14 cleanup_milter.in14f \ cleanup_milter_test14f: cleanup_milter test-queue-file14 cleanup_milter.in14f \
cleanup_milter.ref14f1 ../postcat/postcat cleanup_milter.ref14f2 cleanup_milter.ref14f1 ../postcat/postcat cleanup_milter.ref14f2 \
cleanup_milter.reg14f
cp test-queue-file14 test-queue-file14f.tmp cp test-queue-file14 test-queue-file14f.tmp
chmod u+w test-queue-file14f.tmp chmod u+w test-queue-file14f.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14f 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14f 2>cleanup_milter.tmp1
@ -415,7 +422,8 @@ cleanup_milter_test14f: cleanup_milter test-queue-file14 cleanup_milter.in14f \
rm -f test-queue-file14f.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file14f.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test14g: cleanup_milter test-queue-file14 cleanup_milter.in14g \ cleanup_milter_test14g: cleanup_milter test-queue-file14 cleanup_milter.in14g \
cleanup_milter.ref14g1 ../postcat/postcat cleanup_milter.ref14g2 cleanup_milter.ref14g1 ../postcat/postcat cleanup_milter.ref14g2 \
cleanup_milter.reg14g
cp test-queue-file14 test-queue-file14g.tmp cp test-queue-file14 test-queue-file14g.tmp
chmod u+w test-queue-file14g.tmp chmod u+w test-queue-file14g.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14g 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14g 2>cleanup_milter.tmp1
@ -425,7 +433,8 @@ cleanup_milter_test14g: cleanup_milter test-queue-file14 cleanup_milter.in14g \
rm -f test-queue-file14g.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file14g.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test15a: cleanup_milter test-queue-file15 cleanup_milter.in15a \ cleanup_milter_test15a: cleanup_milter test-queue-file15 cleanup_milter.in15a \
cleanup_milter.ref15a1 ../postcat/postcat cleanup_milter.ref15a2 cleanup_milter.ref15a1 ../postcat/postcat cleanup_milter.ref15a2 \
cleanup_milter.reg15a
cp test-queue-file15 test-queue-file15a.tmp cp test-queue-file15 test-queue-file15a.tmp
chmod u+w test-queue-file15a.tmp chmod u+w test-queue-file15a.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15a 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15a 2>cleanup_milter.tmp1
@ -435,7 +444,8 @@ cleanup_milter_test15a: cleanup_milter test-queue-file15 cleanup_milter.in15a \
rm -f test-queue-file15a.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file15a.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test15b: cleanup_milter test-queue-file15 cleanup_milter.in15b \ cleanup_milter_test15b: cleanup_milter test-queue-file15 cleanup_milter.in15b \
cleanup_milter.ref15b1 ../postcat/postcat cleanup_milter.ref15b2 cleanup_milter.ref15b1 ../postcat/postcat cleanup_milter.ref15b2 \
cleanup_milter.reg15b
cp test-queue-file15 test-queue-file15b.tmp cp test-queue-file15 test-queue-file15b.tmp
chmod u+w test-queue-file15b.tmp chmod u+w test-queue-file15b.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15b 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15b 2>cleanup_milter.tmp1
@ -445,7 +455,8 @@ cleanup_milter_test15b: cleanup_milter test-queue-file15 cleanup_milter.in15b \
rm -f test-queue-file15b.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file15b.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test15c: cleanup_milter test-queue-file15 cleanup_milter.in15c \ cleanup_milter_test15c: cleanup_milter test-queue-file15 cleanup_milter.in15c \
cleanup_milter.ref15c1 ../postcat/postcat cleanup_milter.ref15c2 cleanup_milter.ref15c1 ../postcat/postcat cleanup_milter.ref15c2 \
cleanup_milter.reg15c
cp test-queue-file15 test-queue-file15c.tmp cp test-queue-file15 test-queue-file15c.tmp
chmod u+w test-queue-file15c.tmp chmod u+w test-queue-file15c.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15c 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15c 2>cleanup_milter.tmp1
@ -455,7 +466,8 @@ cleanup_milter_test15c: cleanup_milter test-queue-file15 cleanup_milter.in15c \
rm -f test-queue-file15c.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file15c.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test15d: cleanup_milter test-queue-file15 cleanup_milter.in15d \ cleanup_milter_test15d: cleanup_milter test-queue-file15 cleanup_milter.in15d \
cleanup_milter.ref15d1 ../postcat/postcat cleanup_milter.ref15d2 cleanup_milter.ref15d1 ../postcat/postcat cleanup_milter.ref15d2 \
cleanup_milter.reg15d
cp test-queue-file15 test-queue-file15d.tmp cp test-queue-file15 test-queue-file15d.tmp
chmod u+w test-queue-file15d.tmp chmod u+w test-queue-file15d.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15d 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15d 2>cleanup_milter.tmp1
@ -465,7 +477,8 @@ cleanup_milter_test15d: cleanup_milter test-queue-file15 cleanup_milter.in15d \
rm -f test-queue-file15d.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file15d.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test15e: cleanup_milter test-queue-file15 cleanup_milter.in15e \ cleanup_milter_test15e: cleanup_milter test-queue-file15 cleanup_milter.in15e \
cleanup_milter.ref15e1 ../postcat/postcat cleanup_milter.ref15e2 cleanup_milter.ref15e1 ../postcat/postcat cleanup_milter.ref15e2 \
cleanup_milter.reg15e
cp test-queue-file15 test-queue-file15e.tmp cp test-queue-file15 test-queue-file15e.tmp
chmod u+w test-queue-file15e.tmp chmod u+w test-queue-file15e.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15e 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15e 2>cleanup_milter.tmp1
@ -475,7 +488,8 @@ cleanup_milter_test15e: cleanup_milter test-queue-file15 cleanup_milter.in15e \
rm -f test-queue-file15e.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file15e.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test15f: cleanup_milter test-queue-file15 cleanup_milter.in15f \ cleanup_milter_test15f: cleanup_milter test-queue-file15 cleanup_milter.in15f \
cleanup_milter.ref15f1 ../postcat/postcat cleanup_milter.ref15f2 cleanup_milter.ref15f1 ../postcat/postcat cleanup_milter.ref15f2 \
cleanup_milter.reg15f
cp test-queue-file15 test-queue-file15f.tmp cp test-queue-file15 test-queue-file15f.tmp
chmod u+w test-queue-file15f.tmp chmod u+w test-queue-file15f.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15f 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15f 2>cleanup_milter.tmp1
@ -485,7 +499,8 @@ cleanup_milter_test15f: cleanup_milter test-queue-file15 cleanup_milter.in15f \
rm -f test-queue-file15f.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file15f.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test15g: cleanup_milter test-queue-file15 cleanup_milter.in15g \ cleanup_milter_test15g: cleanup_milter test-queue-file15 cleanup_milter.in15g \
cleanup_milter.ref15g1 ../postcat/postcat cleanup_milter.ref15g2 cleanup_milter.ref15g1 ../postcat/postcat cleanup_milter.ref15g2 \
cleanup_milter.reg15g
cp test-queue-file15 test-queue-file15g.tmp cp test-queue-file15 test-queue-file15g.tmp
chmod u+w test-queue-file15g.tmp chmod u+w test-queue-file15g.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15g 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15g 2>cleanup_milter.tmp1
@ -495,7 +510,8 @@ cleanup_milter_test15g: cleanup_milter test-queue-file15 cleanup_milter.in15g \
rm -f test-queue-file15g.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file15g.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test15h: cleanup_milter test-queue-file15 cleanup_milter.in15h \ cleanup_milter_test15h: cleanup_milter test-queue-file15 cleanup_milter.in15h \
cleanup_milter.ref15h1 ../postcat/postcat cleanup_milter.ref15h2 cleanup_milter.ref15h1 ../postcat/postcat cleanup_milter.ref15h2 \
cleanup_milter.reg15h
cp test-queue-file15 test-queue-file15h.tmp cp test-queue-file15 test-queue-file15h.tmp
chmod u+w test-queue-file15h.tmp chmod u+w test-queue-file15h.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15h 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15h 2>cleanup_milter.tmp1
@ -505,7 +521,8 @@ cleanup_milter_test15h: cleanup_milter test-queue-file15 cleanup_milter.in15h \
rm -f test-queue-file15h.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file15h.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test15i: cleanup_milter test-queue-file15 cleanup_milter.in15i \ cleanup_milter_test15i: cleanup_milter test-queue-file15 cleanup_milter.in15i \
cleanup_milter.ref15i1 ../postcat/postcat cleanup_milter.ref15i2 cleanup_milter.ref15i1 ../postcat/postcat cleanup_milter.ref15i2 \
cleanup_milter.reg15i
cp test-queue-file15 test-queue-file15i.tmp cp test-queue-file15 test-queue-file15i.tmp
chmod u+w test-queue-file15i.tmp chmod u+w test-queue-file15i.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15i 2>cleanup_milter.tmp1 $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15i 2>cleanup_milter.tmp1
@ -514,6 +531,26 @@ cleanup_milter_test15i: cleanup_milter test-queue-file15 cleanup_milter.in15i \
diff cleanup_milter.ref15i2 cleanup_milter.tmp2 diff cleanup_milter.ref15i2 cleanup_milter.tmp2
rm -f test-queue-file15i.tmp cleanup_milter.tmp1 cleanup_milter.tmp2 rm -f test-queue-file15i.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test16a: cleanup_milter test-queue-file16 cleanup_milter.in16a \
cleanup_milter.ref16a1 ../postcat/postcat cleanup_milter.ref16a2
cp test-queue-file16 test-queue-file16a.tmp
chmod u+w test-queue-file16a.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in16a 2>cleanup_milter.tmp1
diff cleanup_milter.ref16a1 cleanup_milter.tmp1
$(SHLIB_ENV) ../postcat/postcat -ov test-queue-file16a.tmp 2>/dev/null >cleanup_milter.tmp2
diff cleanup_milter.ref16a2 cleanup_milter.tmp2
rm -f test-queue-file16a.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
cleanup_milter_test16b: cleanup_milter test-queue-file16 cleanup_milter.in16b \
cleanup_milter.ref16b1 ../postcat/postcat cleanup_milter.ref16b2
cp test-queue-file16 test-queue-file16b.tmp
chmod u+w test-queue-file16b.tmp
$(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in16b 2>cleanup_milter.tmp1
diff cleanup_milter.ref16b1 cleanup_milter.tmp1
$(SHLIB_ENV) ../postcat/postcat -ov test-queue-file16b.tmp 2>/dev/null >cleanup_milter.tmp2
diff cleanup_milter.ref16b2 cleanup_milter.tmp2
rm -f test-queue-file16b.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
depend: $(MAKES) depend: $(MAKES)
(sed '1,/^# do not edit/!d' Makefile.in; \ (sed '1,/^# do not edit/!d' Makefile.in; \
set -e; for i in [a-z][a-z0-9]*.c; do \ set -e; for i in [a-z][a-z0-9]*.c; do \

View File

@ -62,6 +62,7 @@ typedef struct CLEANUP_STATE {
char *return_receipt; /* return-receipt address */ char *return_receipt; /* return-receipt address */
char *errors_to; /* errors-to address */ char *errors_to; /* errors-to address */
ARGV *auto_hdrs; /* MTA's own header(s) */ ARGV *auto_hdrs; /* MTA's own header(s) */
ARGV *hbc_rcpt; /* header/body checks BCC addresses */
int flags; /* processing options, status flags */ int flags; /* processing options, status flags */
int qmgr_opts; /* qmgr processing options */ int qmgr_opts; /* qmgr processing options */
int errs; /* any badness experienced */ int errs; /* any badness experienced */
@ -115,7 +116,6 @@ typedef struct CLEANUP_STATE {
VSTRING *milter_err_text; /* milter call-back reply */ VSTRING *milter_err_text; /* milter call-back reply */
HBC_CHECKS *milter_hbc_checks; /* Milter header checks */ HBC_CHECKS *milter_hbc_checks; /* Milter header checks */
VSTRING *milter_hbc_reply; /* Milter header checks reply */ VSTRING *milter_hbc_reply; /* Milter header checks reply */
VSTRING *milter_orcpt_buf; /* add_rcpt_par() orcpt */
/* /*
* Support for Milter body replacement requests. * Support for Milter body replacement requests.

View File

@ -306,6 +306,21 @@ void cleanup_extracted_finish(CLEANUP_STATE *state)
&& state->recip != 0 && *var_always_bcc) && state->recip != 0 && *var_always_bcc)
cleanup_addr_bcc(state, var_always_bcc); cleanup_addr_bcc(state, var_always_bcc);
/*
* Flush non-Milter header/body_checks BCC recipients. Clear hbc_rcpt
* so that it can be used for other purposes.
*/
if (state->hbc_rcpt) {
if (CLEANUP_OUT_OK(state) && state->recip != 0) {
char **cpp;
for (cpp = state->hbc_rcpt->argv; *cpp; cpp++)
cleanup_addr_bcc(state, *cpp);
}
argv_free(state->hbc_rcpt);
state->hbc_rcpt = 0;
}
/* /*
* Terminate the extracted segment. * Terminate the extracted segment.
*/ */

View File

@ -425,6 +425,19 @@ static const char *cleanup_act(CLEANUP_STATE *state, char *context,
} }
return (buf); return (buf);
} }
if (STREQUAL(value, "BCC", command_len)) {
if (strchr(optional_text, '@') == 0) {
msg_warn("bad BCC address \"%s\" in %s map -- "
"need user@domain",
optional_text, map_class);
} else {
if (state->hbc_rcpt == 0)
state->hbc_rcpt = argv_alloc(1);
argv_add(state->hbc_rcpt, optional_text, (char *) 0);
cleanup_act_log(state, "bcc", context, buf, optional_text);
}
return (buf);
}
/* Allow and ignore optional text after the action. */ /* Allow and ignore optional text after the action. */
if (STREQUAL(value, "IGNORE", command_len)) if (STREQUAL(value, "IGNORE", command_len))

View File

@ -216,6 +216,7 @@
/*#define msg_verbose 2*/ /*#define msg_verbose 2*/
static void cleanup_milter_set_error(CLEANUP_STATE *, int); static void cleanup_milter_set_error(CLEANUP_STATE *, int);
static const char *cleanup_add_rcpt_par(void *, const char *, const char *);
#define STR(x) vstring_str(x) #define STR(x) vstring_str(x)
#define LEN(x) VSTRING_LEN(x) #define LEN(x) VSTRING_LEN(x)
@ -301,6 +302,18 @@ static char *cleanup_milter_hbc_extend(void *context, const char *command,
if ((state->flags & CLEANUP_FLAG_FILTER_ALL) == 0) if ((state->flags & CLEANUP_FLAG_FILTER_ALL) == 0)
return ((char *) buf); return ((char *) buf);
if (STREQUAL(command, "BCC", cmd_len)) {
if (strchr(optional_text, '@') == 0) {
msg_warn("bad BCC address \"%s\" in %s map -- "
"need user@domain",
optional_text, VAR_MILT_HEAD_CHECKS);
} else {
cleanup_milter_hbc_log(context, "bcc", where, buf, optional_text);
/* Caller checks state error flags. */
(void) cleanup_add_rcpt_par(state, optional_text, "");
}
return ((char *) buf);
}
if (STREQUAL(command, "REJECT", cmd_len)) { if (STREQUAL(command, "REJECT", cmd_len)) {
const CLEANUP_STAT_DETAIL *detail; const CLEANUP_STAT_DETAIL *detail;
@ -616,14 +629,22 @@ static const char *cleanup_add_header(void *context, const char *name,
/* /*
* Return early when Milter header checks request that this header record * Return early when Milter header checks request that this header record
* be dropped. * be dropped, or that the message is discarded. Note: CLEANUP_OUT_OK()
* tests CLEANUP_FLAG_DISCARD. We don't want to report the latter as an
* error.
*/ */
buf = vstring_alloc(100); buf = vstring_alloc(100);
vstring_sprintf(buf, "%s:%s%s", name, space, value); vstring_sprintf(buf, "%s:%s%s", name, space, value);
if (state->milter_hbc_checks if (state->milter_hbc_checks) {
&& cleanup_milter_header_checks(state, buf) == 0) { if (cleanup_milter_header_checks(state, buf) == 0
vstring_free(buf); || (state->flags & CLEANUP_FLAG_DISCARD)) {
return (0); vstring_free(buf);
return (0);
}
if (CLEANUP_OUT_OK(state) == 0) {
vstring_free(buf);
return (cleanup_milter_error(state, 0));
}
} }
/* /*
@ -1394,7 +1415,7 @@ static const char *cleanup_chg_from(void *context, const char *ext_from,
static const char *cleanup_add_rcpt_par(void *context, const char *ext_rcpt, static const char *cleanup_add_rcpt_par(void *context, const char *ext_rcpt,
const char *esmtp_args) const char *esmtp_args)
{ {
const char *myname = "cleanup_add_rcpt"; const char *myname = "cleanup_add_rcpt_par";
CLEANUP_STATE *state = (CLEANUP_STATE *) context; CLEANUP_STATE *state = (CLEANUP_STATE *) context;
off_t new_rcpt_offset; off_t new_rcpt_offset;
off_t reverse_ptr_offset; off_t reverse_ptr_offset;
@ -1402,6 +1423,7 @@ static const char *cleanup_add_rcpt_par(void *context, const char *ext_rcpt,
TOK822 *tree; TOK822 *tree;
TOK822 *tp; TOK822 *tp;
VSTRING *int_rcpt_buf; VSTRING *int_rcpt_buf;
VSTRING *orcpt_buf = 0;
ARGV *esmtp_argv; ARGV *esmtp_argv;
int dsn_notify = 0; int dsn_notify = 0;
const char *dsn_orcpt_info = 0; const char *dsn_orcpt_info = 0;
@ -1410,39 +1432,8 @@ static const char *cleanup_add_rcpt_par(void *context, const char *ext_rcpt,
const char *arg; const char *arg;
const char *arg_val; const char *arg_val;
if (esmtp_args[0]) {
esmtp_argv = argv_split(esmtp_args, " ");
for (i = 0; i < esmtp_argv->argc; ++i) {
arg = esmtp_argv->argv[i];
if (strncasecmp(arg, "NOTIFY=", 7) == 0) { /* RFC 3461 */
if (dsn_notify || (dsn_notify = dsn_notify_mask(arg + 7)) == 0)
msg_warn("%s: Bad NOTIFY parameter from MILTER: \"%.100s\"",
state->queue_id, arg);
} else if (strncasecmp(arg, "ORCPT=", 6) == 0) { /* RFC 3461 */
if (state->milter_orcpt_buf == 0)
state->milter_orcpt_buf = vstring_alloc(100);
if (dsn_orcpt_info
|| (type_len = strcspn(arg_val = arg + 6, ";")) == 0
|| (arg_val)[type_len] != ';'
|| xtext_unquote_append(
vstring_sprintf(state->milter_orcpt_buf,
"%.*s;", (int) type_len,
arg_val),
arg_val + type_len + 1) == 0) {
msg_warn("%s: Bad ORCPT parameter from MILTER: \"%.100s\"",
state->queue_id, arg);
} else {
dsn_orcpt_info = STR(state->milter_orcpt_buf);
}
} else {
msg_warn("%s: ignoring ESMTP argument from MILTER: \"%.100s\"",
state->queue_id, arg);
}
}
argv_free(esmtp_argv);
}
if (msg_verbose) if (msg_verbose)
msg_info("%s: \"%s\"", myname, ext_rcpt); msg_info("%s: \"%s\" \"%s\"", myname, ext_rcpt, esmtp_args);
/* /*
* To simplify implementation, the cleanup server writes a dummy * To simplify implementation, the cleanup server writes a dummy
@ -1471,6 +1462,43 @@ static const char *cleanup_add_rcpt_par(void *context, const char *ext_rcpt,
return (cleanup_milter_error(state, errno)); return (cleanup_milter_error(state, errno));
} }
/*
* Parse ESMTP parameters. XXX UTF8SMTP don't assume ORCPT is xtext.
*/
if (esmtp_args[0]) {
esmtp_argv = argv_split(esmtp_args, " ");
for (i = 0; i < esmtp_argv->argc; ++i) {
arg = esmtp_argv->argv[i];
if (strncasecmp(arg, "NOTIFY=", 7) == 0) { /* RFC 3461 */
if (dsn_notify || (dsn_notify = dsn_notify_mask(arg + 7)) == 0)
msg_warn("%s: Bad NOTIFY parameter from Milter or "
"header/body_checks: \"%.100s\"",
state->queue_id, arg);
} else if (strncasecmp(arg, "ORCPT=", 6) == 0) { /* RFC 3461 */
if (orcpt_buf == 0)
orcpt_buf = vstring_alloc(100);
if (dsn_orcpt_info
|| (type_len = strcspn(arg_val = arg + 6, ";")) == 0
|| (arg_val)[type_len] != ';'
|| xtext_unquote_append(vstring_sprintf(orcpt_buf,
"%.*s;", (int) type_len,
arg_val),
arg_val + type_len + 1) == 0) {
msg_warn("%s: Bad ORCPT parameter from Milter or "
"header/body_checks: \"%.100s\"",
state->queue_id, arg);
} else {
dsn_orcpt_info = STR(orcpt_buf);
}
} else {
msg_warn("%s: ignoring ESMTP argument from Milter or "
"header/body_checks: \"%.100s\"",
state->queue_id, arg);
}
}
argv_free(esmtp_argv);
}
/* /*
* Transform recipient from external form to internal form. This also * Transform recipient from external form to internal form. This also
* removes the enclosing <>, if present. * removes the enclosing <>, if present.
@ -1485,21 +1513,35 @@ static const char *cleanup_add_rcpt_par(void *context, const char *ext_rcpt,
tok822_internalize(int_rcpt_buf, tp->head, TOK822_STR_DEFL); tok822_internalize(int_rcpt_buf, tp->head, TOK822_STR_DEFL);
addr_count += 1; addr_count += 1;
} else { } else {
msg_warn("%s: Milter request to add multi-recipient: \"%s\"", msg_warn("%s: Milter or header/body_checks request to "
"add multi-recipient: \"%s\"",
state->queue_id, ext_rcpt); state->queue_id, ext_rcpt);
break; break;
} }
} }
} }
tok822_free_tree(tree); tok822_free_tree(tree);
cleanup_addr_bcc_dsn(state, STR(int_rcpt_buf), dsn_orcpt_info, if (addr_count != 0)
dsn_notify ? dsn_notify : DEF_DSN_NOTIFY); cleanup_addr_bcc_dsn(state, STR(int_rcpt_buf), dsn_orcpt_info,
vstring_free(int_rcpt_buf); dsn_notify ? dsn_notify : DEF_DSN_NOTIFY);
if (addr_count == 0) { else
msg_warn("%s: ignoring attempt from Milter to add null recipient", msg_warn("%s: ignoring attempt from Milter to add null recipient",
state->queue_id); state->queue_id);
vstring_free(int_rcpt_buf);
if (orcpt_buf)
vstring_free(orcpt_buf);
/*
* Don't update the queue file when we did not write a recipient record
* (malformed or duplicate BCC recipient).
*/
if (vstream_ftell(state->dst) == new_rcpt_offset)
return (CLEANUP_OUT_OK(state) ? 0 : cleanup_milter_error(state, 0)); return (CLEANUP_OUT_OK(state) ? 0 : cleanup_milter_error(state, 0));
}
/*
* Follow the recipient with a "reverse" pointer to the old recipient
* append target.
*/
if ((reverse_ptr_offset = vstream_ftell(state->dst)) < 0) { if ((reverse_ptr_offset = vstream_ftell(state->dst)) < 0) {
msg_warn("%s: vstream_ftell file %s: %m", myname, cleanup_path); msg_warn("%s: vstream_ftell file %s: %m", myname, cleanup_path);
return (cleanup_milter_error(state, errno)); return (cleanup_milter_error(state, errno));
@ -2431,7 +2473,6 @@ int main(int unused_argc, char **argv)
msg_info("ignoring: %s %s %s", argv->argv[0], msg_info("ignoring: %s %s %s", argv->argv[0],
argv->argc > 1 ? argv->argv[1] : "", argv->argc > 1 ? argv->argv[1] : "",
argv->argc > 2 ? argv->argv[2] : ""); argv->argc > 2 ? argv->argv[2] : "");
continue;
} else if (strcmp(argv->argv[0], "add_header") == 0) { } else if (strcmp(argv->argv[0], "add_header") == 0) {
if (argv->argc < 2) { if (argv->argc < 2) {
msg_warn("bad add_header argument count: %d", argv->argc); msg_warn("bad add_header argument count: %d", argv->argc);
@ -2533,6 +2574,8 @@ int main(int unused_argc, char **argv)
msg_info("errs = %s", cleanup_strerror(state->errs)); msg_info("errs = %s", cleanup_strerror(state->errs));
} }
cleanup_state_free(state); cleanup_state_free(state);
if (*var_milt_head_checks)
myfree(var_milt_head_checks);
return (0); return (0);
} }

View File

@ -0,0 +1,10 @@
#verbose on
open test-queue-file16a.tmp
# Test the BCC action in milter_header_checks.
header_checks regexp:cleanup_milter.reg16a
add_header X-SPAM-FLAG NO
add_header X-SPAM-FLAG YES
close

View File

@ -0,0 +1,12 @@
#verbose on
open test-queue-file16b.tmp
# Test the add_rcpt_par action
add_rcpt_par foo@example.com notify=never
add_rcpt_par foo@example.com notify=never
add_rcpt bar@example.com
add_rcpt_par bar@example.com orcpt=rfc822;orig-bar@example.com
add_rcpt_par bar@example.com notify=delay
close

View File

@ -0,0 +1,3 @@
./cleanup_milter: NOQUEUE: milter-header-bcc: header X-SPAM-FLAG: NO from client_name[client_addr]; from=<sender> to=<recipient>: bar@example.com
./cleanup_milter: NOQUEUE: milter-header-bcc: header X-SPAM-FLAG: YES from client_name[client_addr]; from=<sender> to=<recipient>: foo@example.com
./cleanup_milter: flags = enable_header_body_filter enable_milters

View File

@ -0,0 +1,37 @@
*** ENVELOPE RECORDS test-queue-file16a.tmp ***
0 message_size: 343 215 1 0 343 0
97 message_arrival_time: Tue Nov 18 16:43:29 2014
116 create_time: Tue Nov 18 16:43:29 2014
140 named_attribute: rewrite_context=local
163 sender_fullname: Wietse Venema
178 sender: user@example.com
196 pointer_record: 654
654 original_recipient: bar@example.com
671 recipient: bar@example.com
688 pointer_record: 739
739 original_recipient: foo@example.com
756 recipient: foo@example.com
773 pointer_record: 213
213 *** MESSAGE CONTENTS test-queue-file16a.tmp ***
215 regular_text: Received: by host.example.com (Postfix, from userid 1001)
274 regular_text: id 663E22172797; Tue, 18 Nov 2014 16:43:29 -0500 (EST)
331 regular_text: To: user@example.com
353 regular_text: Subject: test
368 padding: 0
371 regular_text: Message-Id: <20141118214329.663E22172797@host.example.com>
431 regular_text: Date: Tue, 18 Nov 2014 16:43:29 -0500 (EST)
476 regular_text: From: user@example.com (Wietse Venema)
516 pointer_record: 705
705 regular_text: X-SPAM-FLAG: NO
722 pointer_record: 790
790 regular_text: X-SPAM-FLAG: YES
808 pointer_record: 533
533 regular_text:
535 regular_text: test
541 pointer_record: 0
558 *** HEADER EXTRACTED test-queue-file16a.tmp ***
560 pointer_record: 0
577 named_attribute: dsn_orig_rcpt=rfc822;user@example.com
616 original_recipient: user@example.com
634 recipient: user@example.com
652 *** MESSAGE FILE END test-queue-file16a.tmp ***

View File

@ -0,0 +1 @@
./cleanup_milter: flags = enable_header_body_filter enable_milters

View File

@ -0,0 +1,42 @@
*** ENVELOPE RECORDS test-queue-file16b.tmp ***
0 message_size: 343 215 1 0 343 0
97 message_arrival_time: Tue Nov 18 16:43:29 2014
116 create_time: Tue Nov 18 16:43:29 2014
140 named_attribute: rewrite_context=local
163 sender_fullname: Wietse Venema
178 sender: user@example.com
196 pointer_record: 654
654 named_attribute: notify_flags=1
670 original_recipient: foo@example.com
687 recipient: foo@example.com
704 pointer_record: 721
721 original_recipient: bar@example.com
738 recipient: bar@example.com
755 pointer_record: 772
772 named_attribute: dsn_orig_rcpt=rfc822;orig-bar@example.com
815 original_recipient: bar@example.com
832 recipient: bar@example.com
849 pointer_record: 866
866 named_attribute: notify_flags=8
882 original_recipient: bar@example.com
899 recipient: bar@example.com
916 pointer_record: 213
213 *** MESSAGE CONTENTS test-queue-file16b.tmp ***
215 regular_text: Received: by host.example.com (Postfix, from userid 1001)
274 regular_text: id 663E22172797; Tue, 18 Nov 2014 16:43:29 -0500 (EST)
331 regular_text: To: user@example.com
353 regular_text: Subject: test
368 padding: 0
371 regular_text: Message-Id: <20141118214329.663E22172797@host.example.com>
431 regular_text: Date: Tue, 18 Nov 2014 16:43:29 -0500 (EST)
476 regular_text: From: user@example.com (Wietse Venema)
516 pointer_record: 0
533 regular_text:
535 regular_text: test
541 pointer_record: 0
558 *** HEADER EXTRACTED test-queue-file16b.tmp ***
560 pointer_record: 0
577 named_attribute: dsn_orig_rcpt=rfc822;user@example.com
616 original_recipient: user@example.com
634 recipient: user@example.com
652 *** MESSAGE FILE END test-queue-file16b.tmp ***

View File

@ -0,0 +1,2 @@
/YES/ bcc foo@example.com
/NO/ bcc bar@example.com

View File

@ -79,6 +79,7 @@ CLEANUP_STATE *cleanup_state_alloc(VSTREAM *src)
state->return_receipt = 0; state->return_receipt = 0;
state->errors_to = 0; state->errors_to = 0;
state->auto_hdrs = argv_alloc(1); state->auto_hdrs = argv_alloc(1);
state->hbc_rcpt = 0;
state->flags = 0; state->flags = 0;
state->qmgr_opts = 0; state->qmgr_opts = 0;
state->errs = 0; state->errs = 0;
@ -102,7 +103,6 @@ CLEANUP_STATE *cleanup_state_alloc(VSTREAM *src)
state->append_meta_pt_target = -1; state->append_meta_pt_target = -1;
state->milter_hbc_checks = 0; state->milter_hbc_checks = 0;
state->milter_hbc_reply = 0; state->milter_hbc_reply = 0;
state->milter_orcpt_buf = 0;
state->rcpt_count = 0; state->rcpt_count = 0;
state->reason = 0; state->reason = 0;
state->smtp_reply = 0; state->smtp_reply = 0;
@ -154,6 +154,8 @@ void cleanup_state_free(CLEANUP_STATE *state)
if (state->errors_to) if (state->errors_to)
myfree(state->errors_to); myfree(state->errors_to);
argv_free(state->auto_hdrs); argv_free(state->auto_hdrs);
if (state->hbc_rcpt)
argv_free(state->hbc_rcpt);
if (state->queue_name) if (state->queue_name)
myfree(state->queue_name); myfree(state->queue_name);
if (state->queue_id) if (state->queue_id)
@ -163,8 +165,6 @@ void cleanup_state_free(CLEANUP_STATE *state)
myfree(state->reason); myfree(state->reason);
if (state->smtp_reply) if (state->smtp_reply)
myfree(state->smtp_reply); myfree(state->smtp_reply);
if (state->milter_orcpt_buf)
vstring_free(state->milter_orcpt_buf);
nvtable_free(state->attr); nvtable_free(state->attr);
if (state->mime_state) if (state->mime_state)
mime_state_free(state->mime_state); mime_state_free(state->mime_state);

Binary file not shown.

View File

@ -16,8 +16,6 @@
*/ */
extern void attr_override(char *, const char *, const char *,...); extern void attr_override(char *, const char *, const char *,...);
typedef const char *CONST_CHAR_STAR;
typedef struct { typedef struct {
const char *name; const char *name;
CONST_CHAR_STAR *target; CONST_CHAR_STAR *target;

View File

@ -20,7 +20,7 @@
* Patches change both the patchlevel and the release date. Snapshots have no * Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only. * patchlevel; they change the release date only.
*/ */
#define MAIL_RELEASE_DATE "20141118" #define MAIL_RELEASE_DATE "20141119"
#define MAIL_VERSION_NUMBER "2.12" #define MAIL_VERSION_NUMBER "2.12"
#ifdef SNAPSHOT #ifdef SNAPSHOT

View File

@ -201,55 +201,25 @@ VSTRING *base64_decode_opt(VSTRING *result, const char *in, ssize_t len,
#define STR(x) vstring_str(x) #define STR(x) vstring_str(x)
#define LEN(x) VSTRING_LEN(x) #define LEN(x) VSTRING_LEN(x)
#define TESXT "this is a test!"
int main(int unused_argc, char **unused_argv) int main(int unused_argc, char **unused_argv)
{ {
VSTRING *b1 = vstring_alloc(1); VSTRING *b1 = vstring_alloc(1);
VSTRING *b2 = vstring_alloc(1); VSTRING *b2 = vstring_alloc(1);
char *test = TESXT; char test[256];
char *test2 = TESXT TESXT; int n;
#define DECODE(b,x,l) { \ for (n = 0; n < sizeof(test); n++)
if (base64_decode((b),(x),(l)) == 0) \ test[n] = n;
msg_panic("bad base64: %s", (x)); \ base64_encode(b1, test, sizeof(test));
} if (base64_decode(b2, STR(b1), LEN(b1)) == 0)
#define VERIFY(b,t) { \ msg_panic("bad base64: %s", STR(b1));
if (strcmp((b), (t)) != 0) \ if (LEN(b2) != sizeof(test))
msg_panic("bad test: %s", (b)); \ msg_panic("bad decode length: %ld != %ld",
} (long) LEN(b2), (long) sizeof(test));
for (n = 0; n < sizeof(test); n++)
base64_encode(b1, test, strlen(test)); if (STR(b2)[n] != test[n])
DECODE(b2, STR(b1), LEN(b1)); msg_panic("bad decode value %d != %d",
VERIFY(STR(b2), test); (unsigned char) STR(b2)[n], (unsigned char) test[n]);
base64_encode(b1, test, strlen(test));
base64_encode(b2, STR(b1), LEN(b1));
base64_encode(b1, STR(b2), LEN(b2));
DECODE(b2, STR(b1), LEN(b1));
DECODE(b1, STR(b2), LEN(b2));
DECODE(b2, STR(b1), LEN(b1));
VERIFY(STR(b2), test);
base64_encode(b1, test, strlen(test));
base64_encode(b2, STR(b1), LEN(b1));
base64_encode(b1, STR(b2), LEN(b2));
base64_encode(b2, STR(b1), LEN(b1));
base64_encode(b1, STR(b2), LEN(b2));
DECODE(b2, STR(b1), LEN(b1));
DECODE(b1, STR(b2), LEN(b2));
DECODE(b2, STR(b1), LEN(b1));
DECODE(b1, STR(b2), LEN(b2));
DECODE(b2, STR(b1), LEN(b1));
VERIFY(STR(b2), test);
base64_encode(b1, test, strlen(test));
base64_encode_opt(b1, test, strlen(test), BASE64_FLAG_APPEND);
DECODE(b2, STR(b1), LEN(b1));
VERIFY(STR(b2), test2);
vstring_free(b1);
vstring_free(b2);
return (0); return (0);
} }

View File

@ -1693,6 +1693,14 @@ typedef int pid_t;
#define UINT32_SIZE 4 #define UINT32_SIZE 4
#define UINT16_SIZE 2 #define UINT16_SIZE 2
/*
* For the sake of clarity.
*/
#ifndef HAVE_CONST_CHAR_STAR
typedef const char *CONST_CHAR_STAR;
#endif
/* /*
* Safety. On some systems, ctype.h misbehaves with non-ASCII or negative * Safety. On some systems, ctype.h misbehaves with non-ASCII or negative
* characters. More importantly, Postfix uses the ISXXX() macros to ensure * characters. More importantly, Postfix uses the ISXXX() macros to ensure