Re: [Dovecot] Odd/Incorrect Quota Reporting on Dovecot 1.2.4 & FreeBSD4
On Wed, 2009-09-09 at 15:07 +0100, Siraj 'Sid' Rakhada wrote: > Am seeing an odd problem on an old FreeBSD 4.11 box that I'm trying to > get courier off, and dovecot on. At the same time, I'm trying to put > some fairly simple quota support on, but getting very odd results. My guess is that this code doesn't work correctly in src/plugins/quota/quota-maildir.c: if (sscanf(*lines, "%lld %d", &bytes_diff, &count_diff) != 2) return -1; You could try if the attached patch fixes it for you. diff -r b359aac78f92 src/plugins/quota/quota-maildir.c --- a/src/plugins/quota/quota-maildir.c Wed Sep 09 00:50:16 2009 -0400 +++ b/src/plugins/quota/quota-maildir.c Wed Sep 09 17:06:20 2009 -0400 @@ -441,7 +441,7 @@ { struct quota_root *_root = &root->root; uint64_t message_bytes_limit, message_count_limit; - long long bytes_diff, total_bytes; + long bytes_diff, total_bytes; int count_diff, total_count; unsigned int line_count = 0; @@ -480,7 +480,7 @@ /* rest of the lines contains diffs */ total_bytes = 0; total_count = 0; for (lines++; *lines != NULL; lines++, line_count++) { - if (sscanf(*lines, "%lld %d", &bytes_diff, &count_diff) != 2) + if (sscanf(*lines, "%ld %d", &bytes_diff, &count_diff) != 2) return -1; total_bytes += bytes_diff; signature.asc Description: This is a digitally signed message part
Re: [Dovecot] Odd/Incorrect Quota Reporting on Dovecot 1.2.4 & FreeBSD4
Ack! The bottom of my log was truncated - but not by much, here is all that was skipped: (on server, do 'rm maildirsize' again, while still connected, the first 'getquotaroot' is incorrect, as it seems dovecot regenerates the maildirsize file on login, hence the 'rm') a getquotaroot inbox * QUOTAROOT "inbox" "User Quota" * QUOTA "User Quota" (STORAGE 297662 1048576) a OK Getquotaroot completed. a getquotaroot inbox * QUOTAROOT "inbox" "User Quota" * QUOTA "User Quota" (STORAGE 297662 1048576) a OK Getquotaroot completed. a logout * BYE Logging out a OK Logout completed. closed If reconnecting, the same error occurs as Attempt 1 above.
[Dovecot] Odd/Incorrect Quota Reporting on Dovecot 1.2.4 & FreeBSD4
Hi, Am seeing an odd problem on an old FreeBSD 4.11 box that I'm trying to get courier off, and dovecot on. At the same time, I'm trying to put some fairly simple quota support on, but getting very odd results. I think it might be better described with the log below, but, the gist of it is this: I have set a 1GB quota, and I was getting intermittent reports on the quota usage - sometimes at the correct usage (300MB or so), and then at some crazy amount over the quota usage. I can get it to be consistently incorrect though, as displayed with the below log. The maildirsize is correct, and matches closely to 'du' output, it's simply coming through incorrect on IMAP. It also only seems to happen if the maildirsize is not created before the first 'getquota[root]' command occurs. I think it's something to do with dovecot + FreeBSD (at least, this version)! I've done a quick test on a Debian box, and I don't have the same problem. Anyone else have any ideas what could be going wrong on this FreeBSD box? Is it worth me giving the dovecot -n output at this stage? It happens on different mailboxes too, this is just a sample. Thanks! - information & log follow # /usr/local/dovecot/sbin/dovecot --version 1.2.4 # uname -a FreeBSD server1.domain 4.11-RELEASE-p13 FreeBSD 4.11-RELEASE-p13 #5: Wed Oct 12 18:02:46 BST 2005 r...@server1.domain:/usr/obj/build/src/sys/FBSD410RELENG i386 # cat maildirsize 1073741824S 304806180 16002 Attempt 1: . OK Capability completed. a login s...@domain test a OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH QUOTA] Logged in a getquotaroot inbox * QUOTAROOT "inbox" "User Quota" * QUOTA "User Quota" (STORAGE 117738174 1048576) a OK Getquotaroot completed. a logout * BYE Logging out a OK Logout completed. closed Attempt 2: (on server do 'rm maildirsize') . OK Capability completed. a login s...@domain test a OK [snip] Logged in a getquotaroot inbox * QUOTAROOT "inbox" "User Quota" * QUOTA "User Quota" (STORAGE 117738174 1048576) a OK Getquotaroot completed. (on server, do 'rm maildirsize' again, while still connected, the first 'getquotaroot' is incorrect, as it seems dovecot regenerates the maildirsize file on login, hence the 'rm') a getquotaroot inbox * QUOTAROOT "inbox" "User Quota" * QUOTA "User Quota" (STORAGE 297662 1048576) a OK Getquotaroot completed. a getquotaroot inbox * QUOTAROOT "inbox" "User Quota"