develooper Front page | perl.perl5.porters | Postings from December 2011

[perl #38387] Net::Cmd does not handle CR and LF correctly

Thread Next
James E Keenan via RT
December 4, 2011 06:28
[perl #38387] Net::Cmd does not handle CR and LF correctly
Message ID:
On Tue Jan 31 14:28:54 2006, wrote:
> The escaping of CR and LF in Net::Cmd->dataend is somewhat broken.
> A sequence "a\r" is escaped as "a\015\015\012.\015\012".
> There is even a test for this behavior.  But it does not conform
> to RFC 2821 Section 2.3.7:
>    In addition, the appearance of "bare" "CR" or "LF" characters in
> text
>    (i.e., either without the other) has a long history of causing
>    problems in mail implementations and applications that use the mail
>    system as a tool.  SMTP client implementations MUST NOT transmit
>    these characters except when they are intended as line terminators
>    and then MUST, as indicated above, transmit them only as a <CRLF>
>    sequence.
> So sending the sequence "\015\015" is illegal because the first
> "\015" is not followed by a "\012".
> I have made a patch for that bug.  I have also added a lot of other
> test cases to the t/datasend.t test.  I wrote these tests, after
> we had encountered real world SMTP problems with different versions
> of Net::Cmd.

My layperson's impression is that the original poster's criticism of
Net::Cmd::datasend() with respect to RFC 2821 Sec 2.3.7 is correct. 
(  I modified the patch to apply to
blead; see attached.  I haven't examined the tests in detail, but they PASS.

Of course, Perl code in the wild may have adapted to the suboptimal code
in datasend(), so we have to evaluate this carefully.  Please review.

Thank you very much.
Jim Keenan

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About