Le 22 juil. 2013 à 19:31, Cedric a écrit :
Hi,
There's the information again :
I use sendmail with dovecot-lda delivery :
Mvirtual, P=/vdl/libexec/dovecot/dovecot-lda, F=lsDFMShP, S=10, R=20/40, A=/vdl/libexec/dovecot/dovecot-lda -d $u@$h
Ha... So, there are still people using Sendmail for new installations. ;-) Sorry, I don't know why I have thought about postfix. My memories about Sendmail are very, very tiny, so I'll assume the above is correct (doesn't seem too audacious, given the lines with "to=test@mail.vdl ... mailer=virtual" written by Sendmail in the log).
Please find hereafter my quick interpretation of what's happening when sending a message to "test@mail.vdl" (note that the same description should apply for a message to "cedrict@mail.vdl" as well).
The current query :
user_query = SELECT
s_courriel_utilisateur.utilisateur as user, \
According to the query output you provide below, you are replacing here "test@mail.vdl" by "cedrict@mail.vdl"
s_courriel_utilisateur.utilisateur as username, \
and here "test" by "cedrict"
s_courriel_domaine.nom as domain, \
and here "mail.vdl" by NULL? Or something like that. Anyway, those substitutions should explain the "username changed test@mail.vdl -> cedrict" and "cedrict -> cedrict@mail.vdl" infos in the log. The problem is, the effect of such substitutions isn't really defined in a user_query: at best they don't do anything, at worse they may lead to strange interpretations of %n, %u, %d in doevecot.conf.
concat("/vhome/",s_courriel_domaine.nom,"/home/",s_courriel_utilisateur.utilisateur) as home,
concat("/vhome/",s_courriel_domaine.nom,"/home/",s_courriel_utilisateur.utilisateur,"/mail/index") as "index",
concat("/vhome/",s_courriel_domaine.nom,"/home/",s_courriel_utilisateur.utilisateur,"/mail/control") as control,
concat("/var/spool/vmail/",s_courriel_domaine.nom,"/",s_courriel_utilisateur.utilisateur) as inbox, \
Not sure, but I think you are trying to split into three pieces (index, control, inbox) what Dovecot expects to be returned as a single column "mail" (which, when not NULL, overrides mail_location) from a user_query.
"maildir++" as layout, \
Is this OK in the context of a user_query?
s_courriel_utilisateur.uid as uid,s_courriel_domaine.gid as gid \
FROM s_courriel_utilisateur left join s_courriel_alias on s_courriel_utilisateur.id=s_courriel_alias.utilisateur and s_courriel_alias.archive !=1 ,s_courriel_domaine
WHERE s_courriel_utilisateur.archive !=1
and s_courriel_domaine.archive !=1
and s_courriel_utilisateur.domaine=s_courriel_domaine.id
and s_courriel_domaine.nom = '%Ld'
and ( s_courriel_utilisateur.utilisateur = '%Ln' or s_courriel_alias.alias = '%Ln' )The query, including the output :
[...] *************************** 1. row *************************** user: cedrict@mail.vdl username: cedrict home: /vhome/mail.vdl/home/cedrict index: /vhome/mail.vdl/home/cedrict/mail/index control: /vhome/mail.vdl/home/cedrict/mail/control inbox: /var/spool/vmail/mail.vdl/cedrict layout: maildir++ uid: 60001
The dovecot log , you can see dovecot lda deliver the message to inbox=/var/spool/vmail/mail.vdl/test and not inbox=/var/spool/vmail/mail.vdl/cedrict
[root@devshed vdl]# Jul 22 13:29:47 devshed sendmail[32409]: dangerous permissions=40777 on queue directory /var/spool/clientmqueue/ [...] Jul 22 13:29:47 devshed dovecot: auth: Debug: master in: USER 1 test@mail.vdl service=lda [...] Jul 22 13:29:47 devshed dovecot: auth-worker(32406): Debug: auth(test@mail.vdl): username changed test@mail.vdl -> cedrict Jul 22 13:29:47 devshed dovecot: auth-worker(32406): Debug: auth(cedrict): username changed cedrict -> cedrict@mail.vdl Jul 22 13:29:47 devshed dovecot: auth: Debug: userdb out: USER 1 test@mail.vdl home=/vhome/mail.vdl/home/cedrict index=/vhome/mail.vdl/home/cedrict/mail/index control=/vhome/mail.vdl/home/cedrict/mail/control inbox=/var/spool/vmail/mail.vdl/cedrict layout=maildir++ uid=60001 gid=231 Jul 22 13:29:47 devshed dovecot: lda: Debug: auth input: test@mail.vdl home=/vhome/mail.vdl/home/cedrict index=/vhome/mail.vdl/home/cedrict/mail/index control=/vhome/mail.vdl/home/cedrict/mail/control inbox=/var/spool/vmail/mail.vdl/cedrict layout=maildir++ uid=60001 gid=231 Jul 22 13:29:47 devshed dovecot: lda: Debug: Added userdb setting: plugin/control=/vhome/mail.vdl/home/cedrict/mail/control Jul 22 13:29:47 devshed dovecot: lda: Debug: Added userdb setting: plugin/inbox=/var/spool/vmail/mail.vdl/cedrict Jul 22 13:29:47 devshed dovecot: lda: Debug: Added userdb setting: plugin/index=/vhome/mail.vdl/home/cedrict/mail/index Jul 22 13:29:47 devshed dovecot: lda: Debug: Added userdb setting: plugin/layout=maildir++
Note here "plugin/control", "plugin/inbox", "plugin/index" and "plugin/layout": considered as unknown settings and placed into plugin sections.
Jul 22 13:29:47 devshed dovecot: lda(test@mail.vdl): Debug: Effective uid=60001, gid=231, home=/vhome/mail.vdl/home/cedrict Jul 22 13:29:47 devshed dovecot: lda(test@mail.vdl): Debug: quota: No quota setting - plugin disabled Jul 22 13:29:47 devshed dovecot: lda(test@mail.vdl): Debug: maildir++: root=/vhome/mail.vdl/home/cedrict/mail, index=, indexpvt=, control=/vhome/mail.vdl/home/cedrict/mail/control, inbox=/var/spool/vmail/mail.vdl/test, alt=
The home directory is thus the one provided without ambiguity by the user_query. See below for the control and the inbox.
Jul 22 13:29:47 devshed dovecot: lda(test@mail.vdl): Debug: quota: No quota setting - plugin disabled Jul 22 13:29:47 devshed dovecot: lda(test@mail.vdl): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt= Jul 22 13:29:47 devshed dovecot: lda(test@mail.vdl): Debug: Destination address: test@mail.vdl (source: user@hostname)
Dovecot is now a bit lost and seems to revert to "reasonable" guesses: the domain seems to have been lost (hence the hostname), but the original user ("test") is still at hand.
So, there was still a way to find out something, with the help of that line in dovecot.conf:
mail_location = mbox:%h/mail:LAYOUT=maildir++:INDEX=MEMORY:CONTROL=%h/mail/control:INBOX=/var/spool/vmail/%d/%n
[...]
Thank in advance.
HTH, Axel