[Dovecot] IMAP separator migration

ian+dovecot at comtek.co.uk ian+dovecot at comtek.co.uk
Fri Jan 28 22:50:05 EET 2011


> Then you can have userdb set namespace/default/separator=/,
> namespace/others/separator=/ and namespace/pub/separator=/. Or a
> post-login script to set those in environment.


Thanks, this seems to work fine. In the interests of providing closure 
(for somebody trawling through mailing list archives with the same goal) 
I have:

namespace _private {
    type = private
    separator = .
    prefix =
    inbox = yes
}
namespace _shared {
    type = shared
    separator = .
    prefix = Users.%%n.
    location = 
maildir:/var/mail/virtual/users/%%n/Maildir/:INDEX=~/shared/%%u
    subscriptions = no
    list = children
}
namespace _public {
    type = public
    separator = .
    prefix = Shared.
    location = maildir:/var/mail/virtual/public:INDEX=~/public
    subscriptions = no
}


and I've created a postlogin script looking like:

~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/sh

case "$USER" in
iantest at example.com|mailtest at example.com)
                   ENV="NAMESPACE/_PRIVATE/SEPARATOR=/ 
NAMESPACE/_SHARED/SEPARATOR=/ NAMESPACE/_PUBLIC/SEPARATOR=/ 
NAMESPACE/_SHARED/PREFIX=Users/%n/ NAMESPACE/_PUBLIC/PREFIX=Shared/";;
                   export USERDB_KEYS="$USERDB_KEYS 
namespace/_private/separator namespace/_shared/separator 
namespace/_public/separator namespace/_shared/prefix 
namespace/_public/prefix"
          *)
                   ENV="";;
esac


exec env $ENV "$@"
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The namespace prefix needs changing too. Note that the %%n seems to have 
been reduced to %n by the time of the postlogin script. The shell seems 
to dislike strange characters in environment variable names so I'm using 
env to set them.

Unmigrated '.' users work. Migrated '/' users work. Migrated users can 
see any user mailboxes. Unmigrated users can only see ones without 
period in them.




More information about the dovecot mailing list