]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-quota: Return NO reply if GETQUOTA fails only partially
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 4 Oct 2017 07:44:47 +0000 (10:44 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 4 Oct 2017 09:40:01 +0000 (12:40 +0300)
If the first resource lookup succeeded and the second one failed, the
GETQUOTA command replied with OK instead of NO.

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

index fcab5dc3d6b5cac557a6297b26e46aeaf8c4f194..5bac7a2382c38bde804c644db84c4b4b381e54af 100644 (file)
@@ -61,13 +61,13 @@ quota_reply_write(string_t *str, struct mail_user *user,
                        i++;
                }
        }
-       if (ret <= 0 && str_len(str) == prefix_len) {
+       if (str_len(str) == prefix_len) {
                /* this quota root doesn't have any quota actually enabled. */
                str_truncate(str, orig_len);
-               return ret;
+       } else {
+               str_append(str, ")\r\n");
        }
-       str_append(str, ")\r\n");
-       return 1;
+       return ret < 0 ? -1 : 0;
 }
 
 static bool cmd_getquotaroot(struct client_command_context *cmd)