[Dovecot] Sharing user folders doesn't work when users have periods in names.
I am using period as an IMAP separator with Maildir directories and I cannot share folders where the user has a period in their name.
Suppose I log in as 'some.user' and do: SETACL INBOX mailtest@example.co.uk +lrwstipekxacd
/var/mail/virtual/users/some.user/Maildir/dovecot-acl is created, with appropriate contents and shared-mailboxes.db gains an entry for 'shared/shared-boxes/user/mailtest@example.co.uk/some.user@example.co.uk'. mailtest is simply unable to see a new folder.
As mailtest 'a LIST "" "Users.*" ' is empty. If I do ' a MYRIGHTS Users.some.user.INBOX ' I get 'NO [NONEXISTENT] Mailbox doesn't exist: Users.some.user.INBOX' and, oddly, a new maildir appears: '* LIST (\Noselect \HasChildren) "." "Users.some" ' -- it also creates an empty folder structure with a single file /var/mail/virtual/users/some/Maildir/dovecot-acl-list too!
Is there a workaround that does not involve rebuilding every user's Maildir with backslash as a separator?
Thanks,
Ian
On Mon, 2011-01-03 at 15:48 +0000, ian+dovecot@comtek.co.uk wrote:
As mailtest 'a LIST "" "Users.*" ' is empty. If I do ' a MYRIGHTS Users.some.user.INBOX ' I get 'NO [NONEXISTENT] Mailbox doesn't exist: Users.some.user.INBOX' and, oddly, a new maildir appears: '* LIST (\Noselect \HasChildren) "." "Users.some" ' -- it also creates an empty folder structure with a single file /var/mail/virtual/users/some/Maildir/dovecot-acl-list too!
Is there a workaround that does not involve rebuilding every user's Maildir with backslash as a separator?
You don't need to rebuild anything on Dovecot's side to change separator. Just change it. Clients may become confused about that though.
The only other possibility would be to change '.' in usernames to something else. Maybe auth_username_translation could help there.
In any case having '.' both in usernames and as hierarchy separator just isn't going to work.
On 04/01/2011 09:30, Timo Sirainen wrote:
As mailtest 'a LIST "" "Users.*" ' is empty. If I do ' a MYRIGHTS Users.some.user.INBOX ' I get 'NO [NONEXISTENT] Mailbox doesn't exist: Users.some.user.INBOX' and, oddly, a new maildir appears: '* LIST (\Noselect \HasChildren) "." "Users.some" ' -- it also creates an empty folder structure with a single file /var/mail/virtual/users/some/Maildir/dovecot-acl-list too!
Is there a workaround that does not involve rebuilding every user's Maildir with backslash as a separator? You don't need to rebuild anything on Dovecot's side to change separator. Just change it. Clients may become confused about that
On Mon, 2011-01-03 at 15:48 +0000, ian+dovecot@comtek.co.uk wrote: though.
The only other possibility would be to change '.' in usernames to something else. Maybe auth_username_translation could help there.
In any case having '.' both in usernames and as hierarchy separator just isn't going to work. Ah, I understand, thanks.
Has anybody got any tips on migrating IMAP separators? Ideally I'd be able to migrate users incrementally. Is there a way to specify the separator per-user? I can't see a way to do it with a postlogin script or userdb.
http://wiki2.dovecot.org/UserDatabase/ExtraFields shows a namespace setting, but it seems that the namespace is in version 1.2 format and my namespaces look like:
namespace { type = private separator = . prefix = inbox = yes } namespace { type = shared separator = . prefix = Users.%%n. location = maildir:/var/mail/virtual/users/%%n/Maildir/:INDEX=~/shared/%%u subscriptions = no list = children } namespace { type = public separator = . prefix = Shared. location = maildir:/var/mail/virtual/public:INDEX=~/public subscriptions = no }
Thanks,
Ian
--
Ian Crowther Tel: +44 845 4501626 Unit 108, 10th Avenue, IT Dept, Comtek Fax: +44 845 4501627 Zone 3, Deeside Industrial Network Systems UK Ltd Park, CH5 2UA, Flintshire
On Tue, 2011-01-04 at 19:54 +0000, ian+dovecot@comtek.co.uk wrote:
Has anybody got any tips on migrating IMAP separators? Ideally I'd be able to migrate users incrementally. Is there a way to specify the separator per-user? I can't see a way to do it with a postlogin script or userdb.
Both should be possible.
http://wiki2.dovecot.org/UserDatabase/ExtraFields shows a namespace setting, but it seems that the namespace is in version 1.2 format and my namespaces look like:
No, it's for v2.0. You just need to name your namespaces:
namespace {
namespace default {
type = private separator = . prefix = inbox = yes
} namespace {
namespace others {
(I think if you name it "shared", Dovecot thinks it's v1.x configuration and will "convert" it.)
type = shared separator = . prefix = Users.%%n. location =
maildir:/var/mail/virtual/users/%%n/Maildir/:INDEX=~/shared/%%u subscriptions = no list = children } namespace {
namespace pub {
type = public separator = . prefix = Shared. location = maildir:/var/mail/virtual/public:INDEX=~/public subscriptions = no
}
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.
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@example.com|mailtest@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.
participants (3)
-
ian+dovecot@comtek.co.uk
-
ian+dovecot@comtek.co.uk
-
Timo Sirainen