qmail: Indirect via QMAILQUEUE environment variable to find qmail-queue. mdw/1.03-4
authorMark Wooding <mdw@distorted.org.uk>
Wed, 1 Oct 2003 00:28:03 +0000 (01:28 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 14 Feb 2006 03:02:47 +0000 (03:02 +0000)
This lets us insert a filter program, say a spam checker, between
qmail-smtpd and the mail queue, with the right to refuse a message
before it's accepted by the SMTP server.

Makefile
debian/changelog
qmail.c

index 9230887..6bf4a6c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1483,12 +1483,12 @@ load qmail-send.o qsutil.o control.o constmap.o newfield.o prioq.o \
 trigger.o fmtqfn.o quote.o now.o readsubdir.o qmail.o date822fmt.o \
 datetime.a case.a ndelay.a getln.a wait.a seek.a fd.a sig.a open.a \
 lock.a stralloc.a alloc.a substdio.a error.a str.a fs.a auto_qmail.o \
-auto_split.o
+auto_split.o env.a
        ./load qmail-send qsutil.o control.o constmap.o newfield.o \
        prioq.o trigger.o fmtqfn.o quote.o now.o readsubdir.o \
        qmail.o date822fmt.o datetime.a case.a ndelay.a getln.a \
        wait.a seek.a fd.a sig.a open.a lock.a stralloc.a alloc.a \
-       substdio.a error.a str.a fs.a auto_qmail.o auto_split.o 
+       substdio.a error.a str.a fs.a auto_qmail.o auto_split.o env.a
 
 qmail-send.0: \
 qmail-send.8
index 721be9b..91b7e0d 100644 (file)
@@ -1,6 +1,7 @@
 qmail (1.03-4) non-free; urgency=low
 
   * twiddle build system for missed Debians. 
+  * indirect qmail-queue via QMAILQUEUE environment variable
 
  -- Mark Wooding <mdw@nsict.org>  Wed, 1 Oct 2003 01:16:00 +0100
 
diff --git a/qmail.c b/qmail.c
index 4b7f3ef..9432b4b 100644 (file)
--- a/qmail.c
+++ b/qmail.c
@@ -6,8 +6,17 @@
 #include "fd.h"
 #include "qmail.h"
 #include "auto_qmail.h"
+#include "env.h"
 
-static char *binqqargs[2] = { "/usr/sbin/qmail-queue", 0 } ;
+static char *binqqargs[2] = { 0, 0 } ;
+
+static void setup_qqargs()
+{
+  if(!binqqargs[0])
+    binqqargs[0] = env_get("QMAILQUEUE");
+  if(!binqqargs[0])
+    binqqargs[0] = "/usr/sbin/qmail-queue";
+}
 
 int qmail_open(qq)
 struct qmail *qq;
@@ -15,6 +24,8 @@ struct qmail *qq;
   int pim[2];
   int pie[2];
 
+  setup_qqargs();
+
   if (pipe(pim) == -1) return -1;
   if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }