[Email-SIG] Maybe a bug, maybe not

Eric S. Johansson esj at harvee.org
Sat May 1 08:05:50 EDT 2004


found a very common form of spam that triggers an exception.  don't know 
if you considered a bug or not.  I've enclosed a sample message and a 
very simple program to trigger the bug.  From my limited understanding, 
the payload type is correct but somehow it is dispatched to the wrong 
handler.  When I was writing the test program, I also copied some of the 
generator code so I could see what method was being requested etc.  then 
I ran into limits of my knowledge and time.

let me know if this should be a bug report.  In the meantime, I need to 
go figure out where to add exception traps and how to handle them

[root at harvee emailbug]# python test_bug.py
Traceback (most recent call last):
   File "test_bug.py", line 12, in ?
     print message.as_string()
   File "/usr/lib/python2.2/site-packages/email/Message.py", line 113, 
in as_string
     g.flatten(self, unixfrom=unixfrom)
   File "/usr/lib/python2.2/site-packages/email/Generator.py", line 103, 
in flatten
     self._write(msg)
   File "/usr/lib/python2.2/site-packages/email/Generator.py", line 131, 
in _write
     self._dispatch(msg)
   File "/usr/lib/python2.2/site-packages/email/Generator.py", line 157, 
in _dispatch
     meth(msg)
   File "/usr/lib/python2.2/site-packages/email/Generator.py", line 201, 
in _handle_text
     raise TypeError, 'string payload expected: %s' % (type(payload))
TypeError: string payload expected: <type 'list'>
-------------- next part --------------
import sys

sys.path.insert(1,"/usr/local/camram/modules/")
sys.path.insert(1,"/usr/local/camram/web-ui/cgi-exec/")
#sys.path.insert(1,"../modules/")

UNDERSCORE = "_"

import email
handle_2 = file("broken_format.msg")
message = email.message_from_file(handle_2)
print message.as_string()

main = message.get_content_maintype()
sub = message.get_content_subtype()
specific = UNDERSCORE.join((main, sub)).replace('-', '_')
meth = getattr(message, '_handle_' + specific, None)
print  meth


-------------- next part --------------
Return-Path: <gljgk at cox.net>
Received: from red.harvee.home (red [192.168.25.1] (may be forged))
	by harvee.org (8.12.8/8.12.8) with ESMTP id i3Q59FCe002252
	for <esj at inguide.com>; Mon, 26 Apr 2004 01:09:15 -0400
Received: from c-a80873d5.026-12-6f736c4.cust.bredband.no (c-a80873d5.026-12-6f736c4.cust.bredband.no [213.115.8.168])
	by red.harvee.home (8.11.6/8.11.6) with SMTP id i3Q59Ep29530
	for <esj at inguide.com>; Mon, 26 Apr 2004 01:09:14 -0400
Received: from 194.155.112.200 by 213.115.8.168; Mon, 26 Apr 2004 03:10:23 -0300
Message-ID: <HBADIMQDZTRWUYSKWAWI at alltel.net>
From: "Noelle Field" <gljgk at cox.net>
Reply-To: "Noelle Field" <gljgk at cox.net>
To: esj at inguide.com
Subject: Mort.gage ra.tes are decreasing
Date: Mon, 26 Apr 2004 08:08:23 +0200
MIME-Version: 1.0
Content-Type: text/html;
	boundary="--359297558671409"
X-Originating-IP: 66.93.191.107

----359297558671409
Content-Type: text/html;
Content-Transfer-Encoding: 7Bit

<html><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><p>You're PRE-APPROVED for a for a F.ree Mort.gage Quote. We know that you are paying over 6% and we can reduce it down to 3% which would save you thousands of dollars.
<p>
<b><a href="http://www.expeditemortgage.net/?mal">Apply Now</a></b>
<p><p><p><font color=#CCCCCC>dialogue twentieth humanitarian alcestis cranberry blank succubus sweater emulate irrational sunflower waller desiderata honeydew explicable volterra rook barnabas atypic powerhouse helmut marc kalmuk barberry formal golden greece machine pueblo sushi triumphant  twirl froze navy olympic arcane cranford treatise vasectomy boon systemic bonaparte savannah dragon </font> <p><p><a href="http://www.expeditemortgage.net/100/">re.move</a><p>
</html>

----359297558671409--



More information about the Email-SIG mailing list