From: Timo Sirainen Date: Tue, 16 Mar 2010 19:39:47 +0000 (+0200) Subject: acl: Don't crash if opening dovecot-acl fails with EACCES. X-Git-Tag: 2.0.beta4~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9939659b83da15098b22bc8c28f7ffee88b8462d;p=thirdparty%2Fdovecot%2Fcore.git acl: Don't crash if opening dovecot-acl fails with EACCES. --HG-- branch : HEAD --- diff --git a/src/plugins/acl/acl-backend-vfile.c b/src/plugins/acl/acl-backend-vfile.c index a8fb685390..252e4c14c1 100644 --- a/src/plugins/acl/acl-backend-vfile.c +++ b/src/plugins/acl/acl-backend-vfile.c @@ -456,14 +456,19 @@ acl_object_vfile_parse_line(struct acl_object_vfile *aclobj, bool global, 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 @@ acl_backend_vfile_read(struct acl_object_vfile *aclobj, 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);