10 Apr
2015
10 Apr
'15
12:44 a.m.
dovecot v2.2.16
I've found a few bugs in Trash plugin.
If Quota set only messages limit (without storage limit) then Trash plugin does not expunge any message because Quota plugin sets too_large_r=TRUE. It's because quota_default_test_alloc function does not check if bytes_limit is set.
/* if size is bigger than any limit, then it is bigger than the lowest limit */
if (size > bytes_limit) {
if (bytes_limit > 0 && size > bytes_limit) { *too_large_r = TRUE; break; }
- Trash plugin does not use bytes_ceil/count_ceil to calculate size_needed/count_needed to expunge. Trash plugin may expunge more messages that nedeed.
if (ctx->bytes_ceil!=(uint64_t)-1 && ctx->bytes_ceil < size + ctx->bytes_over) {
size_needed = size + ctx->bytes_over - ctx->bytes_ceil;
}
if (ctx->count_ceil!=(uint64_t)-1 && ctx->count_ceil < 1 + ctx->count_over) {
count_needed = 1 + ctx->count_over - ctx->count_ceil;
}
/* not enough space. try deleting some from mailbox. */
ret = trash_try_clean_mails(ctx, size + ctx->bytes_over,
1 + ctx->count_over);
ret = trash_try_clean_mails(ctx, size_needed, count_needed);
- Trash plugin does not check 'unlimited' values in bytes_ceil/count_ceil and may overflow them when add expunged size/messages
ctx->bytes_ceil += size_expunged;
ctx->count_ceil += expunged_count;
if (ctx->bytes_ceil!=(uint64_t)-1) {
ctx->bytes_ceil += size_expunged;
}
if (ctx->count_ceil!=(uint64_t)-1) {
ctx->count_ceil += expunged_count;
}
See attached patch.