From bd2b326267f9fcaeee8455c581394eabcf377759 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 7 Jul 2009 22:52:01 -0400 Subject: [PATCH] acl: dovecot-acl file caching fixes. --HG-- branch : HEAD --- src/plugins/acl/acl-backend-vfile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/acl/acl-backend-vfile.c b/src/plugins/acl/acl-backend-vfile.c index b15634b72a..62366e3207 100644 --- a/src/plugins/acl/acl-backend-vfile.c +++ b/src/plugins/acl/acl-backend-vfile.c @@ -584,6 +584,7 @@ acl_backend_vfile_refresh(struct acl_object *aclobj, const char *path, struct acl_backend_vfile *backend = (struct acl_backend_vfile *)aclobj->backend; struct stat st; + int ret; if (validity == NULL) return 1; @@ -592,7 +593,14 @@ acl_backend_vfile_refresh(struct acl_object *aclobj, const char *path, return 0; validity->last_check = ioloop_time; - if (stat(path, &st) < 0) { + ret = stat(path, &st); + if (ret == 0 && S_ISDIR(st.st_mode)) { + /* it's a directory. use dir/.DEFAULT instead */ + path = t_strconcat(path, "/.DEFAULT", NULL); + ret = stat(path, &st); + } + + if (ret < 0) { if (errno == ENOENT || errno == ENOTDIR) { /* if the file used to exist, we have to re-read it */ return validity->last_mtime != VALIDITY_MTIME_NOTFOUND; -- 2.47.3