]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: imap-sync - Fix VANISHED response with UID=1
authorSplintermail Dev <dev@splintermail.com>
Wed, 19 May 2021 11:56:13 +0000 (05:56 -0600)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 1 Jun 2021 15:27:46 +0000 (15:27 +0000)
Fixes a bug introduced in 4eb3f6f27, where a UID EXPUNGE 1 command
resulted in a VANSIHED 0:1 response, which is invalid IMAP syntax
(sequence sets must have nonzero values).

src/imap/imap-sync.c

index 13b61017870eee6104898e2ea78d053de08ec4af..fc49ae7230a30345983e3a6b1ba6104b86fd0d0f 100644 (file)
@@ -430,7 +430,7 @@ static void imap_sync_vanished(struct imap_sync_context *ctx)
                start_uid = 0; prev_uid = 0;
                for (seq = seqs[i].seq1; seq <= seqs[i].seq2; seq++) {
                        mail_set_seq(ctx->mail, seq);
-                       if (prev_uid != ctx->mail->uid - 1) {
+                       if (prev_uid == 0 || prev_uid + 1 != ctx->mail->uid) {
                                if (start_uid != 0) {
                                        if (!comma)
                                                comma = TRUE;