<b>postmap -q - <a href="pcre_table.5.html">pcre</a>:/etc/postfix/</b><i>filename</i> <<i>inputfile</i>
<b>DESCRIPTION</b>
- This document describes access control on the content of message head-
+ This document describes access control on the content of message head‐
ers and message body lines; it is implemented by the Postfix <a href="cleanup.8.html"><b>cleanup</b>(8)</a>
server before mail is queued. See <a href="access.5.html"><b>access</b>(5)</a> for access control on
remote SMTP client information.
message body line.
Note: message headers are examined one logical header at a time, even
- when a message header spans multiple lines. Body lines are always exam-
+ when a message header spans multiple lines. Body lines are always exam‐
ined one line at a time.
For examples, see the EXAMPLES section at the end of this manual page.
Postfix header or <a href="postconf.5.html#body_checks">body_checks</a> are designed to stop a flood of mail from
worms or viruses; they do not decode attachments, and they do not unzip
- archives. See the documents referenced below in the README FILES sec-
+ archives. See the documents referenced below in the README FILES sec‐
tion if you need more sophisticated content analysis.
<b>FILTERS WHILE RECEIVING MAIL</b>
after the message is received:
<b><a href="postconf.5.html#milter_header_checks">milter_header_checks</a></b> (default: empty)
- These are applied to headers that are added with Milter applica-
+ These are applied to headers that are added with Milter applica‐
tions.
This feature is available in Postfix 2.7 and later.
<b>TABLE FORMAT</b>
This document assumes that header and <a href="postconf.5.html#body_checks">body_checks</a> rules are specified
in the form of Postfix regular expression lookup tables. Usually the
- best performance is obtained with <b>pcre</b> (Perl Compatible Regular Expres-
+ best performance is obtained with <b>pcre</b> (Perl Compatible Regular Expres‐
sion) tables. The <b>regexp</b> (POSIX regular expressions) tables are usually
slower, but more widely available. Use the command "<b>postconf -m</b>" to
find out what lookup table types your Postfix system supports.
or <a href="regexp_table.5.html"><b>regexp_table</b>(5)</a>, respectively.
<b>/</b><i>pattern</i><b>/</b><i>flags action</i>
- When /<i>pattern</i>/ matches the input string, execute the correspond-
+ When /<i>pattern</i>/ matches the input string, execute the correspond‐
ing <i>action</i>. See below for a list of possible actions.
<b>!/</b><i>pattern</i><b>/</b><i>flags action</i>
- When /<i>pattern</i>/ does <b>not</b> match the input string, execute the cor-
+ When /<i>pattern</i>/ does <b>not</b> match the input string, execute the cor‐
responding <i>action</i>.
<b>if /</b><i>pattern</i><b>/</b><i>flags</i>
<b>endif</b> Match the input string against the patterns between <b>if</b> and
- <b>endif</b>, if and only if the same input string also matches /<i>pat-</i>
+ <b>endif</b>, if and only if the same input string also matches /<i>pat‐</i>
<i>tern</i>/. The <b>if</b>..<b>endif</b> can nest.
Note: do not prepend whitespace to patterns inside <b>if</b>..<b>endif</b>.
<b>if !/</b><i>pattern</i><b>/</b><i>flags</i>
<b>endif</b> Match the input string against the patterns between <b>if</b> and
- <b>endif</b>, if and only if the same input string does <b>not</b> match /<i>pat-</i>
+ <b>endif</b>, if and only if the same input string does <b>not</b> match /<i>pat‐</i>
<i>tern</i>/. The <b>if</b>..<b>endif</b> can nest.
blank lines and comments
Claim successful delivery and silently discard the message. Log
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-
- tion of the current message and affects all recipients. To dis-
+ 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‐
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.
This feature is available in Postfix 2.0 and later.
<b>FILTER</b> <i>transport:destination</i>
After the message is queued, send the entire message through the
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-
- ter.cf</a>; the syntax of the next-hop <i>destination</i> is described in
+ the first field of a mail delivery agent definition in mas‐
+ ter.cf; the syntax of the next-hop <i>destination</i> is described in
the manual page of the corresponding delivery agent. More
information about external content filters is in the Postfix
<a href="FILTER_README.html">FILTER_README</a> file.
<i>transport</i> or <i>destination</i> unless you know that the information
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
- 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.
Note 3: the purpose of the FILTER command is to override message
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
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>
- <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.
+ earlier). Other options are using the recipient-dependent <b>trans</b>‐\b‐
+ <b>port_maps</b> or the sender-dependent <b>sender_dependent_default</b>‐\b‐
+ <b>_transport_maps</b> features.
This feature is available in Postfix 2.0 and later.
Notes:
- <b>o</b> The prepended text is output on a separate line, immedi-
+ · The prepended text is output on a separate line, immedi‐
ately before the input that triggered the <b>PREPEND</b> action.
- <b>o</b> The prepended text is not considered part of the input
+ · The prepended text is not considered part of the input
stream: it is not subject to header/body checks or
address rewriting, and it does not affect the way that
Postfix adds missing message headers.
- <b>o</b> When prepending text before a message header line, the
+ · When prepending text before a message header line, the
prepended text must begin with a valid message header
label.
- <b>o</b> This action cannot be used to prepend multi-line text.
+ · This action cannot be used to prepend multi-line text.
This feature is available in Postfix 2.1 and later.
Replace the current line with the specified text, and inspect
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‐
tion below applies to Postfix 2.2.2 and later.
Notes:
- <b>o</b> When replacing a message header line, the replacement
+ · When replacing a message header line, the replacement
text must begin with a valid header label.
- <b>o</b> The replaced text remains part of the input stream.
+ · The replaced text remains part of the input stream.
Unlike the result from the <b>PREPEND</b> action, a replaced
message header may be subject to address rewriting and
may affect the way that Postfix adds missing message
optional text is specified, otherwise reply with a generic error
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.
Postfix version 2.3 and later support enhanced status codes.
Many people overlook the main limitations of header and <a href="postconf.5.html#body_checks">body_checks</a>
rules.
- <b>o</b> These rules operate on one logical message header or one body
+ · 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
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
+ · 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.
- <b>o</b> Likewise, when message headers are encoded (<a href="http://tools.ietf.org/html/rfc2047">RFC 2047</a>) then the
+ · 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.
Message headers added by the <a href="cleanup.8.html"><b>cleanup</b>(8)</a> daemon itself are excluded from
<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
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
messages.
Note: these filters see one logical message header at a time,
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.
<b><a href="postconf.5.html#disable_mime_input_processing">disable_mime_input_processing</a></b>
<a href="postconf.5.html#header_checks">header_checks</a> = <a href="pcre_table.5.html">pcre</a>:/etc/postfix/header_checks.pcre
/etc/postfix/header_checks.<a href="pcre_table.5.html">pcre</a>:
- /^Content-(Disposition|Type).*name\s*=\s*"?(.*(\.|=2E)(
+ /^Content-(Disposition|Type).*name\s*=\s*"?([^;]*(\.|=2E)(
ade|adp|asp|bas|bat|chm|cmd|com|cpl|crt|dll|exe|
hlp|ht[at]|
inf|ins|isp|jse?|lnk|md[betw]|ms[cipt]|nws|
/* SYNOPSIS
/* #include <cleanup.h>
/*
-/* void cleanup_addr_sender(state, addr)
+/* off_t cleanup_addr_sender(state, addr)
/* CLEANUP_STATE *state;
/* const char *addr;
/*
/* sender/recipient auto bcc address generation.
/*
/* cleanup_addr_sender() processes sender envelope information and updates
-/* state->sender.
+/* state->sender. The result value is the offset of the record that
+/* follows the sender record if milters are enabled, otherwise zero.
/*
/* cleanup_addr_recipient() processes recipient envelope information
/* and updates state->recip.
/* Global library. */
#include <rec_type.h>
+#include <record.h>
#include <cleanup_user.h>
#include <mail_params.h>
#include <ext_prop.h>
#include "cleanup.h"
#define STR vstring_str
+#define LEN VSTRING_LEN
#define IGNORE_EXTENSION (char **) 0
/* cleanup_addr_sender - process envelope sender record */
-void cleanup_addr_sender(CLEANUP_STATE *state, const char *buf)
+off_t cleanup_addr_sender(CLEANUP_STATE *state, const char *buf)
{
+ const char myname[] = "cleanup_addr_sender";
VSTRING *clean_addr = vstring_alloc(100);
+ off_t after_sender_offs = 0;
const char *bcc;
+ size_t len;
/*
* Note: an unqualified envelope address is for all practical purposes
if (state->sender) /* XXX Can't happen */
myfree(state->sender);
state->sender = mystrdup(STR(clean_addr)); /* Used by Milter client */
+ /* Fix 20160310: Moved from cleanup_envelope.c. */
+ if (state->milters || cleanup_milters) {
+ /* Make room to replace sender. */
+ if ((len = LEN(clean_addr)) < REC_TYPE_PTR_PAYL_SIZE)
+ rec_pad(state->dst, REC_TYPE_PTR, REC_TYPE_PTR_PAYL_SIZE - len);
+ /* Remember the after-sender record offset. */
+ if ((after_sender_offs = vstream_ftell(state->dst)) < 0)
+ msg_fatal("%s: vstream_ftell %s: %m:", myname, cleanup_path);
+ }
if ((state->flags & CLEANUP_FLAG_BCC_OK)
&& *STR(clean_addr)
&& cleanup_send_bcc_maps) {
}
}
vstring_free(clean_addr);
+ return after_sender_offs;
}
/* cleanup_addr_recipient - process envelope recipient */