From dd71e3d8d6284a4f80ddf010ee4316f688169b58 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 20 Feb 2009 15:35:43 -0500 Subject: [PATCH] imap-acl: Fixed handling SETACL with empty rights. Patch by Bernhard Herzog. --HG-- branch : HEAD --- src/plugins/imap-acl/imap-acl-plugin.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/imap-acl/imap-acl-plugin.c b/src/plugins/imap-acl/imap-acl-plugin.c index d83b7ee23f..e4f5abea27 100644 --- a/src/plugins/imap-acl/imap-acl-plugin.c +++ b/src/plugins/imap-acl/imap-acl-plugin.c @@ -375,7 +375,7 @@ static bool cmd_setacl(struct client_command_context *cmd) bool negative = FALSE; if (!client_read_string_args(cmd, 3, &mailbox, &identifier, &rights) || - *identifier == '\0' || *rights == '\0') { + *identifier == '\0') { client_send_command_error(cmd, "Invalid arguments."); return TRUE; } @@ -414,7 +414,19 @@ static bool cmd_setacl(struct client_command_context *cmd) if (box == NULL) return TRUE; - if (negative) { + if (update.rights.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) { update.neg_modify_mode = update.modify_mode; update.modify_mode = ACL_MODIFY_MODE_REMOVE; update.rights.neg_rights = update.rights.rights; -- 2.47.3