From: Timo Sirainen Date: Mon, 22 Jun 2009 04:29:13 +0000 (-0400) Subject: imap-acl: Handle empty rights (no rights) properly. X-Git-Tag: 2.0.alpha1~547 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=411f318ed3a25fa66c1b932e10df43841e2725c9;p=thirdparty%2Fdovecot%2Fcore.git imap-acl: Handle empty rights (no rights) properly. --HG-- branch : HEAD --- diff --git a/src/plugins/imap-acl/imap-acl-plugin.c b/src/plugins/imap-acl/imap-acl-plugin.c index 572db6e0ee..4b527bb19a 100644 --- a/src/plugins/imap-acl/imap-acl-plugin.c +++ b/src/plugins/imap-acl/imap-acl-plugin.c @@ -103,7 +103,7 @@ static void imap_acl_write_rights_list(string_t *dest, const char *const *rights) { const struct imap_acl_letter_map *map; - unsigned int i; + unsigned int i, orig_len = str_len(dest); bool append_c = FALSE, append_d = FALSE; for (i = 0; rights[i] != NULL; i++) { @@ -121,6 +121,8 @@ imap_acl_write_rights_list(string_t *dest, const char *const *rights) str_append_c(dest, 'c'); if (append_d) str_append_c(dest, 'd'); + if (orig_len == str_len(dest)) + str_append(dest, "\"\""); } static void @@ -547,19 +549,7 @@ static bool cmd_setacl(struct client_command_context *cmd) return TRUE; } - if (r->rights[0] == NULL) { - if (negative) { - update.modify_mode = 0; - update.rights.rights = NULL; - update.neg_modify_mode = ACL_MODIFY_MODE_CLEAR; - update.rights.neg_rights = NULL; - } else { - update.modify_mode = ACL_MODIFY_MODE_CLEAR; - update.rights.rights = NULL; - update.neg_modify_mode = 0; - update.rights.neg_rights = NULL; - } - } else if (negative) { + if (negative) { update.neg_modify_mode = update.modify_mode; update.modify_mode = ACL_MODIFY_MODE_REMOVE; update.rights.neg_rights = update.rights.rights;