[dovecot-cvs] dovecot: Fix also ACL file stat() failing with EACCES.
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jun 12 14:54:14 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/54c7e74ec973
changeset: 5695:54c7e74ec973
user: Timo Sirainen <tss at iki.fi>
date: Tue Jun 12 14:54:04 2007 +0300
description:
Fix also ACL file stat() failing with EACCES.
diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
src/plugins/acl/acl-backend-vfile.c | 10 ++++++++--
diffs (46 lines):
diff -r 49412bd6b931 -r 54c7e74ec973 src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c Tue Jun 12 02:01:28 2007 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c Tue Jun 12 14:54:04 2007 +0300
@@ -16,6 +16,9 @@
#define ACL_ESTALE_RETRY_COUNT NFS_ESTALE_RETRY_COUNT
#define ACL_VFILE_DEFAULT_CACHE_SECS (60*5)
+
+#define VALIDITY_MTIME_NOTFOUND 0
+#define VALIDITY_MTIME_NOACCESS -1
struct acl_vfile_validity {
time_t last_check;
@@ -305,18 +308,19 @@ acl_backend_vfile_read(struct acl_object
if (errno == ENOENT) {
if (aclobj->aclobj.backend->debug)
i_info("acl vfile: file %s not found", path);
+ validity->last_mtime = VALIDITY_MTIME_NOTFOUND;
} else if (errno == EACCES) {
if (aclobj->aclobj.backend->debug)
i_info("acl vfile: no access to file %s", path);
acl_backend_remove_all_access(&aclobj->aclobj);
+ validity->last_mtime = VALIDITY_MTIME_NOACCESS;
} else {
i_error("open(%s) failed: %m", path);
return -1;
}
validity->last_size = 0;
- validity->last_mtime = 0;
validity->last_read_time = ioloop_time;
return 1;
}
@@ -445,8 +449,10 @@ acl_backend_vfile_refresh(struct acl_obj
if (stat(path, &st) < 0) {
if (errno == ENOENT) {
/* if the file used to exist, we have to re-read it */
- return validity->last_mtime != 0;
+ return validity->last_mtime != VALIDITY_MTIME_NOTFOUND;
}
+ if (errno == EACCES)
+ return validity->last_mtime != VALIDITY_MTIME_NOACCESS;
i_error("stat(%s) failed: %m", path);
return -1;
}
More information about the dovecot-cvs
mailing list