dovecot-1.2: acl: Update acl_dict correctly also for other visib...

dovecot at dovecot.org dovecot at dovecot.org
Fri Nov 21 17:42:04 EET 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/4553e28eb4f5
changeset: 8466:4553e28eb4f5
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Nov 21 17:41:59 2008 +0200
description:
acl: Update acl_dict correctly also for other visible users' shared namespaces.

diffstat:

1 file changed, 8 insertions(+), 4 deletions(-)
src/plugins/acl/acl-lookup-dict.c |   12 ++++++++----

diffs (43 lines):

diff -r 027a61241ebb -r 4553e28eb4f5 src/plugins/acl/acl-lookup-dict.c
--- a/src/plugins/acl/acl-lookup-dict.c	Fri Nov 21 17:41:30 2008 +0200
+++ b/src/plugins/acl/acl-lookup-dict.c	Fri Nov 21 17:41:59 2008 +0200
@@ -112,7 +112,7 @@ static int acl_lookup_dict_rebuild_add_b
 	string_t *id;
 	int ret, ret2 = 0;
 
-	if ((ns->flags & NAMESPACE_FLAG_INTERNAL) != 0)
+	if ((ns->flags & NAMESPACE_FLAG_INTERNAL) != 0 || ns->owner == NULL)
 		return 0;
 
 	id = t_str_new(128);
@@ -126,6 +126,8 @@ static int acl_lookup_dict_rebuild_add_b
 			if (acl_rights_has_nonowner_lookup_changes(&rights)) {
 				str_truncate(id, 0);
 				acl_lookup_dict_write_rights_id(id, &rights);
+				str_append_c(id, '/');
+				str_append(id, ns->owner);
 				id_dup = t_strdup(str_c(id));
 				array_append(ids, &id_dup, 1);
 			}
@@ -154,7 +156,11 @@ acl_lookup_dict_rebuild_update(struct ac
 	unsigned int prefix_len;
 	int ret;
 
-	/* get all existing identifiers for the user */
+	/* get all existing identifiers for the user. we might be able to
+	   sync identifiers also for other users whose shared namespaces we
+	   have, but it's possible that the other users have other namespaces
+	   that aren't visible to us, so we don't want to remove anything
+	   that could break them. */
 	t_array_init(&old_ids_arr, 128);
 	prefix = DICT_PATH_SHARED DICT_SHARED_BOXES_PATH;
 	prefix_len = strlen(prefix);
@@ -194,8 +200,6 @@ acl_lookup_dict_rebuild_update(struct ac
 			/* new identifier, add it */
 			str_truncate(path, prefix_len);
 			str_append(path, new_ids[newi]);
-			str_append_c(path, '/');
-			str_append(path, username);
 			dict_set(dt, str_c(path), "1");
 			newi++;
 		} else if (!no_removes) {


More information about the dovecot-cvs mailing list