changeset 9208:5d1a52e8d320 HEAD

acl: dovecot-acl file caching fixes.
author Timo Sirainen <tss@iki.fi>
date Tue, 07 Jul 2009 22:52:01 -0400
parents bf4f542ec6df
children 76cff789dae2
files src/plugins/acl/acl-backend-vfile.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/acl/acl-backend-vfile.c	Tue Jul 07 22:37:42 2009 -0400
+++ b/src/plugins/acl/acl-backend-vfile.c	Tue Jul 07 22:52:01 2009 -0400
@@ -583,6 +583,7 @@
 	struct acl_backend_vfile *backend =
 		(struct acl_backend_vfile *)aclobj->backend;
 	struct stat st;
+	int ret;
 
 	if (validity == NULL)
 		return 1;
@@ -591,7 +592,14 @@
 		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;