diff -u qmail-1.03/Makefile qmail-1.03-syslog/Makefile
--- qmail-1.03/Makefile	Mon Jun 15 19:53:16 1998
+++ qmail-1.03-syslog/Makefile	Tue Jun 17 19:17:43 2003
@@ -1287,10 +1287,10 @@
 	./compile qmail-pop3d.c
 
 qmail-popup: \
-load qmail-popup.o commands.o timeoutread.o timeoutwrite.o now.o \
+load qmail-popup.o commands.o timeoutread.o timeoutwrite.o now.o envread.o \
 case.a fd.a sig.a wait.a stralloc.a alloc.a substdio.a error.a str.a \
 fs.a socket.lib
-	./load qmail-popup commands.o timeoutread.o timeoutwrite.o \
+	./load qmail-popup commands.o timeoutread.o timeoutwrite.o envread.o \
 	now.o case.a fd.a sig.a wait.a stralloc.a alloc.a \
 	substdio.a error.a str.a fs.a  `cat socket.lib`
 
diff -u qmail-1.03/qmail-popup.c qmail-1.03-syslog/qmail-popup.c
--- qmail-1.03/qmail-popup.c	Mon Jun 15 19:53:16 1998
+++ qmail-1.03-syslog/qmail-popup.c	Thu Aug 21 18:42:53 2003
@@ -13,6 +13,8 @@
 #include "readwrite.h"
 #include "timeoutread.h"
 #include "timeoutwrite.h"
+#include "env.h"
+#include <syslog.h>
 
 void die() { _exit(1); }
 
@@ -54,13 +56,22 @@
   flush();
 }
 
+char *remoteip;
+
+void info_syslog(char* user,char* s)
+{
+  openlog("qmail-popup",0,LOG_MAIL);
+  syslog(LOG_INFO,"%s %s %s",remoteip,user,s);
+  closelog();
+}
+
 void die_usage() { err("usage: popup hostname subprogram"); die(); }
 void die_nomem() { err("out of memory"); die(); }
 void die_pipe() { err("unable to open pipe"); die(); }
 void die_write() { err("unable to write pipe"); die(); }
 void die_fork() { err("unable to fork"); die(); }
-void die_childcrashed() { err("aack, child crashed"); }
-void die_badauth() { err("authorization failed"); }
+void die_childcrashed() { err("aack, child crashed"); die(); }
+void die_badauth(char* user) { err("authorization failed"); info_syslog(user,"password_incorrect"); die(); }
 
 void err_syntax() { err("syntax error"); }
 void err_wantuser() { err("USER first"); }
@@ -115,7 +126,8 @@
   byte_zero(upbuf,sizeof upbuf);
   if (wait_pid(&wstat,child) == -1) die();
   if (wait_crashed(wstat)) die_childcrashed();
-  if (wait_exitcode(wstat)) die_badauth();
+  if (wait_exitcode(wstat)) die_badauth(user);
+  info_syslog(user,"auth_success");
   die();
 }
 void pop3_greet()
@@ -177,6 +189,9 @@
   childargs = argv + 2;
   if (!*childargs) die_usage();
  
+  remoteip = env_get("TCPREMOTEIP");
+  if (!remoteip) remoteip = "unknown";
+
   pop3_greet();
   commands(&ssin,pop3commands);
   die();
diff -u qmail-1.03/qmail-smtpd.c qmail-1.03-syslog/qmail-smtpd.c
--- qmail-1.03/qmail-smtpd.c	Mon Jun 15 19:53:16 1998
+++ qmail-1.03-syslog/qmail-smtpd.c	Thu Aug 21 18:43:52 2003
@@ -23,6 +23,7 @@
 #include "timeoutread.h"
 #include "timeoutwrite.h"
 #include "commands.h"
+#include <syslog.h>
 
 #define MAXHOPS 100
 unsigned int databytes = 0;
@@ -222,6 +223,13 @@
 stralloc mailfrom = {0};
 stralloc rcptto = {0};
 
+void info_syslog(char* s)
+{
+  openlog("qmail-smtpd",0,LOG_MAIL);
+  syslog(LOG_INFO,"%s mail from %s to %s %s",remoteip,mailfrom.s,rcptto.s,s);
+  closelog();
+}
+
 void smtp_helo(arg) char *arg;
 {
   smtp_greet("250 "); out("\r\n");
@@ -386,9 +394,9 @@
   qmail_put(&qqt,rcptto.s,rcptto.len);
  
   qqx = qmail_close(&qqt);
-  if (!*qqx) { acceptmessage(qp); return; }
-  if (hops) { out("554 too many hops, this message is looping (#5.4.6)\r\n"); return; }
-  if (databytes) if (!bytestooverflow) { out("552 sorry, that message size exceeds my databytes limit (#5.3.4)\r\n"); return; }
+  if (!*qqx) { acceptmessage(qp); info_syslog("queued"); return; }
+  if (hops) { out("554 too many hops, this message is looping (#5.4.6)\r\n"); info_syslog("too_many_hops"); return; }
+  if (databytes) if (!bytestooverflow) { out("552 sorry, that message size exceeds my databytes limit (#5.3.4)\r\n"); info_syslog("message_size_exceeds"); return; }
   if (*qqx == 'D') out("554 "); else out("451 ");
   out(qqx + 1);
   out("\r\n");
