[Dovecot] bug uni_utf8_str_is_valid(vname)

Timo Sirainen
2012-03-14T14:29:15Z

On Tue, 2012-03-06 at 14:28 +0100, Jernej Porenta wrote:
> Heya,
>
> We are expiriencing issues with dovecot 2.1.1 on Linux with weird
> filenames in home directory of username. We are using mbox IMAP
> folders, with no special changes (mail_location = mbox:~/:INBOX=%
> h/.mailbox).
>
> Mar  6 13:37:17 machine dovecot: imap(username): Panic: file
> mail-storage.c: line 628 (mailbox_alloc): assertion failed:
> (uni_utf8_str_is_valid(vname))
..
> AFAIK, the problem lies in processing the file list of home folder,
> which can contain filenames that do not have proper UTF-8 encoding of
> filenames, which causes dovecot to crash.

Yes, Dovecot shouldn't crash even if there are non-UTF8 mailboxes. This
should fix it by renaming such mailboxes:
http://hg.dovecot.org/dovecot-2.1/rev/c077ca9bc306

> On the other hand, UTF-8 filenames created on the system by hand
> (using touch), are not displayed in IMAP LIST command (sample is
> included in the folder structure; single letter file).

This is a bit trickier problem. The mailbox names are currently stored
in filesystem as IMAP's modified-UTF7. So it's not really even currently
supposed to work, although it's not very nice that the mailboxes aren't
visible either. Maybe I'll do something smart in future for this, like
allowing both mUTF-7 and UTF-8 and remembering per-mailbox which
formatting it is in.