From: Magnus Holmgren Date: Thu, 31 May 2007 12:41:49 +0000 (+0000) Subject: Bug #503: Use Ulstat() instead of Ustat() in dsearch lookup. X-Git-Tag: exim-4_68~44 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/0f2cbd1b451dd142a372b6b0985c4ce2f37c04eb Bug #503: Use Ulstat() instead of Ustat() in dsearch lookup. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index d292d99ec..d3ee4bc16 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.509 2007/05/17 19:58:48 tom Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.510 2007/05/31 12:41:49 magnus Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -38,6 +38,13 @@ MH/01 The "spam" ACL condition code contained a sscanf() call with a %s TK/02 Bugzilla 502: Apply patch to make the SPF-Received: header use $primary_hostname instead of what libspf2 thinks the hosts name is. +MH/02 The dsearch lookup now uses lstat(2) instead of stat(2) to look for + a directory entry by the name of the lookup key. Previously, if a + symlink pointed to a non-existing file or a file in a directory that + Exim lacked permissions to read, a lookup for a key matching that + symlink would fail. Now it is enough that a matching directory entry + exists, symlink or not. (Bugzilla 503.) + Exim version 4.67 ----------------- diff --git a/src/src/lookups/dsearch.c b/src/src/lookups/dsearch.c index 38bedc28c..ecdf242a0 100644 --- a/src/src/lookups/dsearch.c +++ b/src/src/lookups/dsearch.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/lookups/dsearch.c,v 1.4 2007/01/08 10:50:19 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/dsearch.c,v 1.5 2007/05/31 12:42:07 magnus Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -8,8 +8,8 @@ /* See the file NOTICE for conditions of use and distribution. */ /* The idea for this code came from Matthew Byng-Maddick, but his original has -been heavily reworked a lot for Exim 4 (and it now uses stat() rather than a -directory scan). */ +been heavily reworked a lot for Exim 4 (and it now uses stat() (more precisely: +lstat()) rather than a directory scan). */ #include "../exim.h" @@ -24,7 +24,7 @@ directory scan). */ /* See local README for interface description. We open the directory to test whether it exists and whether it is searchable. However, we don't need to keep -it open, because the "search" can be done by a call to stat() rather than +it open, because the "search" can be done by a call to lstat() rather than actually scanning through the list of files. */ void * @@ -64,7 +64,7 @@ return lf_check_file(-1, filename, S_IFDIR, modemask, owners, owngroups, * Find entry point * *************************************************/ -/* See local README for interface description. We use stat() instead of +/* See local README for interface description. We use lstat() instead of scanning the directory, as it is hopefully faster to let the OS do the scanning for us. */ @@ -93,7 +93,7 @@ if (!string_format(filename, sizeof(filename), "%s/%s", dirname, keystring)) return DEFER; } -if (Ustat(filename, &statbuf) >= 0) +if (Ulstat(filename, &statbuf) >= 0) { *result = string_copy(keystring); return OK; @@ -102,7 +102,7 @@ if (Ustat(filename, &statbuf) >= 0) if (errno == ENOENT) return FAIL; save_errno = errno; -*errmsg = string_sprintf("%s: stat failed", filename); +*errmsg = string_sprintf("%s: lstat failed", filename); errno = save_errno; return DEFER; }