Bug in quota_get_status

Timo Sirainen tss at iki.fi
Wed Jul 2 17:40:30 UTC 2014


On 26.6.2014, at 18.10, Markus Gebert <markus.gebert at hostpoint.ch> wrote:

> 
> On 26.06.2014, at 10:28, Franz Knipp <franz at qnipp.com> wrote:
> 
>> the configuration option
>> 
>> lmtp_rcpt_check_quota = yes
> 
> I noticed that too, and my quick&dirty fix was to make quota_get_status() call quota_test_alloc() with size = 1, which fixes the problem as well. See patch below [1].

This should fix it properly: http://hg.dovecot.org/dovecot-2.2/rev/76d573ec5045
(Requires http://hg.dovecot.org/dovecot-2.2/rev/0d4de84a54f0)

> I keep wondering why quota_is_over() does not just check ctx->*_over in the first place instead of doing math with ctx->*_used and ctx->*_ceil. It would seem so much easier. So either ctx->*over was added after quota_is_over() had been written, or this is an oversight, or there’s a specific reason the author did not use/trust ctx->*_over and preferred doing it in a more complicated way. Grepping trough the file, I see much more places the the ctx->*_used and ctx->*_ceil get updated compared to ctx->*_over, so that might indicate that the latter is only updated in specific cases, and cannot be trusted under all circumstances. Then again, I just took a short look at the quota code, so this hunch might me completely wrong.

The problem is that within the same transaction it's possible to add/remove multiple mails. The *_ceil and *_over are set only once at the beginning of the transaction.



More information about the dovecot mailing list