Re: bug in qmail-pop3d

2001-02-17 Thread Peter van Dijk

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");



bug in qmail-pop3d

2001-02-14 Thread Peter van Dijk

Look at this conversation:

+OK [EMAIL PROTECTED]
user peter
+OK 
pass * - not
+OK 
stat
+OK 81 204686
retr 81
+OK 
[message]

.
dele 81
+OK
stat
+OK 81 203554
...


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 :)

Greetz, Peter.




bug (?) in qmail-pop3d-1.03.diff

1999-07-21 Thread Aaron Nabil


There seems to be a small problem in the UIDL/Status feature patch
qmail-pop3d-1.03.diff.  The problem is that when using the TOP
command, it chops everything off following the added X-UIDL line.

Here is a suggested patch (also includes the extra /r/n patch)  (note
"suggested", for example I couldn't figgure out what the 
str_diffn(line.s, "-", 5) was supposed to be doing (yes, looks
like a part separater, but that would only be one _possible_ sep of
an infinite number (and no, it's not RFC-934, that would only be
one dash) so I whacked it out.  I guess "--" would make more sense
if he really did intend it to detect a part sepr.  Anyway, I'll dig up
the authors and drop them a note, maybe they can tell me.

*** /usr/staff/nabil/qmail-pop3d.c  Sun Jun 27 09:07:28 1999
--- qmail-pop3d.c   Wed Jul 21 19:40:02 1999
***
*** 123,134 
  if (!match  !line.len) break;
  if (match) --line.len; /* no way to pass this info over POP */
  if (limit) if (!inheaders) if (!--limit) break;
! if (!line.len || !str_diffn(line.s, "Content-Type: ", 14) || !str_diffn(line.s, 
"-", 5) )
  {
/* add our status notification here... */
  #if defined(USE_STATUS_HEADER) || defined(USE_XUIDL_HEADER)
-   if (!extradone  (inheaders  || !str_diffn(line.s, "Content-Type: ", 14) || 
!str_diffn(line.s, "-", 5) ))
-   {
  #ifdef  USE_STATUS_HEADER
  if (m[i].flagread)
put("Status: RO\r\n",12);
--- 123,132 
  if (!match  !line.len) break;
  if (match) --line.len; /* no way to pass this info over POP */
  if (limit) if (!inheaders) if (!--limit) break;
! if (inheaders  !extradone  (!line.len || !str_diffn(line.s, "Content-Type: 
", 14)))
  {
/* add our status notification here... */
  #if defined(USE_STATUS_HEADER) || defined(USE_XUIDL_HEADER)
  #ifdef  USE_STATUS_HEADER
  if (m[i].flagread)
put("Status: RO\r\n",12);
***
*** 141,150 
  put("\r\n",2);
  #endif
  extradone = 1;
-   }
  #endif
-   inheaders = 0;
  }
  else
if (line.s[0] == '.')
  put(".",1);
--- 139,148 
  put("\r\n",2);
  #endif
  extradone = 1;
  #endif
  }
+ if (!line.len)
+   inheaders = 0;
  else
if (line.s[0] == '.')
  put(".",1);
***
*** 152,158 
  put("\r\n",2);
  if (!match) break;
}
!   put("\r\n.\r\n",5);
flush();
  }
  
--- 150,156 
  put("\r\n",2);
  if (!match) break;
}
!   put(".\r\n",3);
flush();
  }
  

-- 
Aaron Nabil