]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-acl: Fixed handling SETACL with empty rights.
authorTimo Sirainen <tss@iki.fi>
Fri, 20 Feb 2009 20:35:43 +0000 (15:35 -0500)
committerTimo Sirainen <tss@iki.fi>
Fri, 20 Feb 2009 20:35:43 +0000 (15:35 -0500)
Patch by Bernhard Herzog.

--HG--
branch : HEAD

src/plugins/imap-acl/imap-acl-plugin.c

index d83b7ee23ff23fbc9daea454e058ec2006a999e4..e4f5abea27215e9d4927cc399f61ffe963b0b8ea 100644 (file)
@@ -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;