On Wed, Feb 14, 2001 at 10:58:22AM +0100, Peter van Dijk wrote:
[snip]
> Note how stat shows a smaller total size but the same message count.
> This is a bug. According to RFC1939 (pop3) STAT should not count
> deleted messages 'in either total'.
> 
> The fix is trivial, I will fix up a patch tonight if noone else does
> it before then :)

Ok, been busy. Attached is a patch for this bug. The patch was
trivial indeed.

Greetz, Peter.
--- /usr/local/src/qmail-1.03/qmail-pop3d.c     Mon Jun 15 12:53:16 1998
+++ qmail-pop3d.c       Sat Feb 17 22:20:08 2001
@@ -149,12 +149,18 @@
 void pop3_stat()
 {
   int i;
+  int realnumm;
   unsigned long total;
  
+  realnumm = 0;
   total = 0;
-  for (i = 0;i < numm;++i) if (!m[i].flagdeleted) total += m[i].size;
+  for (i = 0;i < numm;++i)
+    if (!m[i].flagdeleted) {
+      total += m[i].size;
+      ++realnumm;
+    }
   puts("+OK ");
-  put(strnum,fmt_uint(strnum,numm));
+  put(strnum,fmt_uint(strnum,realnumm));
   puts(" ");
   put(strnum,fmt_ulong(strnum,total));
   puts("\r\n");

Reply via email to