On Tuesday, July 15, 2003, at 10:02 AM, Jeremy Kister wrote:
On Tuesday, July 15, 2003 12:07 PM, Tom Collins wrote:
Please note! vdelivermail should NEVER be used in .qmail-user files --
it should only appear in the .qmail-default file.

I'm not arguing here, just expressing my ignorance... Why?


I currently use things like
|/usr/local/bin/spamc | /home/vpopmail/bin/vdelivermail ''
/home/vpopmail/domains/example.com/username

in my .qmail-user files, when i do not want spamc to be invoked for each
user in the domain....

Based on my understanding, vdelivermail has a somewhat deceptive name.


Many people (myself included) thought it would just accept the mail and do whatever you requested as the last parameter (bounce-no-mailbox, deleted, directory for delivery, etc.).

In reality, vdelivermail uses environment variables set by qmail-local to try to find the appropriate user and deliver the mail to them. It only delivers to the last parameter if it can't find a match.

So, as we learned with the 1.0.19 release of qmailadmin, setting up a user fred with a .qmail file containing vdelivermail would result in an infinite loop of vdelivermail calling itself. Here's how:

qmail-local looks for .qmail-fred in the domain's directory. Since .qmail-fred doesn't exist, qmail-local delivers the message to .qmail-default which contains vdelivermail.

vdelivermail looks for a user fred in the domain's directory. Having found fred, it checks for a .qmail file before just dropping the message in fred's Maildir. Having found a .qmail file, it processes it. The first line of the .qmail file starts with "|", indicating program delivery, so vdelivermail sends the message to the program (which is vdelivermail).

On the second call, vdelivermail once again looks for a user fred in the domain's directory. Having found fred, it checks for a .qmail file... And we're stuck in a loop.

Instead of using vdelivermail, you may need to use maildrop (Jeff Hedlund can provide details on that one) to process the email and drop it in the user's Maildir.

It might be helpful to add another program (vstoremail?) to the vpopmail distribution that would accept a message in STDIN and save it to the Maildir specified as the first parameter. Then it would be possible to have entries in your .qmail file like

|/usr/local/bin/spamc | /home/vpopmail/bin/vstoremail /home/vpopmail/domains/example.com/fred/Maildir/

vstoremail would take care of file locking/naming/etc. and exit with the proper error code.

--
Tom Collins
[EMAIL PROTECTED]
http://sniffter.com/ - info on the Sniffter hand-held Network Tester




Reply via email to