[Dovecot] Feature Request

Timo Sirainen tss at iki.fi
Wed Oct 10 05:50:15 EEST 2012


On 10.10.2012, at 5.40, Marc Perkel wrote:

>>> It would be handy (for me) if there were a userdb where a directory structure defined the db.
>>> 
>>> userdb stat {
>>>   mail_location=maildir:/fakedir/%d/%n:INBOX=/email/%d/%n:LAYOUT=fs
>>> }
>>> 
>>> userdb stat {
>>>   mail_location=maildir:/email/%d/%n:INBOX=/email/%d/%n:LAYOUT=fs
>>> }
>>> 
>>> The idea being that if the first directory doesn't exist then it will try the second one.
>> You could already implement this as userdb checkpassword script.
> 
> Can you give me an example?

Something like this:

userdb {
  driver = checkpasword
  args = /usr/local/bin/userdb.sh
}

/usr/local/bin/userdb.sh:

#!/bin/sh

path=/fakedir/$AUTH_DOMAIN/$AUTH_USERNAME
if [ -d $path ]; then
  MAIL=maildir:$path:INBOX=/email/$AUTH_DOMAIN/$AUTH_USERNAME:LAYOUT=fs
  EXTRA=mail
  AUTHORIZED=2
  exec "$@"
fi

exit 1

(I'm not sure if the MAIL/mail should be USERDB_MAIL/userdb_mail instead. Probably not.)


More information about the dovecot mailing list