From: Wietse Venema Date: Sun, 15 May 2016 05:00:00 +0000 (-0500) Subject: postfix-3.0.5 X-Git-Tag: v3.0.5^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d4ff3f40037a6e8ff56b643c09e7bbcaf939721;p=thirdparty%2Fpostfix.git postfix-3.0.5 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 201080f78..d56d40eb2 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -21739,3 +21739,25 @@ Apologies for any names omitted. Documentation (introduced: Postfix 3.0): wrong paramester name in lmtp_address_verify_target description. File: proto/posconf.proto + +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 90fd45421..188cc9ccf 100644 --- a/postfix/conf/header_checks +++ b/postfix/conf/header_checks @@ -465,7 +465,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 b47c60fb8..58f3fd8aa 100644 --- a/postfix/html/header_checks.5.html +++ b/postfix/html/header_checks.5.html @@ -415,7 +415,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 ccf9a3046..d4948b370 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/makedefs b/postfix/makedefs index dbdc091db..318d76db7 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -284,6 +284,15 @@ case "$SYSTEM.$RELEASE" in : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"} : ${PLUGIN_LD="${CC} -shared"} ;; + OpenBSD.6*) SYSTYPE=OPENBSD6 + : ${CC=cc} + : ${SHLIB_SUFFIX=.so.1.0} + : ${SHLIB_CFLAGS=-fPIC} + : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'} + : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'} + : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"} + : ${PLUGIN_LD="${CC} -shared"} + ;; ekkoBSD.1*) SYSTYPE=EKKOBSD1 ;; NetBSD.1*) SYSTYPE=NETBSD1 diff --git a/postfix/man/man5/header_checks.5 b/postfix/man/man5/header_checks.5 index 6549b7304..034967c78 100644 --- a/postfix/man/man5/header_checks.5 +++ b/postfix/man/man5/header_checks.5 @@ -438,7 +438,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 4a9e85563..505502615 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/header_checks b/postfix/proto/header_checks index b51e182f9..2399b4770 100644 --- a/postfix/proto/header_checks +++ b/postfix/proto/header_checks @@ -437,7 +437,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 9bd7f1b87..409aa1b89 100644 --- a/postfix/src/cleanup/cleanup.h +++ b/postfix/src/cleanup/cleanup.h @@ -289,7 +289,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 f889e1a60..b6396ada8 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. @@ -81,6 +82,7 @@ /* Global library. */ #include +#include #include #include #include @@ -101,10 +103,13 @@ /* 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 @@ -148,6 +153,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) { @@ -162,6 +176,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 261542ba8..c169a9656 100644 --- a/postfix/src/cleanup/cleanup_envelope.c +++ b/postfix/src/cleanup/cleanup_envelope.c @@ -379,6 +379,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", @@ -391,14 +393,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 cc60f3595..24edbcca9 100644 --- a/postfix/src/cleanup/cleanup_milter.c +++ b/postfix/src/cleanup/cleanup_milter.c @@ -1325,6 +1325,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; @@ -1388,10 +1389,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 @@ -2565,6 +2567,20 @@ 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 + | DICT_FLAG_UTF8_REQUEST); + 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 33bca0029..964aa2b47 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 "20160221" -#define MAIL_VERSION_NUMBER "3.0.4" +#define MAIL_RELEASE_DATE "20160515" +#define MAIL_VERSION_NUMBER "3.0.5" #ifdef SNAPSHOT #define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff --git a/postfix/src/postscreen/postscreen.c b/postfix/src/postscreen/postscreen.c index 6a257bf5b..e4ea94cb6 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 diff --git a/postfix/src/util/sys_defs.h b/postfix/src/util/sys_defs.h index 5b381af40..949855c7c 100644 --- a/postfix/src/util/sys_defs.h +++ b/postfix/src/util/sys_defs.h @@ -28,7 +28,7 @@ || defined(FREEBSD8) || defined(FREEBSD9) || defined(FREEBSD10) \ || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ - || defined(OPENBSD5) \ + || defined(OPENBSD5) || defined(OPENBSD6) \ || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \ || defined(NETBSD4) || defined(NETBSD5) || defined(NETBSD6) \ || defined(NETBSD7) \