commit 626e9a5a860a4a187bd0188b0019c72514da1ef7
parent 1beb767af91f28fd619421a46c885a8a48034ef3
Author: Amitai Schleier <schmonz-web-git@schmonz.com>
Date: Mon, 26 Aug 2019 12:21:31 -0400
Remove qsmhook, long since replaced by preline.
Diffstat:
6 files changed, 3 insertions(+), 156 deletions(-)
diff --git a/CHANGES b/CHANGES
@@ -1,3 +1,4 @@
+20200523 cleanup: remove qsmhook, replaced by preline.
20200520 remove wrappers for obsolete mail clients without maildir support
20200520 version: notqmail 1.08.
20200519 bug: fix several other places where variables could overflow.
diff --git a/Makefile b/Makefile
@@ -785,7 +785,7 @@ 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-smtpd sendmail tcp-env qmail-newmrh config config-fast \
-dnsptr dnsip dnsfq hostname ipmeprint qreceipt qsmhook qbiff \
+dnsptr dnsip dnsfq hostname ipmeprint qreceipt qbiff \
forward preline condredirect bouncesaying except maildirmake \
maildir2mbox maildirwatch install instpackage instchown \
instcheck home home+df proc proc+df binm1 binm1+df binm2 binm2+df \
@@ -1604,18 +1604,6 @@ gen_alloc.h error.h gen_alloc.h gen_allocdefs.h headerbody.h exit.h \
open.h quote.h qmail.h substdio.h oflops.h error.h
./compile qreceipt.c
-qsmhook: \
-load qsmhook.o sig.a case.a fd.a wait.a getopt.a env.a stralloc.a \
-substdio.a error.a str.a
- ./load qsmhook sig.a case.a fd.a wait.a getopt.a env.a \
- stralloc.a substdio.a error.a str.a
-
-qsmhook.o: \
-compile qsmhook.c fd.h stralloc.h gen_alloc.h readwrite.h sgetopt.h \
-subgetopt.h wait.h env.h byte.h str.h alloc.h exit.h fork.h case.h \
-subfd.h substdio.h error.h substdio.h sig.h
- ./compile qsmhook.c
-
qsutil.o: \
compile qsutil.c stralloc.h gen_alloc.h readwrite.h substdio.h \
qsutil.h
diff --git a/TARGETS b/TARGETS
@@ -289,8 +289,6 @@ ipmeprint.o
ipmeprint
qreceipt.o
qreceipt
-qsmhook.o
-qsmhook
qbiff.o
qbiff
forward.o
diff --git a/THOUGHTS b/THOUGHTS
@@ -386,9 +386,7 @@ separately; they're almost entirely different objects!
9. Miscellany
-sendmail-clone and qsmhook are too bletcherous to be documented. (The
-official replacement for qsmhook is preline, together with the
-qmail-command environment variables.)
+sendmail-clone is too bletcherous to be documented.
I've considered making install atomic, but this is very difficult to do
right, and pointless if it isn't done right.
diff --git a/hier.c b/hier.c
@@ -130,7 +130,6 @@ void hier()
c(auto_qmail,"bin","sendmail",auto_uido,auto_gidq,0755);
c(auto_qmail,"bin","tcp-env",auto_uido,auto_gidq,0755);
c(auto_qmail,"bin","qreceipt",auto_uido,auto_gidq,0755);
- c(auto_qmail,"bin","qsmhook",auto_uido,auto_gidq,0755);
c(auto_qmail,"bin","qbiff",auto_uido,auto_gidq,0755);
c(auto_qmail,"bin","forward",auto_uido,auto_gidq,0755);
c(auto_qmail,"bin","preline",auto_uido,auto_gidq,0755);
diff --git a/qsmhook.c b/qsmhook.c
@@ -1,137 +0,0 @@
-#include "fd.h"
-#include "stralloc.h"
-#include "readwrite.h"
-#include "sgetopt.h"
-#include "wait.h"
-#include "env.h"
-#include "byte.h"
-#include "str.h"
-#include "alloc.h"
-#include "exit.h"
-#include "fork.h"
-#include "case.h"
-#include "subfd.h"
-#include "error.h"
-#include "substdio.h"
-#include "sig.h"
-
-void die(e,s) int e; char *s; { substdio_putsflush(subfderr,s); _exit(e); }
-void die_usage() { die(100,"qsmhook: fatal: incorrect usage\n"); }
-void die_temp() { die(111,"qsmhook: fatal: temporary problem\n"); }
-void die_read() { die(111,"qsmhook: fatal: unable to read message\n"); }
-void die_badcmd() { die(100,"qsmhook: fatal: command not found\n"); }
-
-int flagrpline = 0; char *rpline;
-int flagufline = 1; char *ufline;
-int flagdtline = 0; char *dtline;
-char *host;
-char *sender;
-char *recip;
-
-stralloc newarg = {0};
-
-substdio ssout;
-char outbuf[SUBSTDIO_OUTSIZE];
-substdio ssin;
-char inbuf[SUBSTDIO_INSIZE];
-
-void main(argc,argv)
-int argc;
-char **argv;
-{
- int pid;
- int wstat;
- int pi[2];
- int opt;
- char **arg;
- char *x;
- unsigned int i;
- int flagesc;
-
- sig_pipeignore();
-
- if (!(dtline = env_get("DTLINE"))) die_usage();
- if (!(rpline = env_get("RPLINE"))) die_usage();
- if (!(ufline = env_get("UFLINE"))) die_usage();
- if (!(recip = env_get("LOCAL"))) die_usage();
- if (!(host = env_get("HOST"))) die_usage();
- if (!(sender = env_get("SENDER"))) die_usage();
-
- while ((opt = getopt(argc,argv,"DFlMmnPsx:")) != opteof)
- switch(opt)
- {
- case 'D': case 'F': case 'M': break; /* be serious */
- case 'l': flagdtline = 1; break; /* also return-receipt-to? blech */
- case 'm': break; /* we only handle one recipient anyway */
- case 'n': flagufline = 0; break;
- case 's': break; /* could call quote() otherwise, i suppose... */
- case 'P': flagrpline = 1; break;
- case 'x':
- if (case_starts(recip,optarg))
- recip += str_len(optarg);
- break;
- default:
- _exit(100);
- }
- argc -= optind;
- argv += optind;
-
- if (!*argv) die_usage();
-
- for (arg = argv;x = *arg;++arg)
- {
- if (!stralloc_copys(&newarg,"")) die_temp();
- flagesc = 0;
- for (i = 0;x[i];++i)
- if (flagesc)
- {
- switch(x[i])
- {
- case '%': if (!stralloc_cats(&newarg,"%")) die_temp(); break;
- case 'g': if (!stralloc_cats(&newarg,sender)) die_temp(); break;
- case 'h': if (!stralloc_cats(&newarg,host)) die_temp(); break;
- case 'u': if (!stralloc_cats(&newarg,recip)) die_temp(); break;
- }
- flagesc = 0;
- }
- else
- if (x[i] == '%')
- flagesc = 1;
- else
- if (!stralloc_append(&newarg,&x[i])) die_temp();
- if (!stralloc_0(&newarg)) die_temp();
- i = str_len(newarg.s) + 1;
- if (!(x = alloc(i))) die_temp();
- byte_copy(x,i,newarg.s);
- *arg = x;
- }
-
- if (pipe(pi) == -1) die_temp();
-
- switch(pid = fork())
- {
- case -1:
- die_temp();
- case 0:
- close(pi[1]);
- if (fd_move(0,pi[0]) == -1) die_temp();
- sig_pipedefault();
- execvp(*argv,argv);
- if (error_temp(errno)) die_temp();
- die_badcmd();
- }
- close(pi[0]);
-
- substdio_fdbuf(&ssout,write,pi[1],outbuf,sizeof(outbuf));
- substdio_fdbuf(&ssin,read,0,inbuf,sizeof(inbuf));
- if (flagufline) substdio_bputs(&ssout,ufline);
- if (flagrpline) substdio_bputs(&ssout,rpline);
- if (flagdtline) substdio_bputs(&ssout,dtline);
- if (substdio_copy(&ssout,&ssin) == -2) die_read();
- substdio_flush(&ssout);
- close(pi[1]);
-
- if (wait_pid(&wstat,pid) == -1) die_temp();
- if (wait_crashed(wstat)) die_temp();
- _exit(wait_exitcode(wstat));
-}