OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: CRLF Was: Postfix with entourage

From: Wietse Venema (wietseporcupine.org)
Date: Fri Jan 02 2004 - 11:26:26 CST


Luca Berra:
> On Fri, Jan 02, 2004 at 11:44:40AM -0500, Wietse Venema wrote:
> >This is not right. SMTP requires that lines end in <CR><LF>; sending
> ><CR> without <LF> is illegal, as is sending <LF> without <CR>.
> >
> speaking of <CR> without <LF> i am receiving a lot of spam with bare
> <CR> in the headers, and at least one with a <CR> in the body.
> I'd like to stop it, do i have to use header/body checks or did i miss
> something?
> L.

Quoting from smtp_stream.c, this is how Postfix handles some common
protocol violations.

        Wietse

        /*
         * Strip off the record terminator: either CRLF or just bare LF.
         *
         * XXX RFC 2821 disallows sending bare CR everywhere. We remove bare CR
         * if received before CRLF, and leave it alone otherwise.
         */
    case '\n':
        vstring_truncate(vp, VSTRING_LEN(vp) - 1);
        while (VSTRING_LEN(vp) > 0 && vstring_end(vp)[-1] == '\r')
            vstring_truncate(vp, VSTRING_LEN(vp) - 1);
        VSTRING_TERMINATE(vp);