Prereq: "2.10.9" diff -cr --new-file /var/tmp/postfix-2.10.9/src/global/mail_version.h ./src/global/mail_version.h *** /var/tmp/postfix-2.10.9/src/global/mail_version.h 2015-10-10 11:35:10.000000000 -0400 --- ./src/global/mail_version.h 2016-05-15 12:58:04.000000000 -0400 *************** *** 20,27 **** * 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.10.9" #ifdef SNAPSHOT # define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE --- 20,27 ---- * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ ! #define MAIL_RELEASE_DATE "20150515" ! #define MAIL_VERSION_NUMBER "2.10.10" #ifdef SNAPSHOT # define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff -cr --new-file /var/tmp/postfix-2.10.9/HISTORY ./HISTORY *** /var/tmp/postfix-2.10.9/HISTORY 2015-10-10 10:43:32.000000000 -0400 --- ./HISTORY 2016-05-15 14:07:11.000000000 -0400 *************** *** 18472,18474 **** --- 18472,18496 ---- adding a header, because the PREPEND action used the same output function for header_checks and body_checks. Viktor Dukhovni and Wietse. File: cleanup/cleanup_message.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 -cr --new-file /var/tmp/postfix-2.10.9/conf/header_checks ./conf/header_checks *** /var/tmp/postfix-2.10.9/conf/header_checks 2012-09-03 12:25:07.000000000 -0400 --- ./conf/header_checks 2016-04-10 18:09:13.000000000 -0400 *************** *** 445,451 **** # header_checks = pcre:/etc/postfix/header_checks.pcre # # /etc/postfix/header_checks.pcre: ! # /^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| --- 445,451 ---- # header_checks = pcre:/etc/postfix/header_checks.pcre # # /etc/postfix/header_checks.pcre: ! # /^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 -cr --new-file /var/tmp/postfix-2.10.9/html/header_checks.5.html ./html/header_checks.5.html *** /var/tmp/postfix-2.10.9/html/header_checks.5.html 2012-09-03 12:25:07.000000000 -0400 --- ./html/header_checks.5.html 2016-04-10 18:09:13.000000000 -0400 *************** *** 394,400 **** are From:, To:, Message-ID:, Date:. Message headers deleted by the cleanup(8) daemon will be ! examined before they are deleted. Examples are: Bcc:, Con- tent-Length:, Return-Path:. CONFIGURATION PARAMETERS --- 394,400 ---- are From:, To:, Message-ID:, Date:. Message headers deleted by the cleanup(8) daemon will be ! examined before they are deleted. Examples are: Bcc:, Con- tent-Length:, Return-Path:. CONFIGURATION PARAMETERS *************** *** 451,457 **** header_checks = pcre:/etc/postfix/header_checks.pcre /etc/postfix/header_checks.pcre: ! /^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| --- 451,457 ---- header_checks = pcre:/etc/postfix/header_checks.pcre /etc/postfix/header_checks.pcre: ! /^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 -cr --new-file /var/tmp/postfix-2.10.9/html/postscreen.8.html ./html/postscreen.8.html *** /var/tmp/postfix-2.10.9/html/postscreen.8.html 2012-11-24 17:48:31.000000000 -0500 --- ./html/postscreen.8.html 2016-04-11 17:22:24.000000000 -0400 *************** *** 88,96 **** 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 tempo- ! rary whitelist, but it cannot not hand off the "live" con- ! nection 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 Postfix --- 88,96 ---- 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 tempo- ! rary whitelist, but it cannot hand off the "live" connec- ! tion 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 Postfix diff -cr --new-file /var/tmp/postfix-2.10.9/man/man5/header_checks.5 ./man/man5/header_checks.5 *** /var/tmp/postfix-2.10.9/man/man5/header_checks.5 2012-09-03 12:25:07.000000000 -0400 --- ./man/man5/header_checks.5 2016-04-10 18:09:13.000000000 -0400 *************** *** 370,376 **** are \fBFrom:\fR, \fBTo:\fR, \fBMessage-ID:\fR, \fBDate:\fR. Message headers deleted by the \fBcleanup\fR(8) daemon will ! be examined before they are deleted. Examples are: \fBBcc:\fr, \fBContent-Length:\fR, \fBReturn-Path:\fR. .SH "CONFIGURATION PARAMETERS" .na --- 370,376 ---- are \fBFrom:\fR, \fBTo:\fR, \fBMessage-ID:\fR, \fBDate:\fR. Message headers deleted by the \fBcleanup\fR(8) daemon will ! be examined before they are deleted. Examples are: \fBBcc:\fR, \fBContent-Length:\fR, \fBReturn-Path:\fR. .SH "CONFIGURATION PARAMETERS" .na *************** *** 422,428 **** header_checks = pcre:/etc/postfix/header_checks.pcre /etc/postfix/header_checks.pcre: ! /^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| --- 422,428 ---- header_checks = pcre:/etc/postfix/header_checks.pcre /etc/postfix/header_checks.pcre: ! /^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 -cr --new-file /var/tmp/postfix-2.10.9/man/man8/postscreen.8 ./man/man8/postscreen.8 *** /var/tmp/postfix-2.10.9/man/man8/postscreen.8 2012-11-24 17:48:31.000000000 -0500 --- ./man/man8/postscreen.8 2016-04-11 17:22:24.000000000 -0400 *************** *** 93,99 **** 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 "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 --- 93,99 ---- 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 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 -cr --new-file /var/tmp/postfix-2.10.9/proto/header_checks ./proto/header_checks *** /var/tmp/postfix-2.10.9/proto/header_checks 2012-09-03 12:25:00.000000000 -0400 --- ./proto/header_checks 2016-04-10 18:09:11.583877000 -0400 *************** *** 373,379 **** # are \fBFrom:\fR, \fBTo:\fR, \fBMessage-ID:\fR, \fBDate:\fR. # # Message headers deleted by the \fBcleanup\fR(8) daemon will ! # be examined before they are deleted. Examples are: \fBBcc:\fr, # \fBContent-Length:\fR, \fBReturn-Path:\fR. # CONFIGURATION PARAMETERS # .ad --- 373,379 ---- # are \fBFrom:\fR, \fBTo:\fR, \fBMessage-ID:\fR, \fBDate:\fR. # # Message headers deleted by the \fBcleanup\fR(8) daemon will ! # be examined before they are deleted. Examples are: \fBBcc:\fR, # \fBContent-Length:\fR, \fBReturn-Path:\fR. # CONFIGURATION PARAMETERS # .ad *************** *** 421,427 **** # header_checks = pcre:/etc/postfix/header_checks.pcre # # /etc/postfix/header_checks.pcre: ! # /^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| --- 421,427 ---- # header_checks = pcre:/etc/postfix/header_checks.pcre # # /etc/postfix/header_checks.pcre: ! # /^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 -cr --new-file /var/tmp/postfix-2.10.9/src/cleanup/cleanup.h ./src/cleanup/cleanup.h *** /var/tmp/postfix-2.10.9/src/cleanup/cleanup.h 2014-10-18 17:40:07.000000000 -0400 --- ./src/cleanup/cleanup.h 2016-04-10 18:16:10.000000000 -0400 *************** *** 283,289 **** /* * cleanup_addr.c. */ ! extern void 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); --- 283,289 ---- /* * cleanup_addr.c. */ ! 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 -cr --new-file /var/tmp/postfix-2.10.9/src/cleanup/cleanup_addr.c ./src/cleanup/cleanup_addr.c *** /var/tmp/postfix-2.10.9/src/cleanup/cleanup_addr.c 2012-01-09 20:26:49.000000000 -0500 --- ./src/cleanup/cleanup_addr.c 2016-05-12 10:52:35.000000000 -0400 *************** *** 6,12 **** /* SYNOPSIS /* #include /* ! /* void cleanup_addr_sender(state, addr) /* CLEANUP_STATE *state; /* const char *addr; /* --- 6,12 ---- /* SYNOPSIS /* #include /* ! /* off_t cleanup_addr_sender(state, addr) /* CLEANUP_STATE *state; /* const char *addr; /* *************** *** 29,35 **** /* sender/recipient auto bcc address generation. /* /* cleanup_addr_sender() processes sender envelope information and updates ! /* state->sender. /* /* cleanup_addr_recipient() processes recipient envelope information /* and updates state->recip. --- 29,36 ---- /* sender/recipient auto bcc address generation. /* /* cleanup_addr_sender() processes sender envelope information and updates ! /* 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,90 **** --- 86,92 ---- /* Global library. */ #include + #include #include #include #include *************** *** 99,112 **** #include "cleanup.h" #define STR vstring_str #define IGNORE_EXTENSION (char **) 0 /* cleanup_addr_sender - process envelope sender record */ ! void cleanup_addr_sender(CLEANUP_STATE *state, const char *buf) { VSTRING *clean_addr = vstring_alloc(100); const char *bcc; /* * Note: an unqualified envelope address is for all practical purposes --- 101,118 ---- #include "cleanup.h" #define STR vstring_str + #define LEN VSTRING_LEN #define IGNORE_EXTENSION (char **) 0 /* cleanup_addr_sender - process envelope sender record */ ! 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,147 **** --- 148,162 ---- 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) { *************** *** 155,160 **** --- 170,176 ---- } } vstring_free(clean_addr); + return after_sender_offs; } /* cleanup_addr_recipient - process envelope recipient */ diff -cr --new-file /var/tmp/postfix-2.10.9/src/cleanup/cleanup_envelope.c ./src/cleanup/cleanup_envelope.c *** /var/tmp/postfix-2.10.9/src/cleanup/cleanup_envelope.c 2009-06-05 21:24:50.000000000 -0400 --- ./src/cleanup/cleanup_envelope.c 2016-04-10 18:16:10.000000000 -0400 *************** *** 370,375 **** --- 370,377 ---- 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,395 **** 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); 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); } if (cleanup_milters != 0 && state->milters == 0 --- 384,393 ---- if ((state->sender_pt_offset = vstream_ftell(state->dst)) < 0) msg_fatal("%s: vstream_ftell %s: %m:", myname, cleanup_path); } ! after_sender_offs = cleanup_addr_sender(state, buf); if (state->milters || cleanup_milters) { /* Remember the after-sender record offset. */ ! state->sender_pt_target = after_sender_offs; } if (cleanup_milters != 0 && state->milters == 0 diff -cr --new-file /var/tmp/postfix-2.10.9/src/cleanup/cleanup_milter.c ./src/cleanup/cleanup_milter.c *** /var/tmp/postfix-2.10.9/src/cleanup/cleanup_milter.c 2014-10-18 17:40:07.000000000 -0400 --- ./src/cleanup/cleanup_milter.c 2016-05-15 15:01:41.000000000 -0400 *************** *** 1302,1307 **** --- 1302,1308 ---- 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; *************** *** 1365,1374 **** } } tok822_free_tree(tree); ! 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); /* * Overwrite the original sender record with the pointer to the new --- 1366,1376 ---- } } tok822_free_tree(tree); ! 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 *************** *** 2484,2489 **** --- 2486,2504 ---- 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 -cr --new-file /var/tmp/postfix-2.10.9/src/postscreen/postscreen.c ./src/postscreen/postscreen.c *** /var/tmp/postfix-2.10.9/src/postscreen/postscreen.c 2012-11-24 17:48:11.000000000 -0500 --- ./src/postscreen/postscreen.c 2016-04-11 08:51:26.000000000 -0400 *************** *** 79,85 **** /* 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 /* "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 --- 79,85 ---- /* 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 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