From 1d0dffd0b1c5f374ab6b65b8654e75dd5eaf10c2 Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Sat, 10 Jun 2017 00:00:00 -0500 Subject: [PATCH] postfix-3.2.1 --- postfix/HISTORY | 43 +++++++++++++++++++++++-- postfix/INSTALL | 2 +- postfix/README_FILES/INSTALL | 2 +- postfix/html/INSTALL.html | 2 +- postfix/proto/INSTALL.html | 2 +- postfix/src/bounce/bounce_notify_util.c | 4 ++- postfix/src/global/mail_version.h | 4 +-- postfix/src/milter/milter.c | 9 ++++-- postfix/src/smtpd/smtpd.c | 2 ++ postfix/src/smtpd/smtpd_check.c | 9 ++++-- postfix/src/util/vstring.c | 10 +++--- 11 files changed, 69 insertions(+), 20 deletions(-) diff --git a/postfix/HISTORY b/postfix/HISTORY index 3b7a72b5b..a17ec4487 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -22923,7 +22923,7 @@ Apologies for any names omitted. 20170206 - Bugfix (introduced: Postfix 3.0): when check_mumble_a_access + Bugfix (introduced: Postfix 3.0): check_mumble_a_access did not handle [ipaddress], unlike check_mumble_mx_access. When check_mumble_a_access was introduced, some condition was not updated. Reported by James (postfix_tracker). File: @@ -22940,5 +22940,42 @@ Apologies for any names omitted. 20170218 Cleanup: typofixes from klemens. The only change in compiled - code is in one identical mysql error message that also - appears in the pgsql client. Files: about 50. + code is in one mysql error message that also appears in the + pgsql client. Files: about 50. + +20170221 + + Compatibility fix (introduced: Postfix 3.1): some Milter + applications do not recognize macros sent as {name} when + macros have single-character names. Postfix now sends such + macros without {} as it has done historically. Viktor + Dukhovni. File: milter/milter.c. + +20170402 + + Bugfix (introduced: Postfix 3.2): restore the SMTP server + receive override options at the end of an SMTP session, + after the options may have been modified by an smtpd_milter_maps + setting of "DISABLE". Problem report by Christian Rößner, + root cause analysis by Viktor Dukhovni. File: smtpd/smtpd.c. + +20170430 + + Safety net: append a null byte to vstring buffers, so that + C-style string operations won't scribble past the end. File: + vstring.c. + +20170531 + + Bugfix (introduced: Postfix 3.2): after the table lookup + overhaul, the check_sender_access and check_recipient_access + features ignored the parent_domain_matches_subdomains + setting. Reported by Henrik Larsson. File: smtpd/smtpd_check.c. + +20170610 + + Workaround (introduced: Postfix 3.0 20140718): prevent MIME + downgrade of Postfix-generated message/delivery status. + It's supposed to be 7bit, therefore quoted-printable encoding + is not expected. Problem reported by Griff. File: + bounce/bounce_notify_util.c. diff --git a/postfix/INSTALL b/postfix/INSTALL index f2a38d314..10e69408c 100644 --- a/postfix/INSTALL +++ b/postfix/INSTALL @@ -612,7 +612,7 @@ The following is an extensive list of names and values. |_______________________________|_____________________________________________| | |Specifies options for the postfix-install | |POSTFIX_INSTALL_OPTS=-option...|command, separated by whitespace. Currently, | -| |the only supported option is "-keep-new- | +| |the only supported option is "-keep-build- | | |mtime". | |_______________________________|_____________________________________________| | |Specifies non-default compiler options for | diff --git a/postfix/README_FILES/INSTALL b/postfix/README_FILES/INSTALL index c0168593f..14e61caf0 100644 --- a/postfix/README_FILES/INSTALL +++ b/postfix/README_FILES/INSTALL @@ -612,7 +612,7 @@ The following is an extensive list of names and values. |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | | |Specifies options for the postfix-install | |POSTFIX_INSTALL_OPTS=-option...|command, separated by whitespace. Currently, | -| |the only supported option is "-keep-new- | +| |the only supported option is "-keep-build- | | |mtime". | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | | |Specifies non-default compiler options for | diff --git a/postfix/html/INSTALL.html b/postfix/html/INSTALL.html index 016ea8221..2ee35cdf9 100644 --- a/postfix/html/INSTALL.html +++ b/postfix/html/INSTALL.html @@ -883,7 +883,7 @@ Specify OPT= to turn off optimization. POSTFIX_INSTALL_OPTS=-option... Specifies options for the postfix-install command, separated by whitespace. Currently, the only supported option is -"-keep-new-mtime". +"-keep-build-mtime". SHLIB_CFLAGS=flags Specifies non-default compiler options for building Postfix dynamically-linked diff --git a/postfix/proto/INSTALL.html b/postfix/proto/INSTALL.html index f72133920..984528cbe 100644 --- a/postfix/proto/INSTALL.html +++ b/postfix/proto/INSTALL.html @@ -883,7 +883,7 @@ Specify OPT= to turn off optimization. POSTFIX_INSTALL_OPTS=-option... Specifies options for the postfix-install command, separated by whitespace. Currently, the only supported option is -"-keep-new-mtime". +"-keep-build-mtime". SHLIB_CFLAGS=flags Specifies non-default compiler options for building Postfix dynamically-linked diff --git a/postfix/src/bounce/bounce_notify_util.c b/postfix/src/bounce/bounce_notify_util.c index fbcda18d4..65a874d9d 100644 --- a/postfix/src/bounce/bounce_notify_util.c +++ b/postfix/src/bounce/bounce_notify_util.c @@ -637,7 +637,9 @@ int bounce_header_dsn(VSTREAM *bounce, BOUNCE_INFO *bounce_info) (bounce_info->smtputf8 & SMTPUTF8_FLAG_REQUESTED) ? "global-" : ""); /* Fix 20140709: addresses may be 8bit. */ - if (NOT_7BIT_MIME(bounce_info)) + if (NOT_7BIT_MIME(bounce_info) + /* BC Fix 20170610: prevent MIME downgrade of message/delivery-status. */ + && (bounce_info->smtputf8 & SMTPUTF8_FLAG_REQUESTED)) post_mail_fprintf(bounce, "Content-Transfer-Encoding: %s", bounce_info->mime_encoding); diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 040fa635f..2e0859b38 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 "20170228" -#define MAIL_VERSION_NUMBER "3.2.0" +#define MAIL_RELEASE_DATE "20170610" +#define MAIL_VERSION_NUMBER "3.2.1" #ifdef SNAPSHOT #define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff --git a/postfix/src/milter/milter.c b/postfix/src/milter/milter.c index 64836d463..ac2baaf77 100644 --- a/postfix/src/milter/milter.c +++ b/postfix/src/milter/milter.c @@ -333,18 +333,21 @@ static ARGV *milter_macro_lookup(MILTERS *milters, const char *macro_names) VSTRING *canon_buf = vstring_alloc(20); const char *value; const char *name; + const char *cname; while ((name = mystrtok(&cp, CHARS_COMMA_SP)) != 0) { if (msg_verbose) msg_info("%s: \"%s\"", myname, name); if (*name != '{') /* } */ - name = STR(vstring_sprintf(canon_buf, "{%s}", name)); - if ((value = milters->mac_lookup(name, milters->mac_context)) != 0) { + cname = STR(vstring_sprintf(canon_buf, "{%s}", name)); + else + cname = name; + if ((value = milters->mac_lookup(cname, milters->mac_context)) != 0) { if (msg_verbose) msg_info("%s: result \"%s\"", myname, value); argv_add(argv, name, value, (char *) 0); } else if (milters->macro_defaults != 0 - && (value = htable_find(milters->macro_defaults, name)) != 0) { + && (value = htable_find(milters->macro_defaults, cname)) != 0) { if (msg_verbose) msg_info("%s: using default \"%s\"", myname, value); argv_add(argv, name, value, (char *) 0); diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 986264b22..40d49f623 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -5396,6 +5396,8 @@ static void teardown_milters(SMTPD_STATE *state) milter_free(state->milters); state->milters = 0; } + smtpd_input_transp_mask = + input_transp_mask(VAR_INPUT_TRANSP, var_input_transp); } diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 47ccec1a1..ea7d3870e 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -3174,6 +3174,7 @@ static int check_mail_access(SMTPD_STATE *state, const char *table, const char *myname = "check_mail_access"; const RESOLVE_REPLY *reply; const char *value; + int lookup_strategy; int status; MAPS *maps; @@ -3213,8 +3214,10 @@ static int check_mail_access(SMTPD_STATE *state, const char *table, * Look up user+foo@domain if the address has an extension, user@domain * otherwise. */ -#define LOOKUP_STRATEGY (MA_FIND_FULL | MA_FIND_NOEXT | MA_FIND_DOMAIN \ - | MA_FIND_PDMS | MA_FIND_LOCALPART_AT) + lookup_strategy = MA_FIND_FULL | MA_FIND_NOEXT | MA_FIND_DOMAIN + | MA_FIND_LOCALPART_AT + | (access_parent_style == MATCH_FLAG_PARENT ? + MA_FIND_PDMS : MA_FIND_PDDMDS); if ((maps = (MAPS *) htable_find(map_command_table, table)) == 0) { msg_warn("%s: unexpected dictionary: %s", myname, table); @@ -3225,7 +3228,7 @@ static int check_mail_access(SMTPD_STATE *state, const char *table, def_acl)); } if ((value = mail_addr_find_strategy(maps, CONST_STR(reply->recipient), - (char **) 0, LOOKUP_STRATEGY)) != 0) { + (char **) 0, lookup_strategy)) != 0) { *found = 1; status = check_table_result(state, table, value, CONST_STR(reply->recipient), diff --git a/postfix/src/util/vstring.c b/postfix/src/util/vstring.c index 6e090a2ec..b97a32463 100644 --- a/postfix/src/util/vstring.c +++ b/postfix/src/util/vstring.c @@ -307,10 +307,11 @@ static void vstring_extend(VBUF *bp, ssize_t incr) */ if ((bp->flags & VSTRING_FLAG_EXACT) == 0 && bp->len > incr) incr = bp->len; - if (bp->len > SSIZE_T_MAX - incr) + if (bp->len > SSIZE_T_MAX - incr - 1) msg_fatal("vstring_extend: length overflow"); new_len = bp->len + incr; - bp->data = (unsigned char *) myrealloc((void *) bp->data, new_len); + bp->data = (unsigned char *) myrealloc((void *) bp->data, new_len + 1); + bp->data[new_len] = 0; bp->len = new_len; bp->ptr = bp->data + used; bp->cnt = bp->len - used; @@ -350,12 +351,13 @@ VSTRING *vstring_alloc(ssize_t len) { VSTRING *vp; - if (len < 1) + if (len < 1 || len > SSIZE_T_MAX - 1) msg_panic("vstring_alloc: bad length %ld", (long) len); vp = (VSTRING *) mymalloc(sizeof(*vp)); vp->vbuf.flags = 0; vp->vbuf.len = 0; - vp->vbuf.data = (unsigned char *) mymalloc(len); + vp->vbuf.data = (unsigned char *) mymalloc(len + 1); + vp->vbuf.data[len] = 0; vp->vbuf.len = len; VSTRING_RESET(vp); vp->vbuf.data[0] = 0; -- 2.47.3