On 08/28/2014 02:26 PM, Eric Shubert wrote:
Thanks for this explanation Rick. Now knowing how this actually works, I think I'll join you in being peeved about it. Not knowing any better, I would have presumed that the user d-q files would have been processed before the domain d-q files. Makes me wonder what the rationale is/was for processing the domain files first.
It has to do with the way vpopmail uses qmail hooks to do its job. When you create the example.com domain, vpopmail modifies the /var/qmail/users/assign database so that qmail-local delivers the mail according to the instructions in ~/vpopmail/domains/example.com . So what reads your .qmail-* files in the domain directory is not vdelivermail, it's simply qmail-local. What vpopmail does is put a vdelivermail invocation in .qmail-default in the domain directory. vdelivermail then extracts the user name, looks it up in its vpasswd database to find the correct directory (most of the time ~vpopmail/domains/example.com/user) and delivers the mail according to the instructions in that directory. If you put a .qmail file in the domain directory, that takes precedence over .qmail-default, then vdelivermail will be bypassed entirely. So don't do that - let vpopmail do its black magic on the domain directory and only use user directories to put your .qmail files into. There are 2 things I'm not satisfied with, but they have nothing to do with the domain-wide .qmail files. The first thing is that vdelivermail duplicates most of the work of qmail-local for parsing .qmail files. It would be much more elegant to have vdelivermail just perform the vpopmail-specific stuff (extract user name, check the vpasswd database, go to user directory) then exec into qmail-local itself. The second thing is that vdelivermail does not make all the black magic transparent: the .qmail files in a user directory cannot be written exactly as if the user was a system user instead of a vpopmail user. I have a program, vsanitize, to be called in .qmail files in vpopmail user directories, that moves around a few environment variables to provide such transparency. -- Laurent !DSPAM:54008ad456445328810183!