on 4/6/05 6:04 AM, Kyle Wheeler <[EMAIL PROTECTED]> wrote:

> On Wednesday, April  6 at 02:50 AM, quoth danielcm:
>> I don't think it needs to be that complicated, all I have is:
>> | preline yourfilter | /usr/local/bin/maildir.sh  ./Maildir/
>> My maildir.sh file is:
>> exec /usr/bin/safecat "$1"/tmp "$1"/new
>> works for me since the .qmail file is in the users home directory.
> Really? When I check out the environment from one of those .qmail files
> (e.g. by creating a qmail file containing:
> | printenv > /tmp/env
> That file contains the line:
> PWD=/var/lib/vpopmail/domains/memoryhole.net

I had confirmed the behavior he was indicating by doing something like:

    | (pwd; env) > /tmp/info

in the user/.qmail file and it confirmed that indeed the working directory
was set to the user directory, the one containing the ".qmail" file being
executed by vdelivermail.

The env output for me did not include any PWD variable.  I wonder who sets
the PWD variable on your system, and whether it can be relied on to match
what chdir sets.  Maybe this depends on which *nix you are using.

> Indicating that if I directed it to ./Maildir/ it would deliver to
> /var/lib/vpopmail/domains/memoryhole.net/Maildir/ which of course
> doesn't exist.
> Just because the .qmail file is in the user's home directory doesn't
> mean it's PWD is the user's home directory.

Yes, "home directory" is not at all pertinent here, not for virtual domains.

> If vpopmail actually does
> deliver to /var/lib/vpopmail/domains/memoryhole.net/user/Maildir/ when I
> put ./Maildir/ into my user's .qmail file, then it's behaving
> incorrectly. The environment SHOULD be set identically to if the virtual
> user was a real user and qmail was doing the delivery.

The .qmail-whatever files in the domain directory are different.  For them
pwd shows the domain directory as the working directory.  But for the .qmail
file inside the user directory, vdelivermail is taking care of it, and the
vdelivermail.c code reveals that a chdir is done prior to reading the .qmail
file.  In fact it is opened simply via

    fs = fopen(".qmail","r")

The current directory in effect before opening the .qmail file appears to
remain in effect while the file is processed.


Reply via email to