Re: QMAILREMOTE patch
Manvendra Bhangui <[email protected]> Tue, 23 May 2017 09:51:24 +0530
| Newsgroups | gmane.mail.qmail.general |
|---|---|
| Message-ID | <CAOqj+1ML5H-=vCaF+ZYoNyHiVZTsxoATx+HAj9XJzHN-L4B6UA@mail.gmail.com> |
On 21 May 2017 at 17:57, Amitai Schleier < [email protected]> wrote: > A friend wants to DKIM-sign outgoing mail, probably using Kyle Wheeler's > DKIM wrapper around qmail-remote (http://www.memoryhole.net/qmail/#dkim). > But he doesn't want to confuse his package manager by moving aside the real > qmail-remote binary and putting something else in its place. > > Inspired by the QMAILQUEUE patch, we patched qmail-rspawn to look for > QMAILREMOTE in its environment. The 0th arg to execvp() is either the value > of the env var (if set), or "qmail-remote" as usual. We tested with various > arguments to qmail-start. > > Nice and quite useful. Have done exactly the same. I use the same variable QMAILREMOTE. Additionally, I have modified qmail-lspawn.c to use QMAILLOCAL and call a binary other than qmail-local. Use it for doing DKIM verification. I use the variables QMAILLOCAL and QMAILREMOTE to run some filters before the actual delivery attempt. > > Does this patch look reasonable? > > Yes, it does. Rather than moving the original binary, it helps preserve the binary checksum. rpm -V does not complain. If the path defined by QMAILREMOTE does not exist, the qmail-send logs will contain the standard error message "Unable to run qmail-remote" > --- Makefile.orig 2007-11-30 20:22:54.000000000 +0000 > +++ Makefile > @@ -1462,19 +1462,19 @@ tcpto.h readwrite.h timeoutconn.h timeou > > qmail-rspawn: \ > load qmail-rspawn.o spawn.o tcpto_clean.o now.o coe.o sig.a open.a \ > -seek.a lock.a wait.a fd.a stralloc.a alloc.a substdio.a error.a str.a \ > +seek.a lock.a wait.a fd.a stralloc.a alloc.a substdio.a error.a env.a > str.a \ > auto_qmail.o auto_uids.o auto_spawn.o > ./load qmail-rspawn spawn.o tcpto_clean.o now.o coe.o \ > sig.a open.a seek.a lock.a wait.a fd.a stralloc.a alloc.a \ > - substdio.a error.a str.a auto_qmail.o auto_uids.o \ > - auto_spawn.o > + substdio.a error.a env.a str.a auto_qmail.o auto_uids.o \ > + auto_spawn.o > > qmail-rspawn.0: \ > qmail-rspawn.8 > nroff -man qmail-rspawn.8 > qmail-rspawn.0 > > qmail-rspawn.o: \ > -compile qmail-rspawn.c fd.h wait.h substdio.h exit.h fork.h error.h \ > +compile qmail-rspawn.c fd.h wait.h substdio.h exit.h fork.h error.h env.h > \ > tcpto.h > ./compile qmail-rspawn.c > > --- qmail-rspawn.c.orig 1998-06-15 10:53:16.000000000 +0000 > +++ qmail-rspawn.c > @@ -5,6 +5,17 @@ > #include "fork.h" > #include "error.h" > #include "tcpto.h" > +#include "env.h" > + > +static char *qrargs[1] = { 0 }; > + > +static void setup_qrargs() > +{ > + if (!qrargs[0]) > + qrargs[0] = env_get("QMAILREMOTE"); > + if(!qrargs[0]) > + qrargs[0] = "qmail-remote"; > +} > > void initialize(argc,argv) > int argc; > @@ -84,7 +95,9 @@ char *s; char *r; int at; > int f; > char *(args[5]); > > - args[0] = "qmail-remote"; > + setup_qrargs(); > + > + args[0] = qrargs[0]; > args[1] = r + at + 1; > args[2] = s; > args[3] = r; > -- Regards Manvendra - http://www.indimail.org GPG Pub Key http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC7CBC760014D250C