[#35027] [Ruby 1.9-Bug#4352][Open] [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s) — "James M. Lawrence" <redmine@...>

Bug #4352: [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s)

16 messages 2011/02/01

[#35114] [Ruby 1.9-Bug#4373][Open] http.rb:677: [BUG] Segmentation fault — Christian Fazzini <redmine@...>

Bug #4373: http.rb:677: [BUG] Segmentation fault

59 messages 2011/02/06

[#35171] [Ruby 1.9-Bug#4386][Open] encoding: directive does not affect regex expressions — mathew murphy <redmine@...>

Bug #4386: encoding: directive does not affect regex expressions

9 messages 2011/02/09

[#35237] [Ruby 1.9-Bug#4400][Open] nested at_exit hooks run in strange order — Suraj Kurapati <redmine@...>

Bug #4400: nested at_exit hooks run in strange order

12 messages 2011/02/15

[ruby-core:35202] Patch to Net::InternetMessageIO

From: Daniel Cormier <daniel.cormier@...>
Date: 2011-02-11 15:13:17 UTC
List: ruby-core #35202
This patch addresses an issue when sending a message with Net::SMTP
where the last line starts with a period and does not end with \n or
\r\n.

The result of this problem is that the period at the beginning of
that line is not escaped. This is especially a problem when the line
contains only a period. When this is the case then the message is
ended rather than the period being sent as part of the email, then
'\r\n.\r\n' is sent a second time (as the class does not expect the
message to have ended) resulting in the mail server returning an
error.

  Attached along with the patch are two emails that show the issue. If
you try to send the contents of bad.eml with Net::SMTP, the email will
be sent (without its trailing period), but you will get an error. If
you try to send the contents of good.eml with Net::SMTP it will work
correctly and you will receive the trailing period.

CHANGELOG:

  Now properly sends the last line of an email when it begins with a
period and does not end with \n or \r\n.

Thanks,
Daniel

Attachments (3)

bad.eml (179 Bytes, text/plain)
To: <bogus@email.domain>
From: <bogud@email.com>
Subject: Error

This message ends with a period and no \n or \r\n.
There will be an error if you try to send it with Net::SMTP.

.
ruby-changes.patch (429 Bytes, text/x-diff)
Index: protocol.rb
===================================================================
--- protocol.rb	(revision 30843)
+++ protocol.rb	(working copy)
@@ -288,7 +288,7 @@
       @wbuf = ''
       yield
       if not @wbuf.empty?   # unterminated last line
-        write0 @wbuf.chomp + "\r\n"
+        write0 @wbuf.sub(/\A\./, '..').chomp + "\r\n"
       elsif @written_bytes == 0   # empty src
         write0 "\r\n"
       end
good.eml (166 Bytes, text/plain)
To: <bogus@email.domain>
From: <bogud@email.com>
Subject: Success

This message ends with a period and then a newline.
You will be able to send it with Net::SMTP.

.

In This Thread

Prev Next