Kevin Locke:
> On Wed, 2011-09-21 at 19:30 -0400, Wietse Venema wrote:
> > Kevin Locke:
> >> /^X-Spam-Status: Yes.*tests=(.*) autolearn=/ REJECT Message identified as 
> >> spam by SpamAssassin using the following tests: $1
> >> 
> >> This works great, except that the message is chopped off at the first
> >> line break in the X-Spam-Status header.
> > 
> > Multi-line reject messages have never been supported in Postfix,
> > and I don't expect that to change (that would require subtle changes
> > to the SMTP server and to the bounce message formatter among other
> > things).
> > 
> > What happens in the above example is the result of an omission to
> > filter out newline characters. In the context of web applications,
> > I believe that this would be called a line-splitting bug.
> 
> Great.  Thanks for the information.
> 
> Is it a bug that I should submit somewhere, or is that what I have
> just done?

While fixing this, I found an unrelated multi-line bug with
replies from a before-queue content filter.

        Wietse

==> /home/ftp/upload/me/20110922-cleanup-multiline-reject-patch <==
20110921

        Bugfix (introduced: Postfix 1.1): smtpd(8) did not sanitize
        newline characters in cleanup(8) REJECT messages. This
        happened when a REJECT pattern matched multi-line header
        text. Discovered by Kevin Locke.  File: smtpd/smtpd.c.

*** /var/tmp/postfix-2.9-20110918/src/smtpd/smtpd.c     Thu Aug 18 17:16:21 2011
--- src/smtpd/smtpd.c   Thu Sep 22 10:40:53 2011
***************
*** 3057,3062 ****
--- 3057,3063 ----
        if (state->err == 0) {
            why = vstring_alloc(10);
            state->err = mail_stream_finish(state->dest, why);
+           printable(STR(why), ' ');
        } else
            mail_stream_cleanup(state->dest);
        state->dest = 0;

==> /home/ftp/upload/me/20110922-smtpd-proxy-multiline-reject-patch <==
20110922

        Bugfix (introduced: Postfix 2.1): smtpd(8) sent multi-line
        responses from a before-queue content filter as text with
        bare <LF> instead of <CR><LF>.  Found during code maintenance.
        File: smtpd/smtpd_proxy.c.

*** /var/tmp/postfix-2.9-20110918/src/smtpd/smtpd_proxy.c       Sat Feb  5 
18:44:05 2011
--- src/smtpd/smtpd_proxy.c     Thu Sep 22 10:37:44 2011
***************
*** 788,794 ****
         */
        if (LEN(proxy->buffer) < var_line_limit) {
            if (VSTRING_LEN(proxy->buffer))
!               VSTRING_ADDCH(proxy->buffer, '\n');
            vstring_strcat(proxy->buffer, STR(buffer));
        }
  
--- 788,794 ----
         */
        if (LEN(proxy->buffer) < var_line_limit) {
            if (VSTRING_LEN(proxy->buffer))
!               vstring_strcat(proxy->buffer, "\r\n");
            vstring_strcat(proxy->buffer, STR(buffer));
        }
  

Reply via email to