[Dovecot] Pine and prefix - LIST command bug?

Chris Wakelin c.d.wakelin at reading.ac.uk
Wed Mar 30 20:40:24 EEST 2005


On Mon, 28 Mar 2005 12:20:48 +0100 Chris Wakelin 
<c.d.wakelin at reading.ac.uk> wrote:

...

> I've just tried it, and the same happens; PC-Pine (this time) is trying
> 
> LIST "" ~/mail/
> 
> and getting no matches, then when you answer yes to the question "Exit, 
> saving changes and creating path?" it tries
> 
> CREATE ~/mail/
> 
> which presumably fails. It then disconnects with "IMAP connection broken 
> (server response)".
> 
> It looks like Dovecot is crashing on the "CREATE" command:
> 
> dovecot: Mar 28 12:14:59 Error: IMAP(vis99003): file strfuncs.c: line 
> 165 (p_strndup): assertion failed: (max_chars != (size_t)-1)
> dovecot: Mar 28 12:14:59 Error: child 28188 (imap) killed with signal 6
> 

I've found the problem, I think :-

gdiff -ruN cmd-create.c.orig cmd-create.c
--- cmd-create.c.orig   Mon Jan 31 16:37:54 2005
+++ cmd-create.c        Wed Mar 30 18:26:56 2005
@@ -20,6 +20,13 @@
                return TRUE;

        len = strlen(mailbox);
+
+        /* If supplied mailbox is namespace prefix then len=0; exit if so */
+       if (len == 0) {
+               client_send_tagline(client, "OK if it makes you happy.");
+               return TRUE;
+       }
+
        if (mailbox[len-1] != mail_storage_get_hierarchy_sep(storage))
                directory = FALSE;
        else {

In the "len = strlen(mailbox);", len will be 0 if the supplied mailbox 
- after "client_find_storage(client, &mailbox)" - was a namespace 
prefix. That causes "mailbox = t_strndup(mailbox, len-1)" to fail.

What I don't understand is why CREATE "#maildir/" seems not to crash, 
(where "#maildir/" is another namespace prefix) when CREATE "mail/" 
does, though!

It makes Pine moderately happy at last. It might still be better to 
respond as it expects to the LIST "" ~/mail/ command.

Best Wishes,
Chris

--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--
Christopher Wakelin,                                c.d.wakelin at reading.ac.uk
IT Services Centre, The University of Reading,       Tel: +44 (0)118 378 8439
Whiteknights, Reading, RG6 2AF, UK                   Fax: +44 (0)118 975 3094




More information about the dovecot mailing list