[Dovecot] Strange behavior from shared namespaces and INBOX, probably a bug

Christoph Bussenius busseniu at in.tum.de
Fri Sep 23 15:13:36 EEST 2011


Hi,

we have experienced some erratic behavior from Dovecot 2.0.15 if a user's INBOX
is shared.

Some folders of user1, including the INBOX, have been shared using these IMAP commands:
. login user1 XXXXXX
. setacl INBOX user2 lrwstiekx
. setacl box-a user2 lrwstiekx

Now if we use telnet to log in as user2 and select "shared/user1", it will contain the same
mails as "shared/user1/INBOX".

The really strange thing is that "SELECT"-ing "shared/user1" succeeds only
if it is the first command afted logging in.  If it not the first
command (if e. g. the "LIST" or "SELECT" command has already been used),
then dovecot will report that the mailbox does not exist.

As a result, user agents like Thunderbird will behave very erratically in this
setup.  They may show both mailboxes ("shared/user1" and
"shared/user1/INBOX") with the same mails, but will not always succeed
to download mails for "shared/user1".

We were able to reproduce this behavior with a quite simple configuration (see
further below), so I doubt that the problem is in the configuration.
So, is this a bug in Dovecot?  I am not quite sure how exactly it should
behave, but it definitely does not seem right this way.

Below are the results from telnet:

Sending:
. login user2 XXXXXX
. select shared/user1
Receiving:
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 5 EXISTS
* 0 RECENT
* OK [UNSEEN 1] First unseen.
* OK [UIDVALIDITY 1316698162] UIDs valid
* OK [UIDNEXT 6] Predicted next UID
* OK [HIGHESTMODSEQ 1] Highest
. OK [READ-WRITE] Select completed.

Sending:
. fetch 1:2 (internaldate rfc822.size)
Receiving:
* 1 FETCH (INTERNALDATE "25-Apr-2006 23:09:07 +0200" RFC822.SIZE 5660)
* 2 FETCH (INTERNALDATE "25-Apr-2006 23:11:01 +0200" RFC822.SIZE 6612)
. OK Fetch completed.

Sending:
. select shared/user1/INBOX
Receiving:
* OK [CLOSED] Previous mailbox closed.
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 5 EXISTS
* 0 RECENT
* OK [UNSEEN 1] First unseen.
* OK [UIDVALIDITY 1316698162] UIDs valid
* OK [UIDNEXT 6] Predicted next UID
* OK [HIGHESTMODSEQ 1] Highest
. OK [READ-WRITE] Select completed.

Sending:
. fetch 1:2 (internaldate rfc822.size)

Receiving:
(Note that these mails are the same as those above)
* 1 FETCH (INTERNALDATE "25-Apr-2006 23:09:07 +0200" RFC822.SIZE 5660)
* 2 FETCH (INTERNALDATE "25-Apr-2006 23:11:01 +0200" RFC822.SIZE 6612)
. OK Fetch completed.

Now we select the first mailbox again:

Sending:
. select shared/user1

Receiving:
. NO Mailbox doesn't exist: shared/user1
* OK [CLOSED] Previous mailbox closed.

The same command did not fail earlier.  Listing the mailboxes shows the
following:

Sending:
. list "" *

Receiving:
* LIST (\HasNoChildren) "/" "INBOX"
* LIST (\Noselect \HasChildren) "/" "shared/user1"
* LIST (\HasNoChildren) "/" "shared/user1/box-a"
* LIST (\HasNoChildren) "/" "shared/user1/INBOX"
. OK List completed.

I can reproduce this behavior using the following setup:
Virtual users on an ext4 filesystem in /mail/users/{user1,user2}
configured in a passwd file (/usr/local/dovecot/etc/dovecot/users):

user1:{plain}XXXXXX:::user1:/mail/users/user1::
user2:{plain}XXXXXX:::user2:/mail/users/user2::

Output of doveconf -n:

# 2.0.15: /usr/local/dovecot/etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-33-server x86_64 Ubuntu 10.04.3 LTS 
disable_plaintext_auth = no
mail_gid = vmail
mail_plugins = acl
mail_uid = vmail
namespace {
  inbox = yes
  location = maildir:~/Maildir
  prefix = 
  separator = /
}
namespace {
  list = children
  location = maildir:%%h/Maildir
  prefix = shared/%%u/
  separator = /
  subscriptions = no
  type = shared
}
passdb {
  args = scheme=CRYPT username_format=%u /usr/local/dovecot/etc/dovecot/users
  driver = passwd-file
}
plugin {
  acl = vfile
  acl_shared_dict = file:/mail/shared-mailboxes
}
protocols = imap
service auth {
  unix_listener auth-userdb {
    group = vmail
    mode = 0660
  }
}
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
userdb {
  args = username_format=%u /usr/local/dovecot/etc/dovecot/users
  driver = passwd-file
}
protocol imap {
  mail_plugins = acl imap_acl
}

Cheers,
Christoph Bußenius

-- 
Christoph Bußenius
Rechnerbetriebsgruppe der Fakultäten Informatik und Mathematik
TU München
+49 89-289-18519 <> Raum 00.05.055 <> Boltzmannstr. 3 <> Garching


More information about the dovecot mailing list