[prev in list] [next in list] [prev in thread] [next in thread]
List: sqwebmail
Subject: [sqwebmail] Maildir Quota Bug
From: "Richard Goode" <rgoode () quicksilver ! co ! nz>
Date: 2002-08-29 22:07:54
[Download RAW message or body]
Hi Ppl,
We had a problem a while back with our users getting spurious quota =
warnings from qmail. I found that the format that sqwebmail was writing =
to the ~/Maildir/maildirsize file was being misread by qmail.
We're using qmail-1.03 (ldap) and hunting through the code I found that =
in <qmailsrc>/maildir++.c, lines 292-314, the maildirsize file is read, =
but no account is made for any other characters at the beginning of a =
line other than either a number or a '-' sign. If a space is =
encountered, it is assumed that the first field has ended, and starts =
reading the second field. The upshot being is that size of messages and =
number of messages were being mixed up.
When writing the maildir size, <sqwebmail 3.3.6 =
source>/maildir/maildirquota.c lines 556-560 do the following:
sprintf(buf + strlen(buf),
"%8s ", str_off_t(maildirsize_size, n));
sprintf(buf + strlen(buf),
"%4s\n", str_off_t(maildirsize_cnt, n));
Which creates an entry in the maildirsize file which is right aligned, =
padded with spaces to the left. The easy fix was to just change the =
sprintf format to %-8s and %-4s:
sprintf(buf + strlen(buf),
"%-8s ", str_off_t(maildirsize_size, n));
sprintf(buf + strlen(buf),
"%-4s\n", str_off_t(maildirsize_cnt, n));
Have I got this right? Is this something to add in the main source, or =
a patch I need to personally keep?
Rich
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.384 / Virus Database: 216 - Release Date: 8/22/2002
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.3590.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi Ppl,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>We had a problem a while back with our users
getting spurious quota warnings from qmail. I found that the format that
sqwebmail was writing to the ~/Maildir/maildirsize file was being misread by
qmail.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>We're using qmail-1.03 (ldap) and hunting through
the code I found that in <qmailsrc>/maildir++.c, lines 292-314, the
maildirsize file is read, but no account is made for any other characters at the
beginning of a line other than either a number or a '-' sign. If a space
is encountered, it is assumed that the first field has ended, and starts reading
the second field. The upshot being is that size of messages and number of
messages were being mixed up.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>When writing the maildir size, <sqwebmail 3.3.6
source>/maildir/maildirquota.c lines 556-560 do the following:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
sprintf(buf +
strlen(buf),<BR> \
"%8s ", str_off_t(maildirsize_size, n));</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
sprintf(buf +
strlen(buf),<BR> \
"%4s\n", str_off_t(maildirsize_cnt, n));<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Which creates an entry in the maildirsize file
which is right aligned, padded with spaces to the left. The easy fix was
to just change the sprintf format to %-8s and %-4s:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
sprintf(buf +
strlen(buf),<BR> \
"%-8s ", str_off_t(maildirsize_size, n));</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
sprintf(buf +
strlen(buf),<BR> \
"%-4s\n", str_off_t(maildirsize_cnt, n));<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Have I got this right? Is this something to
add in the main source, or a patch I need to personally keep?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Rich</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><BR>---<BR>Outgoing mail is certified Virus
Free.<BR>Checked by AVG anti-virus system (<A
href="http://www.grisoft.com">http://www.grisoft.com</A>).<BR>Version: 6.0.384 /
Virus Database: 216 - Release Date: 8/22/2002</DIV></FONT></BODY></HTML>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic