Re: [exim] dsearch produces "stat failed"

Top Page
Delete this message
Reply to this message
Author: Peter Thomassen
Date:  
To: exim-users
Subject: Re: [exim] dsearch produces "stat failed"
Peter Thomassen wrote:
> This leads to the following mainlog message:
>
> temporarily rejected RCPT <test@???>:
> /var/www/vhost/example.org: stat failed


I now found the reason for the error message. /var/www/vhost/ contains
symbolic links to directories that the Exim user is not allowed to read.
When Exim stat()s the file, it seems to follow the link (i.e. lstat())
which fails. If I change permissions in a way that Exim can read the link
target, it works fine.

The behaviour described is not that documented in the specification[1]. I'm
using 4.63, but the specification for 4.67 says the same:
| dsearch: The given file must be a directory; this is searched for a file
| whose name is the key. The key may not contain any forward slash
| characters. The result of a successful lookup is the name of the file.


There is nothing said about any permissions Exim must have for the file
itself; actually, it seems sufficient that Exim can read the directory.

The code (/src/lookups/dsearch.c) says that stat() is used because the OS
scans the directory faster than Exim could. And strangely, I can only find
a stat() call (and not an lstat() call), but the behaviour is like lstat().
Why?

[1]http://www.exim.org/exim-html-4.63/doc/html/spec_html/ch09.html#SECTsinglekeylookups

Peter