From: Wietse Venema Date: Fri, 15 May 2015 05:00:00 +0000 (-0500) Subject: postfix-2.11.8 X-Git-Tag: v2.11.8^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ec7e1db463b79852524bd8c7110357e1ee46248;p=thirdparty%2Fpostfix.git postfix-2.11.8 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index cd7b6ac66..14cd86f42 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -19728,3 +19728,25 @@ Apologies for any names omitted. propagate error reports from xtext_unquote_append(), causing the decoder to return partial ouput, instead of rejecting malformed input. Fix by Krzysztof Wojta. File: global/xtext.c. + +20160310 + + Bugfix (introduced: Postfix 2.6): the Milter SMFIR_CHGFROM + (replace sender) request lost the sender_bcc_maps address. + Fixed by moving some record keeping to the sender output + function. Files: cleanup/cleanup_envelope.c, + cleanup/cleanup_addr.c, cleanup/cleanup_milter.c, + cleanup/cleanup.h, regression tests. + +20160410 + + Bugfix (introduced: Postfix 2.6): the "bad filetype" + header_checks pattern falsely rejected Content-Mumble headers + with ``name="example"; x-apple-part-url="example.com"''. + Fixed by respecting the ";" separator between content + attribute values. Reported by Cedric Knight. File: + proto/header_checks. + +20160515 + + Portability: OpenBSD 6.0. Files: makedefs, util/sys_defs.h. diff --git a/postfix/conf/header_checks b/postfix/conf/header_checks index 490e214c7..24b9adf7b 100644 --- a/postfix/conf/header_checks +++ b/postfix/conf/header_checks @@ -445,7 +445,7 @@ # header_checks = pcre:/etc/postfix/header_checks.pcre # # /etc/postfix/header_checks.pcre: -# /^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| diff --git a/postfix/html/header_checks.5.html b/postfix/html/header_checks.5.html index 6f1e86fc5..d5c019cec 100644 --- a/postfix/html/header_checks.5.html +++ b/postfix/html/header_checks.5.html @@ -26,7 +26,7 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) postmap -q - pcre:/etc/postfix/filename <inputfile DESCRIPTION - 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 cleanup(8) server before mail is queued. See access(5) for access control on remote SMTP client information. @@ -37,14 +37,14 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) 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 body_checks 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. FILTERS WHILE RECEIVING MAIL @@ -79,7 +79,7 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) after the message is received: milter_header_checks (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. @@ -105,7 +105,7 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) TABLE FORMAT This document assumes that header and body_checks rules are specified in the form of Postfix regular expression lookup tables. Usually the - best performance is obtained with pcre (Perl Compatible Regular Expres- + best performance is obtained with pcre (Perl Compatible Regular Expres‐ sion) tables. The regexp (POSIX regular expressions) tables are usually slower, but more widely available. Use the command "postconf -m" to find out what lookup table types your Postfix system supports. @@ -115,17 +115,17 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) or regexp_table(5), respectively. /pattern/flags action - When /pattern/ matches the input string, execute the correspond- + When /pattern/ matches the input string, execute the correspond‐ ing action. See below for a list of possible actions. !/pattern/flags action - When /pattern/ does not match the input string, execute the cor- + When /pattern/ does not match the input string, execute the cor‐ responding action. if /pattern/flags endif Match the input string against the patterns between if and - endif, if and only if the same input string also matches /pat- + endif, if and only if the same input string also matches /pat‐ tern/. The if..endif can nest. Note: do not prepend whitespace to patterns inside if..endif. @@ -133,7 +133,7 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) if !/pattern/flags endif Match the input string against the patterns between if and - endif, if and only if the same input string does not match /pat- + endif, if and only if the same input string does not match /pat‐ tern/. The if..endif can nest. blank lines and comments @@ -168,10 +168,10 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) 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 body_checks inspec- - tion of the current message and affects all recipients. To dis- + Note: this action disables further header or body_checks inspec‐ + tion of the current message and affects all recipients. To dis‐ card only one recipient without discarding the entire message, - use the transport(5) table to direct mail to the discard(8) ser- + use the transport(5) table to direct mail to the discard(8) ser‐ vice. This feature is available in Postfix 2.0 and later. @@ -190,8 +190,8 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) FILTER transport:destination After the message is queued, send the entire message through the specified external content filter. The transport name specifies - the first field of a mail delivery agent definition in mas- - ter.cf; the syntax of the next-hop destination is described in + the first field of a mail delivery agent definition in mas‐ + ter.cf; the syntax of the next-hop destination is described in the manual page of the corresponding delivery agent. More information about external content filters is in the Postfix FILTER_README file. @@ -200,19 +200,19 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) transport or destination unless you know that the information has a trusted origin. - Note 2: this action overrides the main.cf content_filter set- + Note 2: this action overrides the main.cf content_filter set‐ ting, and affects all recipients of the message. In the case - that multiple FILTER actions fire, only the last one is exe- + that multiple FILTER 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 transport but not the - next-hop destination, specify an empty filter destination (Post- + next-hop destination, specify an empty filter destination (Post‐ fix 2.7 and later), or specify a transport:destination that delivers through a different Postfix instance (Postfix 2.6 and - earlier). Other options are using the recipient-dependent trans- - port_maps or the sender-dependent sender_dependent_default- - _transport_maps features. + earlier). Other options are using the recipient-dependent trans‐‐ + port_maps or the sender-dependent sender_dependent_default‐‐ + _transport_maps features. This feature is available in Postfix 2.0 and later. @@ -255,19 +255,19 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) Notes: - o 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 PREPEND action. - o 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. - o 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. - o 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. @@ -291,15 +291,15 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) 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: - o When replacing a message header line, the replacement + · When replacing a message header line, the replacement text must begin with a valid header label. - o The replaced text remains part of the input stream. + · The replaced text remains part of the input stream. Unlike the result from the PREPEND action, a replaced message header may be subject to address rewriting and may affect the way that Postfix adds missing message @@ -310,7 +310,7 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) optional text is specified, otherwise reply with a generic error message. - Note: this action disables further header or body_checks inspec- + Note: this action disables further header or body_checks inspec‐ tion of the current message and affects all recipients. Postfix version 2.3 and later support enhanced status codes. @@ -333,14 +333,14 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) Many people overlook the main limitations of header and body_checks rules. - o 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. - o If text in the message body is encoded (RFC 2045) then the rules + · If text in the message body is encoded (RFC 2045) then the rules need to be specified for the encoded form. - o Likewise, when message headers are encoded (RFC 2047) then the + · Likewise, when message headers are encoded (RFC 2047) then the rules need to be specified for the encoded form. Message headers added by the cleanup(8) daemon itself are excluded from @@ -368,13 +368,13 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) nested_header_checks (default: $header_checks) 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 $header_size_limit characters are trun- + that are longer than $header_size_limit characters are trun‐ cated. disable_mime_input_processing @@ -397,7 +397,7 @@ HEADER_CHECKS(5) HEADER_CHECKS(5) header_checks = pcre:/etc/postfix/header_checks.pcre /etc/postfix/header_checks.pcre: - /^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| diff --git a/postfix/html/postscreen.8.html b/postfix/html/postscreen.8.html index 8ef9176a2..617068af5 100644 --- a/postfix/html/postscreen.8.html +++ b/postfix/html/postscreen.8.html @@ -81,10 +81,10 @@ POSTSCREEN(8) POSTSCREEN(8) The optional "after 220 server greeting" tests involve postscreen(8)'s built-in SMTP protocol engine. When these tests succeed, postscreen(8) - adds the client to the temporary whitelist, but it cannot not hand off - the "live" connection to a Postfix SMTP server process in the middle of - a session. Instead, postscreen(8) defers attempts to deliver mail with - a 4XX status, and waits for the client to disconnect. When the client + adds the client to the temporary whitelist, but it cannot hand off the + "live" connection to a Postfix SMTP server process in the middle of a + session. Instead, postscreen(8) defers attempts to deliver mail with a + 4XX status, and waits for the client to disconnect. When the client connects again, postscreen(8) will allow the client to talk to a Post- fix SMTP server process (provided that the whitelist status has not expired). postscreen(8) mitigates the impact of this limitation by diff --git a/postfix/man/man5/header_checks.5 b/postfix/man/man5/header_checks.5 index 6976eb915..2ef1c486f 100644 --- a/postfix/man/man5/header_checks.5 +++ b/postfix/man/man5/header_checks.5 @@ -422,7 +422,7 @@ sub-expressions is to recognize Windows CLSID strings. header_checks = pcre:/etc/postfix/header_checks.pcre /etc/postfix/header_checks.pcre: - /^Content-(Disposition|Type).*name\es*=\es*"?(.*(\e.|=2E)( + /^Content-(Disposition|Type).*name\es*=\es*"?([^;]*(\e.|=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| diff --git a/postfix/man/man8/postscreen.8 b/postfix/man/man8/postscreen.8 index de8bb2401..e8b71e90d 100644 --- a/postfix/man/man8/postscreen.8 +++ b/postfix/man/man8/postscreen.8 @@ -93,7 +93,7 @@ traffic from dial-up and residential networks. The optional "after 220 server greeting" tests involve \fBpostscreen\fR(8)'s built-in SMTP protocol engine. When these tests succeed, \fBpostscreen\fR(8) adds the client -to the temporary whitelist, but it cannot not hand off the +to the temporary whitelist, but it cannot hand off the "live" connection to a Postfix SMTP server process in the middle of a session. Instead, \fBpostscreen\fR(8) defers attempts to deliver mail with a 4XX status, and waits for diff --git a/postfix/proto/Makefile.in b/postfix/proto/Makefile.in index b22e0a958..caf82252c 100644 --- a/postfix/proto/Makefile.in +++ b/postfix/proto/Makefile.in @@ -98,7 +98,7 @@ AWK = awk '{ print; if (NR == 1) print ".pl 9999\n.ll 65" }' SRCTOMAN= ../mantools/srctoman POSTLINK= ../mantools/postlink DETAB = pr -tre -NROFF = GROFF_NO_SGR=1 nroff +NROFF = LANG=C GROFF_NO_SGR=1 nroff HT2READ = ../mantools/html2readme MAKEAAA = ../mantools/makereadme MAKESOHO= ../mantools/make_soho_readme diff --git a/postfix/proto/header_checks b/postfix/proto/header_checks index 015d3a375..2789e3852 100644 --- a/postfix/proto/header_checks +++ b/postfix/proto/header_checks @@ -421,7 +421,7 @@ # header_checks = pcre:/etc/postfix/header_checks.pcre # # /etc/postfix/header_checks.pcre: -# /^Content-(Disposition|Type).*name\es*=\es*"?(.*(\e.|=2E)( +# /^Content-(Disposition|Type).*name\es*=\es*"?([^;]*(\e.|=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| diff --git a/postfix/src/cleanup/cleanup.h b/postfix/src/cleanup/cleanup.h index 10d40abe8..38fe2b2d0 100644 --- a/postfix/src/cleanup/cleanup.h +++ b/postfix/src/cleanup/cleanup.h @@ -284,7 +284,7 @@ extern void cleanup_out_recipient(CLEANUP_STATE *, const char *, int, const char /* * cleanup_addr.c. */ -extern void cleanup_addr_sender(CLEANUP_STATE *, const char *); +extern off_t cleanup_addr_sender(CLEANUP_STATE *, const char *); extern void cleanup_addr_recipient(CLEANUP_STATE *, const char *); extern void cleanup_addr_bcc_dsn(CLEANUP_STATE *, const char *, const char *, int); diff --git a/postfix/src/cleanup/cleanup_addr.c b/postfix/src/cleanup/cleanup_addr.c index f8e0596c4..e1a50e845 100644 --- a/postfix/src/cleanup/cleanup_addr.c +++ b/postfix/src/cleanup/cleanup_addr.c @@ -6,7 +6,7 @@ /* SYNOPSIS /* #include /* -/* void cleanup_addr_sender(state, addr) +/* off_t cleanup_addr_sender(state, addr) /* CLEANUP_STATE *state; /* const char *addr; /* @@ -29,7 +29,8 @@ /* 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. @@ -85,6 +86,7 @@ /* Global library. */ #include +#include #include #include #include @@ -99,14 +101,18 @@ #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 @@ -142,6 +148,15 @@ void cleanup_addr_sender(CLEANUP_STATE *state, const char *buf) 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) { @@ -156,6 +171,7 @@ void cleanup_addr_sender(CLEANUP_STATE *state, const char *buf) } } vstring_free(clean_addr); + return after_sender_offs; } /* cleanup_addr_recipient - process envelope recipient */ diff --git a/postfix/src/cleanup/cleanup_envelope.c b/postfix/src/cleanup/cleanup_envelope.c index 1f5aa51f1..61b312bfe 100644 --- a/postfix/src/cleanup/cleanup_envelope.c +++ b/postfix/src/cleanup/cleanup_envelope.c @@ -370,6 +370,8 @@ static void cleanup_envelope_process(CLEANUP_STATE *state, int type, return; } if (type == REC_TYPE_FROM) { + off_t after_sender_offs; + /* Allow only one instance. */ if (state->sender != 0) { msg_warn("%s: message rejected: multiple envelope sender records", @@ -382,14 +384,10 @@ static void cleanup_envelope_process(CLEANUP_STATE *state, int type, if ((state->sender_pt_offset = vstream_ftell(state->dst)) < 0) msg_fatal("%s: vstream_ftell %s: %m:", myname, cleanup_path); } - cleanup_addr_sender(state, buf); + after_sender_offs = cleanup_addr_sender(state, buf); if (state->milters || cleanup_milters) { - /* Make room to replace sender. */ - if ((len = strlen(state->sender)) < 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 ((state->sender_pt_target = vstream_ftell(state->dst)) < 0) - msg_fatal("%s: vstream_ftell %s: %m:", myname, cleanup_path); + state->sender_pt_target = after_sender_offs; } if (cleanup_milters != 0 && state->milters == 0 diff --git a/postfix/src/cleanup/cleanup_milter.c b/postfix/src/cleanup/cleanup_milter.c index 2894fa011..5b0cc1434 100644 --- a/postfix/src/cleanup/cleanup_milter.c +++ b/postfix/src/cleanup/cleanup_milter.c @@ -1304,6 +1304,7 @@ static const char *cleanup_chg_from(void *context, const char *ext_from, const char *myname = "cleanup_chg_from"; CLEANUP_STATE *state = (CLEANUP_STATE *) context; off_t new_sender_offset; + off_t after_sender_offs; int addr_count; TOK822 *tree; TOK822 *tp; @@ -1367,10 +1368,11 @@ static const char *cleanup_chg_from(void *context, const char *ext_from, } } tok822_free_tree(tree); - cleanup_addr_sender(state, STR(int_sender_buf)); + after_sender_offs = cleanup_addr_sender(state, STR(int_sender_buf)); vstring_free(int_sender_buf); cleanup_out_format(state, REC_TYPE_PTR, REC_TYPE_PTR_FORMAT, (long) state->sender_pt_target); + state->sender_pt_target = after_sender_offs; /* * Overwrite the original sender record with the pointer to the new @@ -2517,6 +2519,19 @@ int main(int unused_argc, char **argv) var_milt_head_checks = mystrdup(argv->argv[1]); cleanup_milter_header_checks_init(state); } + } else if (strcmp(argv->argv[0], "sender_bcc_maps") == 0) { + if (argv->argc != 2) { + msg_warn("bad sender_bcc_maps argument count: %ld", + (long) argv->argc); + } else { + if (cleanup_send_bcc_maps) + maps_free(cleanup_send_bcc_maps); + cleanup_send_bcc_maps = + maps_create("sender_bcc_maps", argv->argv[1], + DICT_FLAG_LOCK | DICT_FLAG_FOLD_FIX); + state->flags |= CLEANUP_FLAG_BCC_OK; + var_rcpt_delim = ""; + } } else { msg_warn("bad command: %s", argv->argv[0]); } diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 8e7e51101..259635485 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20151010" -#define MAIL_VERSION_NUMBER "2.11.7" +#define MAIL_RELEASE_DATE "20150515" +#define MAIL_VERSION_NUMBER "2.11.8" #ifdef SNAPSHOT #define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff --git a/postfix/src/postscreen/postscreen.c b/postfix/src/postscreen/postscreen.c index 5f5e255de..711cad836 100644 --- a/postfix/src/postscreen/postscreen.c +++ b/postfix/src/postscreen/postscreen.c @@ -79,7 +79,7 @@ /* The optional "after 220 server greeting" tests involve /* \fBpostscreen\fR(8)'s built-in SMTP protocol engine. When /* these tests succeed, \fBpostscreen\fR(8) adds the client -/* to the temporary whitelist, but it cannot not hand off the +/* to the temporary whitelist, but it cannot hand off the /* "live" connection to a Postfix SMTP server process in the /* middle of a session. Instead, \fBpostscreen\fR(8) defers /* attempts to deliver mail with a 4XX status, and waits for