<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">To install this patch, switch to your qmail-1.03 source directory.
Apply the patch using "patch &lt;qmail-popbull-1.03.patch".  For more
information, see the man page for qmail-popbull.

diff -u orig/Makefile ./Makefile
--- orig/Makefile	Mon Jun 15 06:53:16 1998
+++ ./Makefile	Fri Mar 19 23:30:26 1999
@@ -802,7 +802,7 @@
 qmail-clean qmail-send qmail-start splogger qmail-queue qmail-inject \
 predate datemail mailsubj qmail-upq qmail-showctl qmail-newu \
 qmail-pw2u qmail-qread qmail-qstat qmail-tcpto qmail-tcpok \
-qmail-pop3d qmail-popup qmail-qmqpc qmail-qmqpd qmail-qmtpd \
+qmail-pop3d qmail-popbull qmail-popup qmail-qmqpc qmail-qmqpd qmail-qmtpd \
 qmail-smtpd sendmail tcp-env qmail-newmrh config config-fast dnscname \
 dnsptr dnsip dnsmxip dnsfq hostname ipmeprint qreceipt qsmhook qbiff \
 forward preline condredirect bouncesaying except maildirmake \
@@ -929,7 +929,7 @@
 qmail-rspawn.0 qmail-clean.0 qmail-send.0 qmail-start.0 splogger.0 \
 qmail-queue.0 qmail-inject.0 mailsubj.0 qmail-showctl.0 qmail-newu.0 \
 qmail-pw2u.0 qmail-qread.0 qmail-qstat.0 qmail-tcpto.0 qmail-tcpok.0 \
-qmail-pop3d.0 qmail-popup.0 qmail-qmqpc.0 qmail-qmqpd.0 qmail-qmtpd.0 \
+qmail-pop3d.0 qmail-popbull.0 qmail-popup.0 qmail-qmqpc.0 qmail-qmqpd.0 qmail-qmtpd.0 \
 qmail-smtpd.0 tcp-env.0 qmail-newmrh.0 qreceipt.0 qbiff.0 forward.0 \
 preline.0 condredirect.0 bouncesaying.0 except.0 maildirmake.0 \
 maildir2mbox.0 maildirwatch.0 qmail.0 qmail-limits.0 qmail-log.0 \
@@ -1286,6 +1286,19 @@
 timeoutwrite.h
 	./compile qmail-pop3d.c
 
+qmail-popbull: \
+load qmail-popbull.o now.o substdio.a stralloc.a alloc.a str.a error.a open.a
+	./load qmail-popbull now.o substdio.a stralloc.a alloc.a fs.a str.a error.a open.a
+
+qmail-popbull.0: \
+qmail-popbull.8
+	nroff -man qmail-popbull.8 &gt; qmail-popbull.0
+
+qmail-popbull.o: \
+compile qmail-popbull.c direntry.h substdio.h stralloc.h subfd.h \
+open.h fmt.h error.h datetime.h now.h str.h
+	./compile qmail-popbull.c
+
 qmail-popup: \
 load qmail-popup.o commands.o timeoutread.o timeoutwrite.o now.o \
 case.a fd.a sig.a wait.a stralloc.a alloc.a substdio.a error.a str.a \
@@ -1768,6 +1781,7 @@
 qmail-command.8 qmail-control.9 qmail-getpw.9 qmail-header.5 \
 qmail-inject.8 qmail-limits.9 qmail-local.8 qmail-log.5 \
 qmail-lspawn.8 qmail-newmrh.9 qmail-newu.9 qmail-pop3d.8 \
+qmail-popbull.8 \
 qmail-popup.8 qmail-pw2u.9 qmail-qmqpc.8 qmail-qmqpd.8 qmail-qmtpd.8 \
 qmail-qread.8 qmail-qstat.8 qmail-queue.8 qmail-remote.8 \
 qmail-rspawn.8 qmail-send.9 qmail-showctl.8 qmail-smtpd.8 \
diff -u orig/qmail-popbull.8 ./qmail-popbull.8
--- orig/qmail-popbull.8	Fri Mar 19 23:27:14 1999
+++ ./qmail-popbull.8	Sat Mar 20 00:39:15 1999
@@ -0,0 +1,60 @@
+.TH qmail-popbull 8
+.SH NAME
+qmail-popbull \- insert bulletins
+.SH SYNOPSIS
+.B qmail-popbull
+.I bulletin-directory
+.I pop3d-program
+.I Maildir
+.SH DESCRIPTION
+.B qmail-popbull
+examines a directory of bulletins whenever a user checks their pop3 mail.
+When a new bulletin is seen, it inserts the bulletin into the user's
+.I Maildir.
+
+It compares the time on a .timestamp file in the
+.I Maildir
+directory and compares it to the time on the bulletin.  If the bulletin
+is newer,
+.B qmail-popbull
+inserts a symlink to the bulletin into the user's Maildir/new directory.
+The bulletin should be an ordinary email message.  One reasonable use
+of
+.B qmail-popbull
+is to point it to the
+.B new
+directory of a special user's Maildir.  When you send that user mail,
+it becomes a bulletin.
+
+.B Caution!
+The files in the bulletin directory must be readable by anyone, so
+you'll probably have to store the mail in the user's maildir using:
+.EX
+  ./Maildir/
+.br
+  |chmod ugo+r Maildir/new/*
+.EE
+
+When
+.B qmail-popbull
+is finished, it execs the
+.I pop3d-program
+with the remainder of its arguments as arguments to
+.I pop3d-program.
+
+.I pop3d-program
+can be any program, but that program's first argument must be the user's
+.I Maildir.
+
+Suggested invocation:
+.EX
+   qmail-popup YOURHOST /bin/checkpassword /var/qmail/bin/qmail-popbull
+.br
+   /var/spool/bulletins /var/qmail/bin/qmail-pop3d Maildir
+.br
+   (all on one line)
+.EE
+
+.SH "SEE ALSO"
+qmail-popup(8),
+qmail-pop3d(8)
diff -u orig/qmail-popbull.c ./qmail-popbull.c
--- orig/qmail-popbull.c	Fri Mar 19 23:26:40 1999
+++ ./qmail-popbull.c	Sat Mar 20 00:21:43 1999
@@ -0,0 +1,115 @@
+/* written by Russell Nelson for USWest.
+ * ported to 1.03 by Bruce Guenter
+ * multiple bulletins bug noticed and fixed by Brian Mullen
+ * cur timestamp can't be used, noticed by DJB, fixed by Brett Rabe.
+*/
+#include &lt;sys/types.h&gt;
+#include &lt;sys/stat.h&gt;
+#include "direntry.h"
+#include "substdio.h"
+#include "stralloc.h"
+#include "subfd.h"
+#include "open.h"
+#include "fmt.h"
+#include "error.h"
+#include "datetime.h"
+#include "now.h"
+#include "str.h"
+
+void die() { _exit(100); }
+void die_temp() { _exit(111); }
+void die_usage() {
+ substdio_putsflush(subfderr,"qmail-popbull: usage: qmail-popbull bulldir pop3d maildir\n"); die_temp(); }
+void die_nobulldir() {
+ substdio_putsflush(subfderr,"qmail-popbull: fatal: unable to read bulldir\n"); die_temp(); }
+void die_nomaildir() {
+ substdio_putsflush(subfderr,"qmail-popbull: fatal: unable to write to maildir\n"); die_temp(); }
+void die_nocdmaildir() {
+ substdio_putsflush(subfderr,"qmail-popbull: fatal: unable to change to maildir\n"); die_temp(); }
+void die_nomem() {
+ substdio_putsflush(subfderr,"qmail-popbull: fatal: out of memory\n"); die_temp(); }
+
+stralloc fn = {0};
+stralloc fn2 = {0};
+char fntmptph[80 + FMT_ULONG * 2];
+
+void fnmake_maildir()
+{  
+ unsigned long pid;
+ unsigned long time;
+ char host[64];
+ char *s;
+ int loop;
+ struct stat st; 
+ int fd; 
+ 
+ pid = getpid();
+ host[0] = 0;
+ gethostname(host,sizeof(host));
+ for (loop = 0;;++loop)
+  {
+   time = now();
+   s = fntmptph;
+   s += fmt_str(s,"new/");
+   s += fmt_ulong(s,time); *s++ = '.';
+   s += fmt_ulong(s,pid); *s++ = '.';
+   s += fmt_strn(s,host,sizeof(host)); *s++ = 0;
+   if (stat(fntmptph,&amp;st) == -1)
+     if (errno == error_noent)
+       break;
+   /* really should never get to this point */
+   if (loop == 2)
+     _exit(1);
+   sleep(2);  
+  }  
+}
+
+
+void main(argc,argv)
+int argc;
+char **argv;
+{
+ int fd;
+ struct stat st;
+ datetime_sec ts_date;
+ char *bulldirname;
+ char *programname;
+ char *maildirname;
+ DIR *bulldir;
+ direntry *d;
+ char **childargs;
+ char num[80];
+
+ if (!(bulldirname = argv[1])) die_usage();
+ if (!(programname = argv[2])) die_usage();
+ if (!(maildirname = argv[3])) die_usage();
+
+ if (chdir(maildirname) == -1) die_nocdmaildir();
+ argv[3] = ".";
+
+ if (stat(".timestamp", &amp;st) == -1) ts_date = 0;
+ else ts_date = st.st_mtime;
+ fd = open_trunc(".timestamp");
+ close (fd);
+ 
+ bulldir = opendir(bulldirname);
+ if (!bulldir) die_nobulldir();
+ while(d = readdir(bulldir))
+  {
+   if (str_equal(d-&gt;d_name,".")) continue;
+   if (str_equal(d-&gt;d_name,"..")) continue;
+   if (!stralloc_copys(&amp;fn, bulldirname)) die_nomem();
+   if (!stralloc_cats(&amp;fn, "/")) die_nomem();
+   if (!stralloc_cats(&amp;fn, d-&gt;d_name)) die_nomem();
+   if (!stralloc_0(&amp;fn)) die_nomem();
+   if (stat(fn.s, &amp;st) == -1) die();   if ((st.st_mode &amp; 0222) == 0) continue;
+   if (st.st_mtime &gt; ts_date)
+    {
+     fnmake_maildir();
+     symlink(fn.s, fntmptph);
+    }
+  }
+  closedir(bulldir);
+  childargs = argv + 2;
+  execvp(*childargs,childargs);
+}
diff -u orig/install-big.c ./install-big.c
--- orig/install-big.c  Fri Apr 16 11:01:32 1999
+++ ./install-big.c       Fri Apr 16 11:03:06 1999
@@ -122,6 +122,7 @@
   c(auto_qmail,"bin","qmail-tcpto",auto_uido,auto_gidq,0755);
   c(auto_qmail,"bin","qmail-tcpok",auto_uido,auto_gidq,0755);
   c(auto_qmail,"bin","qmail-pop3d",auto_uido,auto_gidq,0755);
+  c(auto_qmail,"bin","qmail-popbull",auto_uido,auto_gidq,0755);
   c(auto_qmail,"bin","qmail-popup",auto_uido,auto_gidq,0711);
   c(auto_qmail,"bin","qmail-qmqpc",auto_uido,auto_gidq,0755);
   c(auto_qmail,"bin","qmail-qmqpd",auto_uido,auto_gidq,0755);
</pre></body></html>