[Mailman-Developers] Bug on mailman 2.1.1 with non ascii mails?

Guille -bisho- bisho at eurielec.etsit.upm.es
Tue Apr 15 05:06:35 EDT 2003


I have a problem with mailman 2.1.1 (Debian package 2.1.1-4)

The OutgoingRunner was failing as follows:
 Traceback (most recent call last):
   File "/var/lib/mailman/bin/qrunner", line 270, in ?
      main()
   File "/var/lib/mailman/bin/qrunner", line 230, in main
      qrunner.run()
   File "/usr/lib/mailman/Mailman/Queue/Runner.py", line 59, in run
      filecnt = self._oneloop()
   File "/usr/lib/mailman/Mailman/Queue/Runner.py", line 114, in
_oneloop
      self._doperiodic()
   File "/usr/lib/mailman/Mailman/Queue/OutgoingRunner.py", line 136, in
_doperiodic
      mlist.registerBounce(recip, msg)
   File "/var/lib/mailman/Mailman/Bouncer.py", line 155, in
registerBounce
      self.disableBouncingMember(member, info, msg)
   File "/var/lib/mailman/Mailman/Bouncer.py", line 165, in
disableBouncingMember
      self.__sendAdminBounceNotice(member, msg)
   File "/var/lib/mailman/Mailman/Bouncer.py", line 187, in
__sendAdminBounceNotice
      lang=self.preferred_language)
   File "/var/lib/mailman/Mailman/Message.py", line 203, in __init__
      self['Subject'] = Header(subject, charset, header_name='Subject')
   File "/var/lib/mailman/pythonlib/email/Header.py", line 164, in
__init__
      self.append(s, charset)
   File "/var/lib/mailman/pythonlib/email/Header.py", line 230, in
append
      ustr = unicode(s, incodec)
 UnicodeError :  ASCII decoding error: ordinal not in range(128)


In that line there was a:
ustr = unicode(s, ustr = unicode(s, incodecincodec)

And the incodec was set on line 229 as:
incodec = charset.input_codec or 'us-ascii'

It seems that charset.input_codec was not set, and the pending to send
emails were not us-ascii code. I have to change that line to:
incodec = charset.input_codec or 'iso-8859-15'
And also change the line 234:
- outcodec = charset.output_codec or 'us-ascii'
+ outcodec = charset.output_codec or 'iso-8859-15'

and the OutgoingRunner was able then to process the emails without
hanging.

Is important to make more checks, to avoid DOS atacks to mailman
servers. A message with non-ascii chars could be considered as ascii
making the OutgoingRunner to die, and stoping the service.

This only happens if:
if isinstance(s, StringType):
because the exception is not caught

later the the conversion is done properly capturing the exception:
elif isinstance(s, UnicodeType): 
for charset in USASCII, charset, UTF8:
try:
   outcodec = charset.output_codec or 'us-ascii'
   s = s.encode(outcodec)
   break
except UnicodeError:
...

How you think this should be solved? I'm not and expert in python...

-- 
     ,,,..     .-.
   /       -_.' ' ""
,/ ,/, /   ,    ,\
         ,    ,   ``-,
        ,   , ,       )
PAZ SÍ /,,'    ,/ ,/ /
¡GUERRA NO!     ,  / bisho! -=] 15/04/2003 [=-





More information about the Mailman-Developers mailing list