pristine/qmailqueue-patch
changeset 1 b375914441b2
equal deleted inserted replaced
0:5766d031ef25 1:b375914441b2
       
     1 From: Bruce Guenter <bguenter-djb-qmail@qcc.sk.ca>
       
     2 To: qmail@list.cr.yp.to
       
     3 Subject: QMAILQUEUE patch for qmail-1.03
       
     4 Date: Mon, 25 Jan 1999 15:37:21 -0600
       
     5 
       
     6 Greetings.
       
     7 
       
     8 Appended is a patch to qmail-1.03 that causes any program that would run
       
     9 qmail-queue to look for an environment variable QMAILQUEUE.  If it is
       
    10 present, it is used in place of the string "bin/qmail-queue" when
       
    11 running qmail-queue.  This could be used, for example, to add a program
       
    12 into the qmail-smtpd->qmail-queue pipeline that could do filtering,
       
    13 rewrite broken headers, etc. (this is my planned usage for it).
       
    14 
       
    15 This has undergone virtually no testing, but it looks so simple that it
       
    16 almost has to be correct.  No warranties, etc.  Note that the chdir to
       
    17 /var/qmail is always done before exec'ing the program.
       
    18 
       
    19 Does this look like a reasonable thing to do?
       
    20 -- 
       
    21 Bruce Guenter, QCC Communications Corp.  EMail: bruce.guenter@qcc.sk.ca
       
    22 Phone: (306)249-0220               WWW: http://www.qcc.sk.ca/~bguenter/
       
    23 
       
    24 diff -u qmail-1.03-orig/Makefile qmail-1.03/Makefile
       
    25 --- qmail-1.03-orig/Makefile	Mon Jun 15 04:53:16 1998
       
    26 +++ qmail-1.03/Makefile	Tue Jan 19 10:52:24 1999
       
    27 @@ -1483,12 +1483,12 @@
       
    28  trigger.o fmtqfn.o quote.o now.o readsubdir.o qmail.o date822fmt.o \
       
    29  datetime.a case.a ndelay.a getln.a wait.a seek.a fd.a sig.a open.a \
       
    30  lock.a stralloc.a alloc.a substdio.a error.a str.a fs.a auto_qmail.o \
       
    31 -auto_split.o
       
    32 +auto_split.o env.a
       
    33  	./load qmail-send qsutil.o control.o constmap.o newfield.o \
       
    34  	prioq.o trigger.o fmtqfn.o quote.o now.o readsubdir.o \
       
    35  	qmail.o date822fmt.o datetime.a case.a ndelay.a getln.a \
       
    36  	wait.a seek.a fd.a sig.a open.a lock.a stralloc.a alloc.a \
       
    37 -	substdio.a error.a str.a fs.a auto_qmail.o auto_split.o 
       
    38 +	substdio.a error.a str.a fs.a auto_qmail.o auto_split.o env.a
       
    39  
       
    40  qmail-send.0: \
       
    41  qmail-send.8
       
    42 diff -u qmail-1.03-orig/qmail.c qmail-1.03/qmail.c
       
    43 --- qmail-1.03-orig/qmail.c	Mon Jun 15 04:53:16 1998
       
    44 +++ qmail-1.03/qmail.c	Tue Jan 19 09:57:36 1999
       
    45 @@ -6,14 +6,25 @@
       
    46  #include "fd.h"
       
    47  #include "qmail.h"
       
    48  #include "auto_qmail.h"
       
    49 +#include "env.h"
       
    50  
       
    51 -static char *binqqargs[2] = { "bin/qmail-queue", 0 } ;
       
    52 +static char *binqqargs[2] = { 0, 0 } ;
       
    53 +
       
    54 +static void setup_qqargs()
       
    55 +{
       
    56 +  if(!binqqargs[0])
       
    57 +    binqqargs[0] = env_get("QMAILQUEUE");
       
    58 +  if(!binqqargs[0])
       
    59 +    binqqargs[0] = "bin/qmail-queue";
       
    60 +}
       
    61  
       
    62  int qmail_open(qq)
       
    63  struct qmail *qq;
       
    64  {
       
    65    int pim[2];
       
    66    int pie[2];
       
    67 +
       
    68 +  setup_qqargs();
       
    69  
       
    70    if (pipe(pim) == -1) return -1;
       
    71    if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }
       
    72