[Dovecot] Shared folders plans for the future

Timo Sirainen tss at iki.fi
Tue Oct 24 18:24:46 UTC 2006


So while driving for several hours in my car recently and having nothing
else to do, I started thinking how they could be done.

I think the "public folders" configuration will stay as it is now. Does
it really even need anything else? The problematic case is how the users
can share their mailboxes to other users. There are two problems related
to it:

1) How to get (quickly) a list of another user's mailboxes that I have
access to?

2) How to get quickly a list of all users who have mailboxes that I have
access to?

The 1) problem is easier to solve. Create a directory listing all the
mailboxes that are shared to at least someone (have ACLs set). It could
be configured like:

namespace shared {
  # IMAP namespace prefix, %u expands to shared user
  prefix = user/%u/
  # Directory containing symlinks to user's all shared mailboxes
  share_dir = ~/Maildir/shared
  # Where to store indexes for other users' accessed mailboxes
  index_dir = ~/Maildir/others-indexes
}

The ~/Maildir/shared directory could then contain symlinks to all the
shared mailboxes. The directory list could probably be in Maildir++
layout even though the symlinks would point to mboxes. This requires
adding code that can handle mixed maildir/mbox directories, but it'll
come anyway..

The 2) problem is more difficult. There are 3 choices:

a) Use a shared database file. lib-dict could be used for this, so the
database could be in SQL or in a berkeley db file. The downside to this
is that the file needs to be readable and writable to everyone, so if
users have shell access the users could break the file.

They dictionary would contain data in format
"<destination_user>/<sharing_user>" = 1 and
"<destination_group>/<sharing_user>" = 1, ie. the value would be ignored
and only the existence of the keys would be important. Then iterating
through "<my_username>/*" and "<all_my_groups>/*" would list the users
who probably have mailboxes where I have access to.

b) Use a directories with sticky bit set. Well, basically the same idea
as in a), except filesystem would be used. Actually perhaps this could
be made another lib-dict backend..

c) Brute force: Just assume everyone potentially have shared mailboxes.
Get the list of users by readdir()ing through /home (configurable).

I guess each of these could be made an option.. So something like:

namespace shared {
  ..
  # a)
  shared_dict = db:/var/lib/dovecot/shared-mailboxes.db
  # b)
  shared_dict = dir:/var/lib/dovecot/shared-mailboxes
  # c)
  shared_dict = bruteforce:/home
}

I'm currently also implementing a "mailbox list index", which contains a
list of all the user's mailboxes and some useful metadata for them, such
as number of messages and so on. So that STATUS command wouldn't need to
open the mailbox index files if they haven't changed.

The mailbox list index updating is normally done when directory's mtime
has changed. For list of shared users that would also work in 2b) and
2c) cases, but for 2a) I'd either have to always sync everything or
alternatively add some sequence/<dest_user/group>=# value which is grown
for each update, and the syncing is done only when the sequence is
updated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20061024/7198d0c4/attachment.pgp 


More information about the dovecot mailing list