diff --git a/postfix/HISTORY b/postfix/HISTORY index 1de5eaac2..380b87765 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -27643,3 +27643,18 @@ Apologies for any names omitted. "smtpd_forbid_bare_newline_exclusions = $mynetworks". Files: mantools/postlink, proto/postconf.proto, global/mail_params.h, global/smtp_stream.c, global/smtp_stream.h, smtpd/smtpd.c. + +20231222 + + Workaround: smtpd_forbid_bare_newline broke the BDAT command. + File: smtpd/smtpd.c. + +20231123 + + Bugfix: smtpd_forbid_bare_newline_exclusions should respect + XCLIENT overrides. File: smtpd/smtpd.c. + +20231224 + + Reverted change 20231221 and adopted a fix by Viktor. File: + smtpd/smtpd.c. diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index d3ddc7f0d..97edb7eec 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20231223" +#define MAIL_RELEASE_DATE "20231224" #define MAIL_VERSION_NUMBER "3.9" #ifdef SNAPSHOT diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index fe3ba8de4..f40070cc4 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -4079,7 +4079,7 @@ static int bdat_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) */ done = 0; do { - int saved_forbid_bare_lf, last; + int payload_err; /* * Do not skip the smtp_fread_buf() call if read_len == 0. We still @@ -4093,20 +4093,20 @@ static int bdat_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) smtp_fread_buf(state->buffer, read_len, state->client); state->bdat_get_stream = vstream_memreopen( state->bdat_get_stream, state->buffer, O_RDONLY); + vstream_control(state->bdat_get_stream, CA_VSTREAM_CTL_EXCEPT, + CA_VSTREAM_CTL_END); + if ((payload_err = vstream_setjmp(state->bdat_get_stream)) != 0) + vstream_longjmp(state->client, payload_err); /* * Read lines from the fragment. The last line may continue in the - * next fragment, or in the next chunk. TODO(wietse) find out why a - * memory stream can't have vstream exceptions. + * next fragment, or in the next chunk. */ do { - saved_forbid_bare_lf = smtp_forbid_bare_lf; - last = smtp_get_noexcept(state->bdat_get_buffer, - state->bdat_get_stream, - var_line_limit, - SMTP_GET_FLAG_APPEND); - smtp_forbid_bare_lf = saved_forbid_bare_lf; - if (last == '\n') { + if (smtp_get_noexcept(state->bdat_get_buffer, + state->bdat_get_stream, + var_line_limit, + SMTP_GET_FLAG_APPEND) == '\n') { /* Stopped at end-of-line. */ curr_rec_type = REC_TYPE_NORM; } else if (!vstream_feof(state->bdat_get_stream)) {