nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit bfeb1f9e864b4e5b64623f26288c148136f9d694
parent 4b667230f5d92b26795f35d3ae27cb7f1eef8e67
Author: Lightning Bjornsson <lightning@chatspeed.net>
Date:   Sat, 26 Nov 2022 19:22:34 +0000

Added by Amelia(?)

Diffstat:
Mconf-cc | 2+-
Mconf-groups | 4++--
Mconf-ld | 2+-
Mconf-users | 14+++++++-------
Mdefault.o.do.do | 1+
Msrc/mxf-send/mxf-send.c | 27++++++++++++++++++++-------
Msrc/mxf-send/pass.c | 7+++----
Msrc/nmail-smtpd.c | 3++-
Msrc/qmail-remote.c | 13++++++++++---
Msrc/qmail-start-np.c | 3++-
Msrc/sendmail.c | 11++++++-----
11 files changed, 55 insertions(+), 32 deletions(-)

diff --git a/conf-cc b/conf-cc @@ -1,3 +1,3 @@ -cc -g -ggdb3 -O0 -Wall -Iinclude/ +cc -g -ggdb3 -O0 -Iinclude/ -Iinclude/fmxs -DUSING_SKALIBS -I/package/prog/skalibs/include This will be used to compile .c files. diff --git a/conf-groups b/conf-groups @@ -1,5 +1,5 @@ -nmmail -nmnofi +qmail +nofiles These are the qmail groups. The second group should not have access to any files, but it must be usable for processes; this requirement diff --git a/conf-ld b/conf-ld @@ -1,3 +1,3 @@ -cc +cc /package/prog/skalibs/library/libskarnet.a This will be used to link .o files into an executable. diff --git a/conf-users b/conf-users @@ -1,11 +1,11 @@ -nmalias -nmaild -nmaill +alias +qmaild +qmaill root -nmailp -nmailq -nmailr -nmails +qmailp +qmailq +qmailr +qmails The qmail system is heavily partitioned for security; it does almost nothing as root. diff --git a/default.o.do.do b/default.o.do.do @@ -5,6 +5,7 @@ src=$2 # creates default.o.do; requires auto-ccld ?? #redo-ifchange conf-cc conf-ld warn-auto.sh auto-ccld.sh redo-ifchange conf-cc conf-ld warn-auto.sh +redo-ifcreate conf-cc conf-ld warn-auto.sh ( cat warn-auto.sh diff --git a/src/mxf-send/mxf-send.c b/src/mxf-send/mxf-send.c @@ -77,9 +77,9 @@ char strnum3[FMT_ULONG]; char *chanaddr[CHANNELS] = {"local/", "remote/"}; char *chanstatusmsg[CHANNELS] = {" local ", " remote "}; char *tochan[CHANNELS] = {" to local ", " to remote "}; -int chanfdout[CHANNELS] = {1, 3}; -int chanfdin[CHANNELS] = {2, 4}; -int chanskip[CHANNELS] = {10, 20}; +int chanfdout[CHANNELS] = {1, 3}; /* hardcoded FDs as set up by -start are a crock. */ +int chanfdin[CHANNELS] = {2, 4}; /* see above. */ +int chanskip[CHANNELS] = {10, 20}; /* add this many seconds to quadr. retry */ int flagexitasap = 0; void @@ -560,6 +560,7 @@ injectbounce(unsigned long id) qmail_puts(&qqt, "\nTo: "); while (!quote2(&quoted, bouncerecip)) nomem(); + /* MAYBE TODO: import Manvendra's MIME bounce handling code? */ qmail_put(&qqt, quoted.s, quoted.len); qmail_puts(&qqt, "\n\ Subject: Failure Notice\n\ @@ -747,6 +748,10 @@ main(void) struct timeval tv; int c; + /* Bit of a brainage here I guess: + * for use under qmail-start-np, should we accept, on our argv, paths to + * our channelspawns' inputs and outputs? + */ if (chdir(auto_qmail) == -1) { log1("alert: cannot start: unable to switch to home directory\n"); _exit(111); @@ -785,7 +790,7 @@ main(void) r = read(chanfdin[c], &ch, 1); while ((r == -1) && (errno == error_intr)); if (r < 1) { - log1("alert: cannot start: hath the daemon spawn no fire?\n"); + log1("alert: cannot start: hath the daemon spawn no fire? one of my delivery channels didn't start correctly.\n"); _exit(111); } u = (unsigned int)(unsigned char)ch; @@ -822,11 +827,19 @@ main(void) FD_ZERO(&wfds); nfds = 1; - comm_selprep(&nfds, &wfds); + comm_selprep(&nfds, &wfds); /* this isn't arcane at all. /s */ del_selprep(&nfds, &rfds); pass_selprep(&wakeup); todo_selprep(&nfds, &rfds, &wakeup); cleanup_selprep(&wakeup); + /* Lightning brainage: + * So here's what all that actually does. + * It prepares the writability for communication queues. + * It prepares the readability for delivery report FDs. + * It adjusts the earliest time the loop will wake up for the passes. + * It adjusts wakeup and prepares readability for the todo. + * and it adjusts wakeup for cleanup. + */ if (wakeup <= recent) tv.tv_sec = 0; @@ -842,8 +855,8 @@ main(void) else { recent = now(); - //XXX: should have a queue structure - comm_do(&wfds); + //XXX: should have a queue structure + comm_do(&wfds); del_do(&rfds); todo_do(&rfds); pass_do(); diff --git a/src/mxf-send/pass.c b/src/mxf-send/pass.c @@ -23,6 +23,7 @@ pass_init() void pass_selprep(datetime_sec * wakeup) { + /* -Lightning looks confused- Huh? Frick, I need to write a dictionary. */ int c; struct prioq_elt pe; if (flagexitasap) @@ -86,12 +87,10 @@ pass_dochan(int c) { datetime_sec birth; struct prioq_elt pe; - static stralloc line = { - 0 - }; + static stralloc line = {0}; /* TA_ZERO */ int match; - if (flagexitasap) + if (flagexitasap) /* reporting to demob soon, no need to do this */ return; if (!pass[c].id) { diff --git a/src/nmail-smtpd.c b/src/nmail-smtpd.c @@ -353,7 +353,8 @@ addrparse(char *arg) ++arg; } - /* strip source route */ + /* strip source route + * query: should source route really be stripped? L */ if (*arg == '@') while (*arg) if (*arg++ == ':') diff --git a/src/qmail-remote.c b/src/qmail-remote.c @@ -9,6 +9,7 @@ #include "stralloc.h" #endif #include "substdio.h" +#include "bufmissing.h" /* to reset ringbuffers */ #include "subfd.h" #include "scan.h" #include "case.h" @@ -21,7 +22,7 @@ #include "ipalloc.h" #include "ipme.h" #include "gen_alloc.h" -#include "gen_allocdefs.h" +#include "gen_allocdefs.h" /* should use typeallocs de suitcase */ #include "str.h" #include "now.h" #include "exit.h" @@ -56,7 +57,8 @@ saa reciplist = {0}; #define _call_app #define _call_net -/* XXX: should be an ip46full-like object */ +/* XXX: should be an ip46full-like object + * XXX: the future is here! ip_address IS an ip46full-like object! */ _call_app struct ip_address partner; void out(char *s) { @@ -182,6 +184,7 @@ int smtpfdin; int smtpfdou; int timeout = 1200; +/* this is an utter crock. what the fuck is a timeoutread??? */ GEN_SAFE_TIMEOUTREAD(saferead, timeout, smtpfdin, dropped()) GEN_SAFE_TIMEOUTWRITE(safewrite, timeout, smtpfdou, dropped()) @@ -387,6 +390,7 @@ smtp() substdio_putsflush(&smtpto, "QUIT\r\n"); close(smtpfdin); close(smtpfdou); /* Already closed? Doesn't matter. Hildie */ + BUF_HEAD(&smtpfrom) = BUF_TAIL(&smtpfrom); /* clear the buffer - re qmail-get-141331@list.cr.yp.to */ return; } @@ -419,6 +423,8 @@ smtp() quit("ZConnected to ", " but sender was deferred"); flagbother = 0; + /* strange: qmail-remote is capable of multiple recipients, but + * is only ever fed just one. éh? Lightning */ for (i = 0; i < reciplist.len; ++i) { substdio_puts(&smtpto, "RCPT TO:<"); substdio_put(&smtpto, reciplist.sa[i].s, reciplist.sa[i].len); @@ -643,7 +649,8 @@ main(int argc, char **argv) tcpto_err(&ip.ix[i].ip, 0); partner = ip.ix[i].ip; _call_app smtp(); /* does not return, unless greeting - * wrong */ + * wrong + * smtp() would be the entry point of a qmail-remote-app*/ } tcpto_err(&ip.ix[i].ip, errno == error_timeout); close(smtpfdin); diff --git a/src/qmail-start-np.c b/src/qmail-start-np.c @@ -50,7 +50,7 @@ gid_t auto_gidq; void close23456() { close(2); close(3); close(4); close(5); close(6); } -// sort of same semantics as pipe() except that it returns the pipe instead of setting memory +// sort of same semantics as pipe() int makeorusenp(char *n, int *f) { if (fifo_make(n, 0600) == -1) { if (errno != EEXIST) { @@ -188,6 +188,7 @@ int main(int argc, char **argv) // this can only mean one thing: someone wrote to our readiness FD. // that means they now have the WRENDs of the loggersin and chanNsin // pipes. + _exit(0); // we can now report. } } diff --git a/src/sendmail.c b/src/sendmail.c @@ -132,8 +132,8 @@ int main(int argc, char **argv) case 'b': switch(optarg[0]) { case 'm': break; - case 'd': die_exptcps(); // explain TCP servers to the user - case 'D': die_exptcps(); // who is probably echt confused + case 'd': die_exptcps(); /* explain TCP servers to the user */ + case 'D': die_exptcps(); /* who is probably echt confused */ case 'p': mailq(); case 's': smtpd(); default: die_usage(); @@ -144,7 +144,7 @@ int main(int argc, char **argv) } argc -= optind; argv += optind; - + if (str_equal(optprogname,"mailq")) mailq(); @@ -155,7 +155,8 @@ int main(int argc, char **argv) qiargv = (char **) alloc((argc + 10) * sizeof(char *)); if (!qiargv) nomem(); - + /* This is arcane: qiargv is... a pointer to 10+argc pointers to char arrays. + * This kind of arcana confuses dragons. We don't work in nuances. */ arg = qiargv; *arg++ = "bin/qmail-inject"; *arg++ = (flagh ? "-H" : "-a"); @@ -167,7 +168,7 @@ int main(int argc, char **argv) *arg++ = "--"; for (i = 0;i < argc;++i) *arg++ = argv[i]; *arg = 0; - + execv(*qiargv,qiargv); substdio_putsflush(subfderr,"sendmail: fatal: unable to run qmail-inject\n"); return 111;