From 5c2e0fe6491761ba2c55b780663d7f9ec86a62cc Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 6 Jun 2005 16:47:20 +0000 Subject: Add a test case for malformed email headers git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1391 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionmailer/test/fixtures/raw_email9 | 28 ++++++++++++++++++++++++++++ actionmailer/test/mail_service_test.rb | 5 +++++ 2 files changed, 33 insertions(+) create mode 100644 actionmailer/test/fixtures/raw_email9 diff --git a/actionmailer/test/fixtures/raw_email9 b/actionmailer/test/fixtures/raw_email9 new file mode 100644 index 0000000000..8b9b1eaa04 --- /dev/null +++ b/actionmailer/test/fixtures/raw_email9 @@ -0,0 +1,28 @@ +Received: from xxx.xxx.xxx ([xxx.xxx.xxx.xxx] verified) + by xxx.com (CommuniGate Pro SMTP 4.2.8) + with SMTP id 2532598 for xxx@xxx.com; Wed, 23 Feb 2005 17:51:49 -0500 +Received-SPF: softfail + receiver=xxx.com; client-ip=xxx.xxx.xxx.xxx; envelope-from=xxx@xxx.xxx +quite Delivered-To: xxx@xxx.xxx +Received: by xxx.xxx.xxx (Wostfix, from userid xxx) + id 0F87F333; Wed, 23 Feb 2005 16:16:17 -0600 +Date: Wed, 23 Feb 2005 18:20:17 -0400 +From: "xxx xxx" +Message-ID: <4D6AA7EB.6490534@xxx.xxx> +To: xxx@xxx.com +Subject: Stop adware/spyware once and for all. +X-Scanned-By: MIMEDefang 2.11 (www dot roaringpenguin dot com slash mimedefang) + +You are infected with: +Ad Ware and Spy Ware + +Get your free scan and removal download now, +before it gets any worse. + +http://xxx.xxx.info?aid=3D13&?stat=3D4327kdzt + + + + +no more? (you will still be infected) +http://xxx.xxx.info/discon/?xxx@xxx.com diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 48fe0941bb..9ed2cd2293 100755 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -510,5 +510,10 @@ EOF attachment = mail.attachments.last assert_equal "01QuienTeDijat.Pitbull.mp3", attachment.original_filename end + + def test_wrong_mail_header + fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email9") + assert_raise(TMail::SyntaxError) { TMail::Mail.parse(fixture) } + end end -- cgit v1.2.3