--- qmail-1.03/qmail-pop3d.c.orig	Sat Sep 30 06:39:33 2000
+++ qmail-1.03/qmail-pop3d.c	Fri Oct 13 20:59:13 2000
@@ -1,3 +1,6 @@
+#include <pwd.h>
+#include <time.h>
+#include <syslog.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include "commands.h"
@@ -17,7 +20,20 @@
 #include "timeoutread.h"
 #include "timeoutwrite.h"
 
-void die() { _exit(0); }
+time_t start;
+long int msg_retr = 0;
+
+void die() { 
+  struct passwd *pw;
+  uid_t uid = getuid();
+  
+  pw = getpwuid (uid);
+  openlog ("qmail-pop3d", LOG_PID, LOG_MAIL);
+  syslog (LOG_INFO, "user=%s/%d from=%s/%s time=%ld RETR=%ld", pw->pw_name, uid, getenv ("TCPREMOTEHOST"), getenv ("TCPREMOTEIP"), time(NULL)-start, msg_retr);
+  closelog();
+
+  _exit(0); 
+}
 
 int saferead(fd,buf,len) int fd; char *buf; int len;
 {
@@ -271,6 +287,7 @@
   substdio_fdbuf(&ssmsg,read,fd,ssmsgbuf,sizeof(ssmsgbuf));
   blast(&ssmsg,limit);
   close(fd);
+  msg_retr++;
 }
 
 struct commands pop3commands[] = {
@@ -291,6 +308,7 @@
 int argc;
 char **argv;
 {
+  start = time (NULL);
   sig_alarmcatch(die);
   sig_pipeignore();
 
