Mailing-List: contact djb-qmail-help@koobera.math.uic.edu; run by ezmlm Date: Wed, 5 Aug 1998 14:33:30 -0500 (CDT) From: "I. Dwayne Koonce" To: djb-qmail@koobera.math.uic.edu Subject: stat command in qmail-pop3d Message-ID: I'm getting ready to move a site to qmail, and earlier today, while pondering how best to patch qmail-pop3d to do some logging, I noticed that its STAT command lists the total number of all messages, then the total size of only the non-deleted messages. This seemed odd, so I checked RFC 1939, which specifies deleted messages aren't counted in either total. So, I came up with the trivial patch appended here. This fix, or one like it, should probably go into the main distribution. Also--does anyone still use the LAST command? While trying to figure out what it was supposed to do, I finally found it in one of the obsoleted RFCs, which said that it should return the number of the highest-numbered message accessed (RETR'd or DELE'd--it's not explicitly stated whether TOP'ing a message counts). qmail-pop3d simply returns the highest message number DELE'd. (qpopper does precisely the opposite--it gives the highest number RETR'd [but not DELE'd or TOP'd].) It also says (opaquely, but not really vaguely) that the "highest number accessed" should be set, on start of transaction state, not to zero, but to the number of the highest-numbered message accessed by previous sessions (ie, the last occurence of /^Status: RO/ in mbox-speak). Does anyone care whether or not LAST gets fixed? --- qmail-1.03-orig/qmail-pop3d.c Wed Aug 5 12:52:11 1998 +++ qmail-1.03/qmail-pop3d.c Wed Aug 5 13:24:41 1998 @@ -148,13 +148,13 @@ void pop3_stat() { - int i; + int i, j=0; unsigned long total; 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; j++; } puts("+OK "); - put(strnum,fmt_uint(strnum,numm)); + put(strnum,fmt_uint(strnum,j)); puts(" "); put(strnum,fmt_ulong(strnum,total)); puts("\r\n"); ____________________________________________________________________________ I. Dwayne Koonce E-mail: dwayne@txcyber.com Network Administrator Phone: (409) 268-6800 Cybercom Corporation Fax: (409) 260-2652 ____________________________________________________________________________