Skip to content

Commit 5e5970b

Browse files
committed
net_imap: Fix flag and quota issues with APPEND.
* Explicitly pass in the appenddir to parse_flags_string, rather than using the default imap->dir, which is not correct, and could result in soft assertions in parse_keyword() if the APPEND command was used without a mailbox selected. Worse, if a mailbox was selected, then we would append keywords to the wrong mailbox. * Add the message size to quota usage, rather than subtracting it! LBBS-148 #close
1 parent d75a023 commit 5e5970b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nets/net_imap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,7 @@ static int process_append(struct imap_session *imap, const char *appenddir, cons
23842384
/* It's too late to stat now as a fallback, the file's gone, who knows how big it was now. */
23852385
mailbox_invalidate_quota_cache(imap->mbox);
23862386
} else {
2387-
mailbox_quota_adjust_usage(imap->mbox, (int) -size);
2387+
mailbox_quota_adjust_usage(imap->mbox, (int) size);
23882388
}
23892389

23902390
if (!strlen_zero(appenddate)) {
@@ -2531,7 +2531,7 @@ static int handle_append(struct imap_session *imap, char *s)
25312531
/* We have flags */
25322532
flags = parensep(&s);
25332533
if (!strlen_zero(flags)) {
2534-
appendflags = parse_flags_string(imap, flags);
2534+
appendflags = __parse_flags_string(imap, flags, appenddir);
25352535
/* imap->appendkeywords will also contain keywords as well */
25362536
}
25372537
}

0 commit comments

Comments
 (0)