On Wed, 2006-05-10 at 12:51 +0200, Mij wrote:
$HOME_LOCUSER depends on the domain part of the user's email. The
relation is held in /var/qmail/control/virtualdomains . However, on the local part (virtual_username) some rewriting is done
on the username, as dots are replaced by ":". So in the end j.doe@foo.com becomes "~mxfoocom/users/j:doe".Now, var-expand does not support any rewriting. I patched it by
adding another modifier, m_str_replace(), which replaces REPLACE_SOURCE with
REPLACE_TARGET in a given string. By defining REPLACE_SOURCE to '.' and
REPLACE_TARGET to ':' one accomplishes the vmailmgr username rewriting. This modifier is
applied with "P", so: default_mail_env = maildir:%h/users/%Pn
Could you change the dots in the username already in auth_username_translation? If vmailmgr expects them as '.' you could change them back to ':' in your script. A bit ugly, yes :)
A better, general solution would be for dovecot to implement some
kind of general rewriting, say with regexps and sed-like replacement rules, or with
an external process in a cgi fashion.
Hmm.. Actually I think it's already possible for you to return a new username in the checkpassword script by setting USER environment. You might need "EXTRA=USER" environment too.
With this patch, dovecot gets the correct path for any user mailbox.
However, there's a bug in dovecot storage modules (both maildir and mbox) which truncates
the path in the first ":", when expecting ":INBOX" etc specifiers:
Yes.. However I'm not sure if I want to do anything about this. I just didn't expect usernames to contain ':' characters, and adding extra checks to make this sort-of-work just feels like it's going to break at some point, more or less worse.
In Dovecot 2.0 framwork I already got rid of the ':' characters completely by making INBOX, INDEX, etc. separate settings.
I guess I could give the "Maildir" parameter to checkpassword script anyway always.