Subject: amavisd-new: mime_decode-1 FAILED on attachments with latin-2 names

From: Vladislav Kurz <[email-masked]>
Date: Fri, 18 Feb 2011 13:08:55 +0100

Package: amavisd-new
Version: 1:2.6.1.dfsg-1
Severity: normal

Hello,

I have noticed that amavis has problem processing emails with attachments
whose name contains latin-2 character with diacritics, e.g. ecaron.
The same attachment renamed to ascii-only is processed fine. 

This is what amavis logs:

Feb 18 07:42:06 bupu amavis[16497]: (16497-07) (!!)TROUBLE in check_mail: mime_decode-1 FAILED: MIME::Words: unexpected case:\n(Ry\x{0161}av\375_ Vra\x{010d}_anotace.doc) pos 0\n\tPlease alert developer.
Feb 18 07:42:06 bupu amavis[16497]: (16497-07) (!)PRESERVING EVIDENCE in /var/lib/amavis/tmp/amavis-20110218T073020-16497

\x{0161} stands for scaron (unicode hexa 0x0161)
\375 stands for yacute (iso-latin-2 octal 375, same character and code in iso-latin-1)
\x{010d} stands for ccaron (unicode hexa 0x010d)

I suspect, that the problem lies in characters encoded as \x{0000}

And this is what postfix log:

Feb 18 08:52:06 bupu postfix/smtp[28253]: 4BA6B18F42E: to=<[email-masked]>, relay=127.0.0.1[127.0.0.1]:10024, delay=323863, delays=323863/0.02/0/0.08, dsn=4.5.0, status=deferred (host 127.0.0.1[127.0.0.1] said: 451-4.5.0 Error in processing, id=25505-14, mime_decode-1 FAILED: MIME::Words: unexpected case: 451-4.5.0 (Ry\x{0161}av\375_ Vra\x{010d}_anotace.doc) pos 0 451 4.5.0 \tPlease alert developer. (in reply to end of DATA command))

Further problem is, that amavis or postfix reports this error as temporary (451), even though 
it is a permanent problem. Sender gets notified usually after few days, which is wrong.

Please help or tell me if there is some workarounrd or config option to get such e-mails through.
If more info is needed, just tell me and I'll send you what you need.

Regards
Vladislav Kurz

-- System Information:
Debian Release: 5.0.8
  APT prefers oldstable
  APT policy: (500, 'oldstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686-bigmem (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=cs_CZ.ISO-8859-2 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/bash

Versions of packages amavisd-new depends on:
ii  adduser                  3.110           add and remove users and groups
ii  debconf [debconf-2.0]    1.5.24          Debian configuration management sy
ii  file                     4.26-1          Determines file type using "magic"
ii  libarchive-zip-perl      1.18-1          Module for manipulation of ZIP arc
ii  libberkeleydb-perl       0.34-1+b1       use Berkeley DB 4 databases from P
ii  libcompress-zlib-perl    2.012-1         Perl module for creation and manip
ii  libconvert-tnef-perl     0.17-8          Perl module to read TNEF files
ii  libconvert-uulib-perl    1.11-1          Perl interface to the uulib librar
pn  libdigest-md5-perl       <none>          (no description available)
ii  libio-stringy-perl       2.110-4         Perl modules for IO from scalars a
ii  libmailtools-perl        2.03-1          Manipulate email in perl programs
pn  libmime-base64-perl      <none>          (no description available)
ii  libmime-tools-perl       5.427-1         Perl5 modules for MIME-compliant m
ii  libnet-server-perl       0.97-1          An extensible, general perl server
ii  libunix-syslog-perl      1.1-2           Perl interface to the UNIX syslog(
ii  perl [libtime-hires-perl 5.10.0-19lenny3 Larry Wall's Practical Extraction 
ii  perl-modules [libarchive 5.10.0-19lenny3 Core Perl modules

amavisd-new recommends no packages.

Versions of packages amavisd-new suggests:
ii  apt-listchanges  2.83                    package change history notificatio
ii  arj              3.10.22-6               archiver for .arj files
pn  cabextract       <none>                  (no description available)
ii  clamav           0.96.5+dfsg-1~volatile1 anti-virus utility for Unix - comm
ii  clamav-daemon    0.96.5+dfsg-1~volatile1 anti-virus utility for Unix - scan
ii  cpio             2.9-13lenny1            GNU cpio -- a program to manage ar
pn  dspam            <none>                  (no description available)
pn  lha              <none>                  (no description available)
pn  libauthen-sasl-p <none>                  (no description available)
ii  libdbi-perl      1.605-1                 Perl5 database interface by Tim Bu
pn  libmail-dkim-per <none>                  (no description available)
ii  libnet-ldap-perl 1:0.36-1                A Client interface to LDAP servers
pn  lzop             <none>                  (no description available)
pn  nomarch          <none>                  (no description available)
ii  spamassassin     3.2.5-2+lenny3          Perl-based spam filter using text 
ii  unrar            1:3.8.2-1               Unarchiver for .rar files (non-fre
pn  zoo              <none>                  (no description available)

-- debconf information excluded

---

From: Vladislav Kurz <[email-masked]>
Date: Fri, 18 Feb 2011 17:36:48 +0100 (CET)

Hello,

I found out that there were installed newer modules from CPAN in 
/usr/local/perl, and MIME::Words was also there. CPAN says:

cpan[7]> m MIME::Tools
Module id = MIME::Tools
CPAN_USERID DSKOLL (David F. Skoll <[email-masked]>)
CPAN_VERSION 5.501
CPAN_FILE D/DS/DSKOLL/MIME-tools-5.501.tar.gz
MANPAGE MIME-tools - modules for parsing (and creating!) MIME entities
INST_FILE /usr/local/share/perl/5.10.0/MIME/Tools.pm
INST_VERSION 5.500

So it might be a bug in newer version of libmime-tools-perl, or an 
incompatibility issue between mime-tools 5.501 and amavis 2.6.1.

Perhaps this bug could be reassigned to package libmime-tools-perl, and 
tested with latest amavis on debian/sid.

Regards
Vladislav Kurz