[Dovecot] Dovecot failing to parse some UTF-8 encoded attachment filenames, returning empty string instead [SOLVED]
ar-dovecotlist at acrconsulting.co.uk
Fri Sep 30 01:38:23 EEST 2011
On Thursday 22 September 2011 12:31:40 Andrew Richards wrote:
> On Thursday 22 September 2011 00:45:32 Timo Sirainen wrote:
> > On 22.9.2011, at 1.59, Andrew Richards wrote:
> > > I'm seeing a strange problem with some attachment filenames that are
> > > UTF-8 encoded. The problem seems to be related to spaces and/or
> > > unusual characters in filenames, like accented characters (or perhaps
> > > just to filenames if UTF-8 encoded; I've not explored that fully).
> > The problem is that the client sends it wrong:
> > > Content-Type: application/octet-stream;
> > > name==?UTF-8?B?dGhpc19mYWlscy50eHQ=?=
> > > Content-Disposition: attachment;
> > > filename==?UTF-8?B?dGhpc19mYWlscy50eHQ=?=
> > These are both wrong. First of all they are illegal because they have =
> > and
> ? characters, from RFC 2045:
> > ...snip...
> > Also from RFC 2047 (encoded-word is the =?UTF-8?...?= thing):
> > > + An 'encoded-word' MUST NOT be used in parameter of a MIME
> > > Content-Type or Content-Disposition field, or in any structured
> > > field body except within a 'comment' or 'phrase'.
> > ...snip...
> > Anyway .. I'll check tomorrow if I can easily add code to workaround your
> > problem. If it's just a minor change I'll do it.
> Wow - a very thorough response only 45 minutes after I'd posted the
> question, and in your follow up message you've already provided a
> suggested fix - a huge thank you!
> So in summary it's a "Garbage in -> Garbage out" issue... This also
> explains why I'm only getting this issue with one client after a
> Courier->Dovecot migration. I'll research which mail client program(s) are
> generating the faulty messages for completeness for this thread.
> I expect to test the fix later today or tomorrow, I'll update the thread
> accordingly when I've done so.
Firstly, my apologies - it's been a week before I've got back to this - I was
making sense of another MIME issue which I thought might be related (it
isn't), but I'll start a new thread for that.
The fix works just fine. However...
...regarding the broken MIME fields: These look to occur in the form I noted
for a single client program only, which on further investigation turns out to
be an in-house[-written] mail program of my client, and therefore this problem
is unlikely to bite other people: I've had permission to search the client's
mailboxes for similar non-conforming emails and they only occur for this one
in-house mail program.
Summary: False alarm. However once again a huge thank-you to Timo for the
patch to workaround this broken data.
More information about the dovecot