dovecot-2.0: acl: Don't crash if opening dovecot-acl fails with ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Mar 16 21:39:57 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/6b03aee63752
changeset: 10936:6b03aee63752
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Mar 16 21:39:47 2010 +0200
description:
acl: Don't crash if opening dovecot-acl fails with EACCES.

diffstat:

 src/plugins/acl/acl-backend-vfile.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (37 lines):

diff -r 1de4b554c914 -r 6b03aee63752 src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c	Tue Mar 16 21:04:59 2010 +0200
+++ b/src/plugins/acl/acl-backend-vfile.c	Tue Mar 16 21:39:47 2010 +0200
@@ -456,14 +456,19 @@
 	return 0;
 }
 
-static void acl_backend_remove_all_access(struct acl_object *aclobj)
+static void acl_backend_remove_all_access(struct acl_object_vfile *aclobj)
 {
-	struct acl_rights_update rights;
+	static const char *null = NULL;
+	struct acl_rights rights;
 
 	memset(&rights, 0, sizeof(rights));
-	rights.rights.id_type = ACL_ID_ANYONE;
-	rights.modify_mode = ACL_MODIFY_MODE_REPLACE;
-	acl_cache_update(aclobj->backend->cache, aclobj->name, &rights);
+	rights.id_type = ACL_ID_ANYONE;
+	rights.rights = &null;
+	array_append(&aclobj->rights, &rights, 1);
+
+	rights.id_type = ACL_ID_OWNER;
+	rights.rights = &null;
+	array_append(&aclobj->rights, &rights, 1);
 }
 
 static int
@@ -491,7 +496,7 @@
 				i_debug("acl vfile: no access to file %s",
 					path);
 
-			acl_backend_remove_all_access(&aclobj->aclobj);
+			acl_backend_remove_all_access(aclobj);
 			validity->last_mtime = VALIDITY_MTIME_NOACCESS;
 		} else {
 			i_error("open(%s) failed: %m", path);


More information about the dovecot-cvs mailing list