[dovecot-cvs] dovecot/src/plugins/acl acl-backend-vfile.c, 1.12, 1.13

tss at dovecot.org tss at dovecot.org
Fri Jan 19 21:59:14 UTC 2007


Update of /var/lib/cvs/dovecot/src/plugins/acl
In directory talvi:/tmp/cvs-serv29134

Modified Files:
	acl-backend-vfile.c 
Log Message:
Moved dovecot-acl file from control dir to mail directory, except with
mboxes. If the file still exists in control dir, Dovecot kills itself
(rather than give full access to the mailbox).



Index: acl-backend-vfile.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/acl/acl-backend-vfile.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- acl-backend-vfile.c	28 Dec 2006 14:47:38 -0000	1.12
+++ acl-backend-vfile.c	19 Jan 2007 21:59:12 -0000	1.13
@@ -103,18 +103,35 @@
 	struct acl_backend_vfile *backend =
 		(struct acl_backend_vfile *)_backend;
 	struct acl_object_vfile *aclobj;
-	const char *control_dir;
-
-	control_dir =
-		mail_storage_get_mailbox_control_dir(_backend->storage, name);
+	const char *control_dir, *dir;
+	bool is_file;
 
 	aclobj = i_new(struct acl_object_vfile, 1);
 	aclobj->aclobj.backend = _backend;
 	aclobj->aclobj.name = i_strdup(name);
 	aclobj->global_path = *backend->global_dir == '\0' ? NULL :
 		i_strconcat(backend->global_dir, "/", name, NULL);
-	aclobj->local_path =
-		i_strconcat(control_dir, "/"ACL_FILENAME, NULL);
+
+	control_dir =
+		mail_storage_get_mailbox_control_dir(_backend->storage, name);
+	dir = mail_storage_get_mailbox_path(_backend->storage, name, &is_file);
+	if (is_file) {
+		/* use control directory with mboxes */
+		dir = control_dir;
+	} else {
+		/* FIXME: this is only for making sure people won't upgrade
+		   improperly. remove this check some day. */
+		const char *path;
+		struct stat st;
+
+		path = t_strconcat(control_dir, "/"ACL_FILENAME, NULL);
+		if (stat(path, &st) == 0) {
+			i_fatal("%s is no longer kept in control directory, "
+				"move it to the actual maildir (%s)",
+				path, dir);
+		}
+	}
+	aclobj->local_path = i_strconcat(dir, "/"ACL_FILENAME, NULL);
 	return &aclobj->aclobj;
 }
 



More information about the dovecot-cvs mailing list