Juan C. Blanco
2007-Dec-11 15:42 UTC
[Dovecot] quota_wrning not working for me (quota_rewrite patch for dovecot 1.0.8)
Hello, We are using dovecot 1.0.8 with LDAP authentication and extra variebles (like quota limit) storage. Since some of our users are asking for warning of quota use I have been playing around with the quota rewrite patch for dovecot 1.0.8 and found that it does not work for us as it is now. I've applied the patch recompiled dovecot reconfigured using the new "quota_warning" options for a test user with a 10MB quota and warning limits in the 45 and 50 percent. The script for the warnings was never executed and then I've done some debugging with the code and found two different problems (well, at least I think that there are two problems but I may be wrong) The first problem is with the parsing of percentage limits in the quota_warning options. The function "quota_rule_parse_percentage" was using the same value for the variables "percentage" and "*limit" and then the calculated value is not a percentage of the default quota rule limit but of the percentage itself (i.e. using a 80% limit returns a value of 64 for the internal saved limit, instead of 80% of the default rule value). In my sample a 50% limit returned a value of 25 bytes for the limit instead of 5,120. The other problem is when checking the limits to execute the scripts, the "quota_warnings_execute" function is checking if the warning limit is reached with this comparison: if ((bytes_current < warnings[i].bytes_limit && bytes_current + ctx->bytes_used >= warnings[i].bytes_limit) || ... My debug have reported that at the point of the execution of this function the "bytes_current" variable already includes the size of the current transaction (at least it was in all my tests) and then the first part of the comparison (that we are under the limit prior to this transaction)is false. I've changed this to: if ((bytes_current - ctx->bytes_used < warnings[i].bytes_limit && bytes_current >= warnings[i].bytes_limit) || ... I've included the modified patch in this messag but since this is my first contact with dovecot code I'm not sure enough if the problems was with the code or if it was my fault. There is someone using the quota-rewrite patch and can confirm if it was working fine?. Can the author of the original patch take a look at it and confirm if I'm wrong or my changes are valid I don't have a Dovecot 1.1 working here and can not verify if the problems occurs also with this vesion, however the code seems the same after a quick look at it and I think that may be usefull to recheck the code prior to the RC stage. Regards Juan C. Blanco -- +----------------------------------------------------------------+ | Juan C. Blanco | | | | Centro de Calculo | | | Facultad de Informatica U.P.M. | E-mail: jcblanco at fi.upm.es | | Campus de Montegancedo | | | Boadilla del Monte | Tel.: (+34) 91 336 7466 | | 28660 MADRID (Spain) | Fax : (+34) 91 336 6913 | +----------------------------------------------------------------+ -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: dovecot-1.0.8-quota-rewrite.patch URL: <http://dovecot.org/pipermail/dovecot/attachments/20071211/54092b11/attachment-0002.pl>
Timo Sirainen
2007-Dec-21 16:40 UTC
[Dovecot] quota_wrning not working for me (quota_rewrite patch for dovecot 1.0.8)
On Tue, 2007-12-11 at 16:42 +0100, Juan C. Blanco wrote:> The other problem is when checking the limits to execute the scripts, > the "quota_warnings_execute" function is checking if the warning limit > is reached with this comparison: > > if ((bytes_current < warnings[i].bytes_limit && > bytes_current + > ctx->bytes_used >= warnings[i].bytes_limit) || ...Fixed: http://hg.dovecot.org/dovecot/rev/71b9541adad1 I'll update quota-rewrite patch soon also. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20071221/bde27e4e/attachment-0002.bin>
Juan C. Blanco
2008-Jan-10 14:18 UTC
[Dovecot] quota_wrning not working for me (quota_rewrite patch for dovecot 1.0.8) and dovecot 1.1.beta13
Hello Timo, have you had the time to take a look at this code for the quota-warning to run. In the quota-rewrite patch and in the 1.1beta13 code the warning command is executed with this condition if ((bytes_current < warnings[i].bytes_limit && bytes_current >= warnings[i].bytes_limit) || (count_current < warnings[i].count_limit && count_current >= warnings[i].count_limit)) { quota_warning_execute(warnings[i].command); And I think that the "if" condition is never TRUE bytes_current can't be "<" and ">=" than warnings[i].bytes_limit at the same time, right? In the patch previous patch that I've sent to the list the "if" looks like: if ((bytes_current - ctx->bytes_used < warnings[i].bytes_limit && bytes_current >= warnings[i].bytes_limit) || (count_current - ctx->count_used < warnings[i].count_limit && count_current >= warnings[i].count_limit)) { Regards and happy new year Juan C. Blanco Timo Sirainen wrote:> On Tue, 2007-12-11 at 16:42 +0100, Juan C. Blanco wrote: >> The other problem is when checking the limits to execute the scripts, >> the "quota_warnings_execute" function is checking if the warning limit >> is reached with this comparison: >> >> if ((bytes_current < warnings[i].bytes_limit && >> bytes_current + >> ctx->bytes_used >= warnings[i].bytes_limit) || ... > > Fixed: http://hg.dovecot.org/dovecot/rev/71b9541adad1 > > I'll update quota-rewrite patch soon also. >-- +----------------------------------------------------------------+ | Juan C. Blanco | | | | Centro de Calculo | | | Facultad de Informatica U.P.M. | E-mail: jcblanco at fi.upm.es | | Campus de Montegancedo | | | Boadilla del Monte | Tel.: (+34) 91 336 7466 | | 28660 MADRID (Spain) | Fax : (+34) 91 336 6913 | +----------------------------------------------------------------+
Apparently Analagous Threads
- [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
- [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
- Question regarding reverse quota_warning
- [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
- Quota warning generated when crossing on both sides