[Dovecot] Re: 1.0-test39

Andreas Fuchs asf at boinkor.net
Sat Sep 4 17:49:25 EEST 2004


Today, Timo Sirainen <tss at iki.fi> wrote:
> http://dovecot.org/test/
>
> Fixes several crashes. Apparently can still break with mboxes,
> although it works with me..

I decided to give this one a go, and it looks stable. I found some
(apparently) namespace bugs - or bugs in my config, although they look
more like actual bugs in the code (-:

With this namespace configuration:

namespace private {
        separator = .
        prefix = mail.
        inbox = yes
}

I can't CREATE or SELECT mailboxes called "mail.foo.bar.baz": it tells
me that the mailbox "foo.bar.baz" doesn't exist (obviously). I tracked
this down; it seems like cilent_find_storage (or a function below
that) removes the prefix from the mailbox name, which leads to the
breakage I detailed above.

This patch should fix it at least for SELECT and CREATE. I have no
idea if other commands are affected, as well (but I assume they are).

--- dovecot-1.0-test39/src/imap/cmd-create.c    Fri Jul 23 00:59:49 2004
+++ dovecot-1.0-test39.fixed/src/imap/cmd-create.c      Sat Sep  4 16:43:30 2004
@@ -7,12 +7,14 @@
 {
        struct mail_storage *storage;
        const char *mailbox;
+       const char *orig_mailbox;
        int directory;
        size_t len;

        /* <mailbox> */
        if (!client_read_string_args(client, 1, &mailbox))
                return FALSE;
+       orig_mailbox = mailbox;

        storage = client_find_storage(client, &mailbox);
        if (storage == NULL)
@@ -29,7 +31,7 @@
                mailbox = t_strndup(mailbox, len-1);
        }

-       if (!client_verify_mailbox_name(client, mailbox, FALSE, TRUE))
+       if (!client_verify_mailbox_name(client, orig_mailbox, FALSE, TRUE))
                return TRUE;

        if (mail_storage_mailbox_create(storage, mailbox, directory) < 0)
--- dovecot-1.0-test39/src/imap/cmd-select.c    Sat Aug 28 18:06:35 2004
+++ dovecot-1.0-test39.fixed/src/imap/cmd-select.c      Sat Sep  4 16:41:22 2004
@@ -10,10 +10,12 @@
        struct mailbox *box;
        struct mailbox_status status;
        const char *mailbox;
+       const char *orig_mailbox;

        /* <mailbox> */
        if (!client_read_string_args(client, 1, &mailbox))
                return FALSE;
+       orig_mailbox = mailbox;

        if (client->mailbox != NULL) {
                box = client->mailbox;
@@ -28,7 +30,7 @@
        if (storage == NULL)
                return TRUE;

-       box = mailbox_open(storage, mailbox, !readonly ? 0 :
+       box = mailbox_open(storage, orig_mailbox, !readonly ? 0 :
                           (MAILBOX_OPEN_READONLY | MAILBOX_OPEN_KEEP_RECENT));
        if (box == NULL) {
                client_send_storage_error(client, storage);

Bye,
-- 
Andreas Fuchs, <asf at boinkor.net>, asf at jabber.at, antifuchs



More information about the dovecot mailing list