ph10 2004/11/12 11:28:15 GMT
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src/transports tf_maildir.c
exim-test-orig/AutoTest/stderr 517
Log:
Recalculate maildirsize data if either of the totals comes out negative,
as this indicates a broken file.
Revision Changes Path
1.24 +5 -0 exim/exim-doc/doc-txt/ChangeLog
1.2 +11 -2 exim/exim-src/src/transports/tf_maildir.c
1.3 +1 -1 exim/exim-test-orig/AutoTest/stderr/517
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ChangeLog 11 Nov 2004 16:03:47 -0000 1.23
+++ ChangeLog 12 Nov 2004 11:28:15 -0000 1.24
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.23 2004/11/11 16:03:47 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.24 2004/11/12 11:28:15 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -93,6 +93,11 @@
25. Narrowed the window for a race in the daemon that could cause it to ignore
SIGCHLD signals. This is not a major problem, because they are used only to
wake it up if nothing else does.
+
+26. A malformed maildirsize file could cause Exim to calculate negative values
+ for the mailbox size or file count. Odd effects could occur as a result.
+ The maildirsize information is now recalculated if the size or filecount
+ end up negative.
Exim version 4.43
Index: tf_maildir.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/tf_maildir.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tf_maildir.c 7 Oct 2004 13:10:02 -0000 1.1
+++ tf_maildir.c 12 Nov 2004 11:28:15 -0000 1.2
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/tf_maildir.c,v 1.1 2004/10/07 13:10:02 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/tf_maildir.c,v 1.2 2004/11/12 11:28:15 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -430,10 +430,19 @@
/* If *endptr is zero, we have successfully parsed the file, and we now have
the size of the mailbox as cached in the file. The "rules" say that if this
value indicates that the mailbox is over quota, we must recalculate if there is
-more than one entry in the file, or if the file is older than 15 minutes. */
+more than one entry in the file, or if the file is older than 15 minutes. Also,
+just in case there are weird values in the file, recalculate if either of the
+values is negative. */
if (*endptr == 0)
{
+ if (size < 0 || filecount < 0)
+ {
+ DEBUG(D_transport) debug_printf("negative value in maildirsize "
+ "(size=%d count=%d): recalculating\n", size, filecount);
+ goto RECALCULATE;
+ }
+
if (ob->quota_value > 0 &&
(size + (ob->quota_is_inclusive? message_size : 0) > ob->quota_value ||
(ob->quota_filecount_value > 0 &&
@@ -444,7 +453,7 @@
struct stat statbuf;
if (linecount > 1)
{
- DEBUG(D_transport) debug_printf("over quota and maildirsizefile has "
+ DEBUG(D_transport) debug_printf("over quota and maildirsize has "
"more than 1 entry: recalculating\n");
goto RECALCULATE;
}
Index: 517
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/stderr/517,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 517 19 Oct 2004 14:31:15 -0000 1.2
+++ 517 12 Nov 2004 11:28:15 -0000 1.3
@@ -452,7 +452,7 @@
looking for maildirsize in /source/exim4/AutoTest/test-mail/ph10
reading quota parameters from maildirsize data
computing maildir size from maildirsize data
-over quota and maildirsizefile has more than 1 entry: recalculating
+over quota and maildirsize has more than 1 entry: recalculating
skipping /source/exim4/AutoTest/test-mail/ph10/maildirsize: dir_regex does not match
skipping /source/exim4/AutoTest/test-mail/ph10/tmp: dir_regex does not match
check_dir_size: dir=/source/exim4/AutoTest/test-mail/ph10/new sum=267 count=1