[Dovecot] quota_wrning not working for me (quota_rewrite patch for dovecot 1.0.8)

Juan C. Blanco jcblanco at fi.upm.es
Tue Dec 11 17:42:04 EET 2007


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-0001.pl 


More information about the dovecot mailing list