procmail
[Top] [All Lists]

Re: detecting failure to chdir() to $MAILDIR

1997-05-15 14:25:00
On Thu, 15 May 1997 13:06:42 -0400,
Roderick Schertler <roderick(_at_)argon(_dot_)org> wrote:
On Thu, 15 May 1997 10:54:20 +0300 (EET DST), era eriksson
<reriksso(_at_)cc(_dot_)helsinki(_dot_)fi> said:
Well, you can test for the mere existence of the directory and see if
you have execute permission on it. It should mean the same thing, [...]
For practical purposes it will mean the same thing, but it's a bad habit
to get in to.  The race condition inherent in test-then-use is probably
the second most common security culprit on today's Internet.  It's a
habit that none of us can afford to have.

Okay, how about 

    # If this succeeds it means you should already be in MAILDIR
    :0
    * ! ? cd "$MAILDIR"
    { EXITCODE=$EX_OOOPS HOST }

If you're afraid the directory might suddenly disappear, I'm afraid I
don't see how `pwd` or anything else could be 100% bulletproof either.
(You could perhaps deliver via a script which would always check for
the presence of your destination file but what if the partition the
script is on suddenly breaks down, or whatever. Another idea would be
to always include a :E fallback for all critical recipes, perhaps
writing to /tmp if the first attempt at delivery fails.)

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

<Prev in Thread] Current Thread [Next in Thread>