[dovecot-cvs] dovecot-1.0: Fix also ACL file stat() failing with EACCES.

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 12 14:54:12 EEST 2007


details:   http://hg.dovecot.org/dovecot-1.0/rev/6eded4438f44
changeset: 5294:6eded4438f44
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 12 14:54:08 2007 +0300
description:
Fix also ACL file stat() failing with EACCES.

diffstat:

1 file changed, 9 insertions(+), 3 deletions(-)
src/plugins/acl/acl-backend-vfile.c |   12 +++++++++---

diffs (48 lines):

diff -r 69ab5669855a -r 6eded4438f44 src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c	Tue Jun 12 02:01:27 2007 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c	Tue Jun 12 14:54:08 2007 +0300
@@ -22,6 +22,9 @@
 #define ACL_SYNC_SECS 1
 
 #define ACL_ESTALE_RETRY_COUNT NFS_ESTALE_RETRY_COUNT
+
+#define VALIDITY_MTIME_NOTFOUND 0
+#define VALIDITY_MTIME_NOACCESS -1
 
 struct acl_vfile_validity {
 	time_t last_check;
@@ -285,11 +288,13 @@ acl_backend_vfile_read(struct acl_object
 		if (errno == ENOENT) {
 			if (aclobj->backend->debug)
 				i_info("acl vfile: file %s not found", path);
+			validity->last_mtime = VALIDITY_MTIME_NOTFOUND;
 		} else if (errno == EACCES) {
 			if (aclobj->backend->debug)
 				i_info("acl vfile: no access to file %s", path);
 
 			acl_backend_remove_all_access(aclobj);
+			validity->last_mtime = VALIDITY_MTIME_NOACCESS;
 		} else {
 			mail_storage_set_critical(storage,
 						  "open(%s) failed: %m", path);
@@ -297,7 +302,6 @@ acl_backend_vfile_read(struct acl_object
 		}
 
 		validity->last_size = 0;
-		validity->last_mtime = 0;
 		validity->last_read_time = ioloop_time;
 		return 1;
 	}
@@ -417,8 +421,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;
 		mail_storage_set_critical(aclobj->backend->storage,
 					  "stat(%s) failed: %m", path);
 		return -1;


More information about the dovecot-cvs mailing list