summaryrefslogtreecommitdiff
path: root/user/netqmail
diff options
context:
space:
mode:
Diffstat (limited to 'user/netqmail')
-rw-r--r--user/netqmail/0001-DESTDIR.patch576
-rw-r--r--user/netqmail/0002-qbiffutmpx-20170820.patch130
-rw-r--r--user/netqmail/0003-qmailremote-20170716.patch62
-rw-r--r--user/netqmail/0004-notifyfd.patch41
-rw-r--r--user/netqmail/APKBUILD114
-rw-r--r--user/netqmail/netqmail.confd49
-rw-r--r--user/netqmail/netqmail.initd153
-rw-r--r--user/netqmail/netqmail.post-install22
-rw-r--r--user/netqmail/netqmail.pre-deinstall5
-rw-r--r--user/netqmail/qmail.run5
-rw-r--r--user/netqmail/smtpd.run9
-rw-r--r--user/netqmail/smtpsd.run8
12 files changed, 1174 insertions, 0 deletions
diff --git a/user/netqmail/0001-DESTDIR.patch b/user/netqmail/0001-DESTDIR.patch
new file mode 100644
index 000000000..30dba79a6
--- /dev/null
+++ b/user/netqmail/0001-DESTDIR.patch
@@ -0,0 +1,576 @@
+--- netqmail-1.06.old/Makefile
++++ netqmail-1.06/Makefile
+@@ -21,9 +21,10 @@
+ ./compile alloc_re.c
+
+ auto-ccld.sh: \
+-conf-cc conf-ld warn-auto.sh
++conf-cc conf-ld conf-ldi warn-auto.sh
+ ( cat warn-auto.sh; \
+ echo CC=\'`head -1 conf-cc`\'; \
++ echo LDI=\'`head -1 conf-ldi`\'; \
+ echo LD=\'`head -1 conf-ld`\' \
+ ) > auto-ccld.sh
+
+@@ -702,7 +703,7 @@
+ ./compile hfield.c
+
+ hier.o: \
+-compile hier.c auto_qmail.h auto_split.h auto_uids.h fmt.h fifo.h
++compile hier.c auto_qmail.h auto_split.h auto_uids.h fmt.h fifo.h stralloc.h
+ ./compile hier.c
+
+ home: \
+@@ -740,15 +741,15 @@
+ ./compile idedit.c
+
+ install: \
+-load install.o fifo.o hier.o auto_qmail.o auto_split.o auto_uids.o \
+-strerr.a substdio.a open.a error.a str.a fs.a
+- ./load install fifo.o hier.o auto_qmail.o auto_split.o \
+- auto_uids.o strerr.a substdio.a open.a error.a str.a fs.a
++loadi install.o fifo.o hier.o auto_qmail.o auto_split.o auto_uids.o \
++strerr.a substdio.a open.a error.a str.a fs.a stralloc.a alloc.a
++ ./loadi install fifo.o hier.o auto_qmail.o auto_split.o \
++ auto_uids.o strerr.a substdio.a open.a error.a str.a fs.a stralloc.a alloc.a
+
+ install-big: \
+-load install-big.o fifo.o install.o auto_qmail.o auto_split.o \
++loadi install-big.o fifo.o install.o auto_qmail.o auto_split.o \
+ auto_uids.o strerr.a substdio.a open.a error.a str.a fs.a
+- ./load install-big fifo.o install.o auto_qmail.o \
++ ./loadi install-big fifo.o install.o auto_qmail.o \
+ auto_split.o auto_uids.o strerr.a substdio.a open.a error.a \
+ str.a fs.a
+
+@@ -763,10 +764,10 @@
+ ./compile install.c
+
+ instcheck: \
+-load instcheck.o fifo.o hier.o auto_qmail.o auto_split.o auto_uids.o \
+-strerr.a substdio.a error.a str.a fs.a
+- ./load instcheck fifo.o hier.o auto_qmail.o auto_split.o \
+- auto_uids.o strerr.a substdio.a error.a str.a fs.a
++loadi instcheck.o fifo.o hier.o auto_qmail.o auto_split.o auto_uids.o \
++strerr.a substdio.a error.a str.a fs.a stralloc.a alloc.a
++ ./loadi instcheck fifo.o hier.o auto_qmail.o auto_split.o \
++ auto_uids.o strerr.a substdio.a error.a str.a fs.a stralloc.a alloc.a
+
+ instcheck.o: \
+ compile instcheck.c strerr.h error.h readwrite.h exit.h
+@@ -815,6 +816,11 @@
+ ( cat warn-auto.sh; ./make-load "`cat systype`" ) > load
+ chmod 755 load
+
++loadi: \
++make-loadi warn-auto.sh systype
++ ( cat warn-auto.sh; ./make-loadi "`cat systype`" ) > loadi
++ chmod 755 loadi
++
+ lock.a: \
+ makelib lock_ex.o lock_exnb.o lock_un.o
+ ./makelib lock.a lock_ex.o lock_exnb.o lock_un.o
+@@ -912,6 +918,11 @@
+ make-load.sh auto-ccld.sh
+ cat auto-ccld.sh make-load.sh > make-load
+ chmod 755 make-load
++
++make-loadi: \
++make-loadi.sh auto-ccld.sh
++ cat auto-ccld.sh make-loadi.sh > make-loadi
++ chmod 755 make-loadi
+
+ make-makelib: \
+ make-makelib.sh auto-ccld.sh
+--- netqmail-1.06.old/TARGETS
++++ netqmail-1.06/TARGETS
+@@ -1,8 +1,10 @@
+ auto-ccld.sh
+ make-load
++make-loadi
+ find-systype
+ systype
+ load
++loadi
+ make-compile
+ compile
+ fork.h
+--- netqmail-1.06.old/hier.c
++++ netqmail-1.06/hier.c
+@@ -1,3 +1,5 @@
++#include <stdlib.h>
++#include "stralloc.h"
+ #include "auto_qmail.h"
+ #include "auto_split.h"
+ #include "auto_uids.h"
+@@ -6,6 +8,19 @@
+
+ char buf[100 + FMT_ULONG];
+
++static char *base_qmail ;
++
++static void base_init (void)
++{
++ static stralloc sa = { 0 } ;
++ char *x = getenv("DESTDIR") ;
++ sa.len = 0 ;
++ if (x) stralloc_cats(&sa, x) ;
++ stralloc_cats(&sa, auto_qmail) ;
++ stralloc_0(&sa) ;
++ base_qmail = sa.s ;
++}
++
+ void dsplit(base,uid,mode)
+ char *base; /* must be under 100 bytes */
+ int uid;
+@@ -14,7 +29,7 @@
+ char *x;
+ unsigned long i;
+
+- d(auto_qmail,base,uid,auto_gidq,mode);
++ d(base_qmail,base,uid,auto_gidq,mode);
+
+ for (i = 0;i < auto_split;++i) {
+ x = buf;
+@@ -23,230 +38,231 @@
+ x += fmt_ulong(x,i);
+ *x = 0;
+
+- d(auto_qmail,buf,uid,auto_gidq,mode);
++ d(base_qmail,buf,uid,auto_gidq,mode);
+ }
+ }
+
+ void hier()
+ {
+- h(auto_qmail,auto_uido,auto_gidq,0755);
++ base_init() ;
++ h(base_qmail,auto_uido,auto_gidq,0755);
+
+- d(auto_qmail,"control",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"users",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"bin",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"boot",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"doc",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"man",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"man/cat1",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"man/cat5",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"man/cat7",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"man/cat8",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"man/man1",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"man/man5",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"man/man7",auto_uido,auto_gidq,0755);
+- d(auto_qmail,"man/man8",auto_uido,auto_gidq,0755);
++ d(base_qmail,"control",auto_uido,auto_gidq,0755);
++ d(base_qmail,"users",auto_uido,auto_gidq,0755);
++ d(base_qmail,"bin",auto_uido,auto_gidq,0755);
++ d(base_qmail,"boot",auto_uido,auto_gidq,0755);
++ d(base_qmail,"doc",auto_uido,auto_gidq,0755);
++ d(base_qmail,"man",auto_uido,auto_gidq,0755);
++ d(base_qmail,"man/cat1",auto_uido,auto_gidq,0755);
++ d(base_qmail,"man/cat5",auto_uido,auto_gidq,0755);
++ d(base_qmail,"man/cat7",auto_uido,auto_gidq,0755);
++ d(base_qmail,"man/cat8",auto_uido,auto_gidq,0755);
++ d(base_qmail,"man/man1",auto_uido,auto_gidq,0755);
++ d(base_qmail,"man/man5",auto_uido,auto_gidq,0755);
++ d(base_qmail,"man/man7",auto_uido,auto_gidq,0755);
++ d(base_qmail,"man/man8",auto_uido,auto_gidq,0755);
+
+- d(auto_qmail,"alias",auto_uida,auto_gidq,02755);
++ d(base_qmail,"alias",auto_uida,auto_gidq,02755);
+
+- d(auto_qmail,"queue",auto_uidq,auto_gidq,0750);
+- d(auto_qmail,"queue/pid",auto_uidq,auto_gidq,0700);
+- d(auto_qmail,"queue/intd",auto_uidq,auto_gidq,0700);
+- d(auto_qmail,"queue/todo",auto_uidq,auto_gidq,0750);
+- d(auto_qmail,"queue/bounce",auto_uids,auto_gidq,0700);
++ d(base_qmail,"queue",auto_uidq,auto_gidq,0750);
++ d(base_qmail,"queue/pid",auto_uidq,auto_gidq,0700);
++ d(base_qmail,"queue/intd",auto_uidq,auto_gidq,0700);
++ d(base_qmail,"queue/todo",auto_uidq,auto_gidq,0750);
++ d(base_qmail,"queue/bounce",auto_uids,auto_gidq,0700);
+
+ dsplit("queue/mess",auto_uidq,0750);
+ dsplit("queue/info",auto_uids,0700);
+ dsplit("queue/local",auto_uids,0700);
+ dsplit("queue/remote",auto_uids,0700);
+
+- d(auto_qmail,"queue/lock",auto_uidq,auto_gidq,0750);
+- z(auto_qmail,"queue/lock/tcpto",1024,auto_uidr,auto_gidq,0644);
+- z(auto_qmail,"queue/lock/sendmutex",0,auto_uids,auto_gidq,0600);
+- p(auto_qmail,"queue/lock/trigger",auto_uids,auto_gidq,0622);
++ d(base_qmail,"queue/lock",auto_uidq,auto_gidq,0750);
++ z(base_qmail,"queue/lock/tcpto",1024,auto_uidr,auto_gidq,0644);
++ z(base_qmail,"queue/lock/sendmutex",0,auto_uids,auto_gidq,0600);
++ p(base_qmail,"queue/lock/trigger",auto_uids,auto_gidq,0622);
+
+- c(auto_qmail,"boot","home",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"boot","home+df",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"boot","proc",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"boot","proc+df",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"boot","binm1",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"boot","binm1+df",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"boot","binm2",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"boot","binm2+df",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"boot","binm3",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"boot","binm3+df",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","home",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","home+df",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","proc",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","proc+df",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","binm1",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","binm1+df",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","binm2",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","binm2+df",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","binm3",auto_uido,auto_gidq,0755);
++ c(base_qmail,"boot","binm3+df",auto_uido,auto_gidq,0755);
+
+- c(auto_qmail,"doc","FAQ",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","UPGRADE",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","SENDMAIL",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","INSTALL",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","INSTALL.alias",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","INSTALL.ctl",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","INSTALL.ids",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","INSTALL.maildir",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","INSTALL.mbox",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","INSTALL.vsm",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","TEST.deliver",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","TEST.receive",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","REMOVE.sendmail",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","REMOVE.binmail",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","PIC.local2alias",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","PIC.local2ext",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","PIC.local2local",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","PIC.local2rem",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","PIC.local2virt",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","PIC.nullclient",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","PIC.relaybad",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","PIC.relaygood",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"doc","PIC.rem2local",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","FAQ",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","UPGRADE",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","SENDMAIL",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","INSTALL",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","INSTALL.alias",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","INSTALL.ctl",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","INSTALL.ids",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","INSTALL.maildir",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","INSTALL.mbox",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","INSTALL.vsm",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","TEST.deliver",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","TEST.receive",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","REMOVE.sendmail",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","REMOVE.binmail",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","PIC.local2alias",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","PIC.local2ext",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","PIC.local2local",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","PIC.local2rem",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","PIC.local2virt",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","PIC.nullclient",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","PIC.relaybad",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","PIC.relaygood",auto_uido,auto_gidq,0644);
++ c(base_qmail,"doc","PIC.rem2local",auto_uido,auto_gidq,0644);
+
+- c(auto_qmail,"bin","qmail-queue",auto_uidq,auto_gidq,04711);
+- c(auto_qmail,"bin","qmail-lspawn",auto_uido,auto_gidq,0700);
+- c(auto_qmail,"bin","qmail-start",auto_uido,auto_gidq,0700);
+- c(auto_qmail,"bin","qmail-getpw",auto_uido,auto_gidq,0711);
+- c(auto_qmail,"bin","qmail-local",auto_uido,auto_gidq,0711);
+- c(auto_qmail,"bin","qmail-remote",auto_uido,auto_gidq,0711);
+- c(auto_qmail,"bin","qmail-rspawn",auto_uido,auto_gidq,0711);
+- c(auto_qmail,"bin","qmail-clean",auto_uido,auto_gidq,0711);
+- c(auto_qmail,"bin","qmail-send",auto_uido,auto_gidq,0711);
+- c(auto_qmail,"bin","splogger",auto_uido,auto_gidq,0711);
+- c(auto_qmail,"bin","qmail-newu",auto_uido,auto_gidq,0700);
+- c(auto_qmail,"bin","qmail-newmrh",auto_uido,auto_gidq,0700);
+- c(auto_qmail,"bin","qmail-pw2u",auto_uido,auto_gidq,0711);
+- c(auto_qmail,"bin","qmail-inject",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","predate",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","datemail",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","mailsubj",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-showctl",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-qread",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-qstat",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-tcpto",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-tcpok",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-pop3d",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-popup",auto_uido,auto_gidq,0711);
+- c(auto_qmail,"bin","qmail-qmqpc",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-qmqpd",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-qmtpd",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qmail-smtpd",auto_uido,auto_gidq,0755);
+- 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);
+- c(auto_qmail,"bin","condredirect",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","bouncesaying",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","except",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","maildirmake",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","maildir2mbox",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","maildirwatch",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","qail",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","elq",auto_uido,auto_gidq,0755);
+- c(auto_qmail,"bin","pinq",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-queue",auto_uidq,auto_gidq,04711);
++ c(base_qmail,"bin","qmail-lspawn",auto_uido,auto_gidq,0700);
++ c(base_qmail,"bin","qmail-start",auto_uido,auto_gidq,0700);
++ c(base_qmail,"bin","qmail-getpw",auto_uido,auto_gidq,0711);
++ c(base_qmail,"bin","qmail-local",auto_uido,auto_gidq,0711);
++ c(base_qmail,"bin","qmail-remote",auto_uido,auto_gidq,0711);
++ c(base_qmail,"bin","qmail-rspawn",auto_uido,auto_gidq,0711);
++ c(base_qmail,"bin","qmail-clean",auto_uido,auto_gidq,0711);
++ c(base_qmail,"bin","qmail-send",auto_uido,auto_gidq,0711);
++ c(base_qmail,"bin","splogger",auto_uido,auto_gidq,0711);
++ c(base_qmail,"bin","qmail-newu",auto_uido,auto_gidq,0700);
++ c(base_qmail,"bin","qmail-newmrh",auto_uido,auto_gidq,0700);
++ c(base_qmail,"bin","qmail-pw2u",auto_uido,auto_gidq,0711);
++ c(base_qmail,"bin","qmail-inject",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","predate",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","datemail",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","mailsubj",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-showctl",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-qread",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-qstat",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-tcpto",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-tcpok",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-pop3d",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-popup",auto_uido,auto_gidq,0711);
++ c(base_qmail,"bin","qmail-qmqpc",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-qmqpd",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-qmtpd",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qmail-smtpd",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","sendmail",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","tcp-env",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qreceipt",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qsmhook",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qbiff",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","forward",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","preline",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","condredirect",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","bouncesaying",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","except",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","maildirmake",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","maildir2mbox",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","maildirwatch",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","qail",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","elq",auto_uido,auto_gidq,0755);
++ c(base_qmail,"bin","pinq",auto_uido,auto_gidq,0755);
+
+- c(auto_qmail,"man/man5","addresses.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","addresses.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man5","envelopes.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","envelopes.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man5","maildir.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","maildir.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man5","mbox.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","mbox.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man5","dot-qmail.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","dot-qmail.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man5","qmail-control.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","qmail-control.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man5","qmail-header.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","qmail-header.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man5","qmail-log.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","qmail-log.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man5","qmail-users.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","qmail-users.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man5","tcp-environ.5",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat5","tcp-environ.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","addresses.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","addresses.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","envelopes.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","envelopes.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","maildir.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","maildir.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","mbox.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","mbox.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","dot-qmail.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","dot-qmail.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","qmail-control.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","qmail-control.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","qmail-header.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","qmail-header.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","qmail-log.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","qmail-log.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","qmail-users.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","qmail-users.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man5","tcp-environ.5",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat5","tcp-environ.0",auto_uido,auto_gidq,0644);
+
+- c(auto_qmail,"man/man7","forgeries.7",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat7","forgeries.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man7","qmail-limits.7",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat7","qmail-limits.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man7","qmail.7",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat7","qmail.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man7","forgeries.7",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat7","forgeries.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man7","qmail-limits.7",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat7","qmail-limits.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man7","qmail.7",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat7","qmail.0",auto_uido,auto_gidq,0644);
+
+- c(auto_qmail,"man/man1","forward.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","forward.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","condredirect.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","condredirect.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","bouncesaying.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","bouncesaying.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","except.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","except.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","maildirmake.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","maildirmake.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","maildir2mbox.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","maildir2mbox.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","maildirwatch.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","maildirwatch.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","mailsubj.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","mailsubj.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","qreceipt.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","qreceipt.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","qbiff.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","qbiff.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","preline.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","preline.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man1","tcp-env.1",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat1","tcp-env.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","forward.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","forward.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","condredirect.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","condredirect.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","bouncesaying.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","bouncesaying.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","except.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","except.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","maildirmake.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","maildirmake.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","maildir2mbox.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","maildir2mbox.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","maildirwatch.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","maildirwatch.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","mailsubj.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","mailsubj.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","qreceipt.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","qreceipt.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","qbiff.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","qbiff.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","preline.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","preline.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man1","tcp-env.1",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat1","tcp-env.0",auto_uido,auto_gidq,0644);
+
+- c(auto_qmail,"man/man8","qmail-local.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-local.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-lspawn.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-lspawn.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-getpw.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-getpw.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-remote.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-remote.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-rspawn.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-rspawn.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-clean.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-clean.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-send.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-send.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-start.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-start.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","splogger.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","splogger.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-queue.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-queue.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-inject.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-inject.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-showctl.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-showctl.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-newmrh.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-newmrh.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-newu.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-newu.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-pw2u.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-pw2u.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-qread.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-qread.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-qstat.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-qstat.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-tcpok.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-tcpok.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-tcpto.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-tcpto.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-pop3d.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-pop3d.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-popup.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-popup.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-qmqpc.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-qmqpc.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-qmqpd.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-qmqpd.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-qmtpd.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-qmtpd.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-smtpd.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-smtpd.0",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/man8","qmail-command.8",auto_uido,auto_gidq,0644);
+- c(auto_qmail,"man/cat8","qmail-command.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-local.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-local.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-lspawn.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-lspawn.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-getpw.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-getpw.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-remote.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-remote.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-rspawn.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-rspawn.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-clean.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-clean.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-send.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-send.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-start.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-start.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","splogger.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","splogger.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-queue.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-queue.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-inject.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-inject.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-showctl.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-showctl.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-newmrh.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-newmrh.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-newu.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-newu.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-pw2u.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-pw2u.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-qread.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-qread.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-qstat.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-qstat.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-tcpok.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-tcpok.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-tcpto.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-tcpto.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-pop3d.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-pop3d.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-popup.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-popup.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-qmqpc.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-qmqpc.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-qmqpd.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-qmqpd.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-qmtpd.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-qmtpd.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-smtpd.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-smtpd.0",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/man8","qmail-command.8",auto_uido,auto_gidq,0644);
++ c(base_qmail,"man/cat8","qmail-command.0",auto_uido,auto_gidq,0644);
+ }
+--- /dev/null
++++ netqmail-1.06/make-loadi.sh
+@@ -0,0 +1,2 @@
++echo 'main="$1"; shift'
++echo exec "$LDI" '-o "$main" "$main".o ${1+"$@"}'
diff --git a/user/netqmail/0002-qbiffutmpx-20170820.patch b/user/netqmail/0002-qbiffutmpx-20170820.patch
new file mode 100644
index 000000000..a55044f6e
--- /dev/null
+++ b/user/netqmail/0002-qbiffutmpx-20170820.patch
@@ -0,0 +1,130 @@
+<https://schmonz.com/qmail/qbiffutmpx>
+
+diff --git a/Makefile b/Makefile
+index 0f0e31a..ae8d229 100644
+--- a/Makefile
++++ b/Makefile
+@@ -685,6 +685,13 @@ chkshsgr warn-shsgr tryshsgr.c compile load
+ hasshsgr.h
+ rm -f tryshsgr.o tryshsgr
+
++hasutmpx.h: \
++tryutmpx.c compile load
++ ( ( ./compile tryutmpx.c && ./load tryutmpx ) >/dev/null \
++ 2>&1 \
++ && echo \#define HASUTMPX 1 || exit 0 ) > hasutmpx.h
++ rm -f tryutmpx.o tryutmpx
++
+ haswaitp.h: \
+ trywaitp.c compile load
+ ( ( ./compile trywaitp.c && ./load trywaitp ) >/dev/null \
+@@ -1071,7 +1078,8 @@ qbiff.1
+
+ qbiff.o: \
+ compile qbiff.c readwrite.h stralloc.h gen_alloc.h substdio.h subfd.h \
+-substdio.h open.h byte.h str.h headerbody.h hfield.h env.h exit.h
++substdio.h open.h byte.h str.h headerbody.h hfield.h env.h exit.h \
++hasutmpx.h
+ ./compile qbiff.c
+
+ qmail-clean: \
+diff --git a/TARGETS b/TARGETS
+index facdad7..c37a453 100644
+--- a/TARGETS
++++ b/TARGETS
+@@ -388,3 +388,4 @@
+ man
+ setup
+ check
++hasutmpx.h
+diff --git a/qbiff.c b/qbiff.c
+index 4e9f1d8..f21b6bf 100644
+--- a/qbiff.c
++++ b/qbiff.c
+@@ -1,5 +1,9 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include "hasutmpx.h"
++#ifdef HASUTMPX
++#include <utmpx.h>
++#else
+ #include <utmp.h>
+ #ifndef UTMP_FILE
+ #ifdef _PATH_UTMP
+@@ -8,6 +12,7 @@
+ #define UTMP_FILE "/etc/utmp"
+ #endif
+ #endif
++#endif
+ #include "readwrite.h"
+ #include "stralloc.h"
+ #include "substdio.h"
+@@ -20,15 +25,22 @@
+ #include "env.h"
+ #include "exit.h"
+
++#ifndef HASUTMPX
+ substdio ssutmp;
+ char bufutmp[sizeof(struct utmp) * 16];
+ int fdutmp;
++#endif
+ substdio sstty;
+ char buftty[1024];
+ int fdtty;
+
++#ifdef HASUTMPX
++struct utmpx *ut;
++char line[sizeof(ut->ut_line) + 1];
++#else
+ struct utmp ut;
+ char line[sizeof(ut.ut_line) + 1];
++#endif
+ stralloc woof = {0};
+ stralloc tofrom = {0};
+ stralloc text = {0};
+@@ -63,7 +75,11 @@ void main()
+ if (!(user = env_get("USER"))) _exit(0);
+ if (!(sender = env_get("SENDER"))) _exit(0);
+ if (!(userext = env_get("LOCAL"))) _exit(0);
++#ifdef HASUTMPX
++ if (str_len(user) > sizeof(ut->ut_user)) _exit(0);
++#else
+ if (str_len(user) > sizeof(ut.ut_name)) _exit(0);
++#endif
+
+ if (!stralloc_copys(&tofrom,"*** TO <")) _exit(0);
+ if (!stralloc_cats(&tofrom,userext)) _exit(0);
+@@ -88,6 +104,7 @@ void main()
+ if (!stralloc_cat(&woof,&text)) _exit(0);
+ if (!stralloc_cats(&woof,"\015\n")) _exit(0);
+
++#ifndef HASUTMPX
+ fdutmp = open_read(UTMP_FILE);
+ if (fdutmp == -1) _exit(0);
+ substdio_fdbuf(&ssutmp,read,fdutmp,bufutmp,sizeof(bufutmp));
+@@ -97,6 +114,13 @@ void main()
+ {
+ byte_copy(line,sizeof(ut.ut_line),ut.ut_line);
+ line[sizeof(ut.ut_line)] = 0;
++#else
++ while ((ut = getutxent()))
++ if (ut->ut_type == USER_PROCESS && !str_diffn(ut->ut_user,user,sizeof(ut->ut_user)))
++ {
++ byte_copy(line,sizeof(ut->ut_line),ut->ut_line);
++ line[sizeof(ut->ut_line)] = 0;
++#endif
+ if (line[0] == '/') continue;
+ if (!line[0]) continue;
+ if (line[str_chr(line,'.')]) continue;
+diff --git a/tryutmpx.c b/tryutmpx.c
+new file mode 100644
+index 0000000..551b597
+--- /dev/null
++++ b/tryutmpx.c
+@@ -0,0 +1,6 @@
++#include <utmpx.h>
++
++void main()
++{
++ ;
++}
diff --git a/user/netqmail/0003-qmailremote-20170716.patch b/user/netqmail/0003-qmailremote-20170716.patch
new file mode 100644
index 000000000..706441d21
--- /dev/null
+++ b/user/netqmail/0003-qmailremote-20170716.patch
@@ -0,0 +1,62 @@
+<https://schmonz.com/qmail/remote>
+
+diff --git a/Makefile b/Makefile
+index 0f0e31a..8042611 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1462,11 +1462,11 @@ tcpto.h readwrite.h timeoutconn.h timeoutread.h timeoutwrite.h
+
+ 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 \
++ substdio.a error.a env.a str.a auto_qmail.o auto_uids.o \
+ auto_spawn.o
+
+ qmail-rspawn.0: \
+@@ -1474,7 +1474,7 @@ 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
+
+diff --git a/qmail-rspawn.c b/qmail-rspawn.c
+index 9d838e6..e064db1 100644
+--- a/qmail-rspawn.c
++++ b/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;
diff --git a/user/netqmail/0004-notifyfd.patch b/user/netqmail/0004-notifyfd.patch
new file mode 100644
index 000000000..d734b1417
--- /dev/null
+++ b/user/netqmail/0004-notifyfd.patch
@@ -0,0 +1,41 @@
+--- netqmail-1.06.old/qmail-send.c
++++ netqmail-1.06/qmail-send.c
+@@ -1,5 +1,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <fcntl.h>
++#include <stdlib.h>
+ #include "readwrite.h"
+ #include "sig.h"
+ #include "direntry.h"
+@@ -1521,7 +1523,17 @@
+ int nfds;
+ struct timeval tv;
+ int c;
++ int notifyfd = -1;
+
++ {
++ char *x = getenv("QMAIL_NOTIFY_FD") ;
++ if (x)
++ {
++ unsigned long u;
++ if (scan_ulong(x, &u) && fcntl(u, F_GETFD) >= 0) notifyfd = (int)u;
++ }
++ }
++
+ if (chdir(auto_qmail) == -1)
+ { log1("alert: cannot start: unable to switch to home directory\n"); _exit(111); }
+ if (!getcontrols())
+@@ -1567,6 +1579,12 @@
+ pass_init();
+ todo_init();
+ cleanup_init();
++
++ if (notifyfd >=0)
++ {
++ write(notifyfd, "\n", 1);
++ close(notifyfd);
++ }
+
+ while (!flagexitasap || !del_canexit())
+ {
diff --git a/user/netqmail/APKBUILD b/user/netqmail/APKBUILD
new file mode 100644
index 000000000..bda855086
--- /dev/null
+++ b/user/netqmail/APKBUILD
@@ -0,0 +1,114 @@
+# Contributor: Laurent Bercot <ska-adelie@skarnet.org>
+# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
+pkgname=netqmail
+pkgver=1.06
+pkgrel=0
+pkgdesc="The qmail mail transfer agent (community version)"
+url="http://www.qmail.org/$pkgname/"
+arch="all"
+license="ISC"
+provides=sendmail
+options="suid !check" # suid programs (qmail-queue); no test suite
+depends="execline s6 s6-networking"
+subpackages="$pkgname-doc $pkgname-openrc"
+install="$pkgname.post-install $pkgname.pre-deinstall"
+source="http://www.qmail.org/$pkgname-$pkgver.tar.gz \
+ 0001-DESTDIR.patch \
+ 0002-qbiffutmpx-20170820.patch \
+ 0003-qmailremote-20170716.patch
+ 0004-notifyfd.patch
+ qmail.run
+ smtpd.run
+ smtpsd.run
+ $pkgname.confd
+ $pkgname.initd"
+
+makeservicedir()
+{
+ mkdir -p -m 0755 "$1"/log "$1"/env
+ {
+ echo '#!/bin/execlineb -P'
+ echo
+ echo 's6-setuidgid qmaill'
+ echo 's6-envdir ../env'
+ echo 'importas -u IP IP'
+ echo 'exec -c'
+ echo "s6-log t $4"
+ } > "$1"/log/run
+ echo "$2" > "$1"/notification-fd
+ cp -f "$3" "$1"/run
+
+ mkdir -p -m 3730 "$1"/event
+ mkdir -p -m 0700 "$1"/supervise
+ touch "$1"/supervise/lock "$1"/supervise/death_tally
+ mkfifo -m 0600 "$1"/supervise/control
+ dd if=/dev/zero of="$1"/supervise/status bs=35 count=1
+ if test $5 -eq 0 ; then
+ echo /var/qmail/bin:/usr/bin:/usr/sbin:/bin:/sbin > "$1"/env/PATH
+ echo "$2" > "$1"/env/QMAIL_NOTIFY_FD
+ else
+ echo 110 > "$1"/env/UID
+ echo 200 > "$1"/env/GID
+ echo > "$1"/env/GIDLIST
+ if test $5 -eq 6 ; then
+ mkdir -p -m 0755 "$1"/data/rules/ip6/::_0
+ touch "$1"/data/rules/ip6/::_0/allow
+ sed -i -e 's/s6-tcpserver /s6-tcpserver6 /' "$1"/run
+ elif test $5 -eq 4 ; then
+ mkdir -p -m 0755 "$1"/data/rules/ip4/0.0.0.0_0
+ touch "$1"/data/rules/ip4/0.0.0.0_0/allow
+ sed -i -e 's/s6-tcpserver /s6-tcpserver4 /' "$1"/run
+ fi
+ fi
+ chmod 0755 "$1"/run "$1"/log/run
+}
+
+build() {
+ cd "$builddir"
+ echo "gcc -O2 -pipe -W -Wall -Wextra" > conf-cc
+ echo "gcc -s -static" > conf-ld
+ echo "gcc -s" > conf-ldi # because fakeroot doesn't work with static programs
+ echo 022 > conf-patrn
+ echo /var/qmail > conf-qmail
+ echo 255 > conf-spawn
+ { echo alias; echo qmaild; echo qmaill; echo root; echo qmailp; echo qmailq; echo qmailr; echo qmails; } > conf-users
+ { echo qmail; echo nofiles; } > conf-groups
+ make
+
+
+ # The following should be done in package(), but abuild only
+ # does it under fakeroot when it's done in build() and
+ # there's no package() function.
+
+ mkdir -p -m 0755 "$pkgdir"/var/qmail/services "$pkgdir"/var/log/qmail "$pkgdir"/usr/bin "$pkgdir"/usr/sbin "$pkgdir"/usr/share/doc "$pkgdir"/etc/qmail/services "$pkgdir"/etc/conf.d "$pkgdir"/etc/init.d
+ chown qmaill:qmaill "$pkgdir"/var/log/qmail
+ chmod 2700 "$pkgdir"/var/log/qmail
+ cp -f "$srcdir/$pkgname".confd "$pkgdir/etc/conf.d/$pkgname"
+ cp -f "$srcdir/$pkgname".initd "$pkgdir/etc/init.d/$pkgname"
+ chmod 0755 "$pkgdir/etc/init.d/$pkgname"
+
+ env DESTDIR="$pkgdir" make setup install
+ ln -s ../../var/qmail/bin/sendmail "$pkgdir"/usr/sbin/
+ ln -s ../../var/qmail/control "$pkgdir"/etc/qmail/control
+ rm -rf "$pkgdir"/var/qmail/boot "$pkgdir"/var/qmail/man/cat?
+ mv -f "$pkgdir"/var/qmail/man "$pkgdir"/usr/share/man
+ mv -f "$pkgdir"/var/qmail/doc "$pkgdir/usr/share/doc/$pkgname-$pkgver"
+ echo 255 > "$pkgdir"/var/qmail/control/concurrencylocal
+ echo 255 > "$pkgdir"/var/qmail/control/concurrencyremote
+ makeservicedir "$pkgdir"/var/qmail/services/qmail 7 "$srcdir"/qmail.run 'n20 s1000000 /var/log/qmail' 0
+ makeservicedir "$pkgdir"/etc/qmail/services/smtpd4-skeleton 3 "$srcdir"/smtpd.run '/var/log/smtpd-$IP' 4
+ makeservicedir "$pkgdir"/etc/qmail/services/smtpd6-skeleton 3 "$srcdir"/smtpd.run '/var/log/smtpd-$IP' 6
+ makeservicedir "$pkgdir"/etc/qmail/services/smtpsd4-skeleton 3 "$srcdir"/smtpsd.run '/var/log/smtpsd-$IP' 4
+ makeservicedir "$pkgdir"/etc/qmail/services/smtpsd6-skeleton 3 "$srcdir"/smtpsd.run '/var/log/smtpsd-$IP' 6
+}
+
+sha512sums="de40a6d8fac502bd785010434d99b99f2c0524e10aea3d0f2a0d35c70fce91e991eb1fb8f20a1276eb56d7e73130ea5e2c178f6075d138af47b28d9ca6e6046b netqmail-1.06.tar.gz
+ad126cad5c0d35351919ad87022fd94b910519d91cf82f38c158f423bbfc1b82455844a791ba0c69d347af1a20a86b095bed571f75365a86ea786cbc9c626487 0001-DESTDIR.patch
+b3af9c29e6d46daa2a1b9f677c6f32892d5f8c9b8d5c2bdd6f34b106dd5ad41394c05a5ebe145c6e29b4ced4482f08b2d09e7818fd309123c0d087600500e336 0002-qbiffutmpx-20170820.patch
+cbebdc72c7cc5c437531c9277534ae552c6d044a83b36e3f3ce60ab5563c55eb814d6c543cc0997abab73075d1b517cc0929dd65674d468d517b0ca38196e2b4 0003-qmailremote-20170716.patch
+b32a8a36c8ab8872abd4f1a117482f064a6d631a6bb2ba75cafe61743bef09f923d26935d9514eec33a7dec5aeb3d0b517d677e55924859d2db5233bc11f9f11 0004-notifyfd.patch
+954a905bac5e3bc49f180dc0de7f6ee4c4ae8f94dd400ee4b06d3c944f1ff1cfc44bddccb07ae439f2523ad06fcb89023e57d091737da88f836013757794e931 qmail.run
+c0cd244af4d8186305c51b0e93960bdb1ea6ce40f1adf20c4f72419aa7498e35649590919ebd16547a0313676bf9171c9efea2ff8ac3a5c773b18473a972a977 smtpd.run
+719c4ce5ad93cddeafbb734cffeec3fd959d3f374e44e1f34e9a25d638303dd97df41642d3df5c7a069a8db47d1e31c32a16ecd2d04b72860c4e00bbba0c9fcf smtpsd.run
+80ee7e8b3c1ca7cdb00044e6fdd5b9c6a39fd9c882b470f4968c79b974c95e48946a1a3a8b79d9d0ed134ecf09b1185823bf6d022f8b17168e34c18f44ddd16f netqmail.confd
+7600285e70511447b11161a2fc1ca11debc5adcde1d76583d4c715e9710cab876f8be158fd8e034d480588d3d4978c42a9254c29f2db70913105ab009cab6479 netqmail.initd"
diff --git a/user/netqmail/netqmail.confd b/user/netqmail/netqmail.confd
new file mode 100644
index 000000000..b3f331fdb
--- /dev/null
+++ b/user/netqmail/netqmail.confd
@@ -0,0 +1,49 @@
+# netqmail configuration for SMTP servers.
+
+# Most of the configuration for qmail is done in /var/qmail/control.
+# Please read the documentation of qmail-control(5) and
+# and adjust the files in /var/qmail/control according to your needs.
+# In particular, that's where options for *routing* and *sending*
+# mail are set.
+
+# The file you're viewing is about *receiving* mail.
+
+
+# List the IP addresses (v4 or v6) where a SMTP daemon should
+# be listening. v4 and v6 are handled separately (if you have
+# one interface, you need to list both its IPv4 and its IPv6
+# address).
+# 0.0.0.0 means all v4 addresses. Remove it if you want to
+# list v4 addresses explicitly.
+# :: means all v6 addresses. Remove it if you want to
+# list v6 addresses explicitly.
+
+SMTPD_IPS="0.0.0.0 ::"
+
+
+# TLS configuration.
+# If you want to have SMTP-over-TLS daemons, the
+# SMTPSD_KEYFILE should point to your private key, and the
+# SMTPSD_CERTFILE should point to your certificate.
+# Leave them empty for no SMTP-over-TLS.
+
+SMTPSD_KEYFILE=
+SMTPSD_CERTFILE=
+
+
+# List the IP addresses (v4 or v6) where a SMTP-over-TLS daemon
+# should be listening. This will only be used if SMTPSD_KEYFILE
+# and SMTPSD_CERTFILE are defined.
+
+SMTPSD_IPS="0.0.0.0 ::"
+
+
+# Relaying configuration.
+# If you want qmail to act as a relay for some subnets, declare
+# the subnets here: for instance 1.2.3.0/24, 1.2.3.4/30,
+# 0001:0002:0003:0004::/64. A single IP is a subnet with a netmask
+# of 32 (for IPv4) or 128 (for IPv6).
+# DO NOT ADD PUBLIC IP ADDRESSES THAT YOU DO NOT OWN. Doing this
+# would make you an open relay and get you blacklisted by spam cops.
+
+RELAY_SUBNETS=""
diff --git a/user/netqmail/netqmail.initd b/user/netqmail/netqmail.initd
new file mode 100644
index 000000000..dae9c4d55
--- /dev/null
+++ b/user/netqmail/netqmail.initd
@@ -0,0 +1,153 @@
+#!/sbin/openrc-run
+
+description="Start/stop the s6 services for netqmail"
+
+depend()
+{
+ after net
+ after localmount
+}
+
+makesmtpd()
+{
+ set -e
+ ip="$1"
+ usetls="$2"
+ if "$usetls" ; then
+ s="s"
+ port=25
+ else
+ s=
+ port=465
+ fi
+ if s6-tcpserver6-socketbinder -dBb0 -- "$ip" "$port" true 2>/dev/null ; then
+ ipv=6
+ relayfor="$smtprelay6"
+ elif s6-tcpserver4-socketbinder -dBb0 -- "$ip" "$port" true 2>/dev/null ; then
+ ipv=4
+ relayfor="$smtprelay4"
+ else
+ return 1
+ fi
+
+ service="smtp${s}d-$ip"
+ sdir=/run/services/"$service"
+ logdir=/var/log/"smtp${s}d-$ip"
+
+ mkdir -p -m 0755 "$logdir"
+ chown qmaill:qmaill "$logdir"
+ chmod 2700 "$logdir"
+
+ rm -rf "$sdir"
+ cp -a /etc/qmail/services/smtp"${s}"d"${ipv}"-skeleton "$sdir"
+ echo "$ip" > "$sdir"/env/IP
+ if "$usetls" ; then
+ echo "$SMTPSD_KEYFILE" > "$sdir"/env/KEYFILE
+ echo "$SMTPSD_CERTFILE" > "$sdir"/env/CERTFILE
+ fi
+
+ for j in $relayfor ; do
+ mkdir -p -m 0755 "$sdir/data/rules/ip${ipv}/$j/env"
+ touch "$sdir/data/rules/ip${ipv}/$j/allow"
+ echo > "$sdir/data/rules/ip${ipv}/$j/env/RELAYCLIENT"
+ done
+
+ return 0
+}
+
+stop()
+{
+ set -e
+ . /etc/conf.d/netqmail
+ ebegin "Stopping SMTP and SMTPS listeners"
+ dirs=""
+ logs=""
+ for i in ${SMTPD_IPS} ; do
+ rm -f "/run/service/smtpd-$i"
+ s6-svc -d "/run/services/smtpd-$i"
+ dirs="$dirs /run/services/smtpd-$i"
+ logs="$logs /run/services/smtpd-$i/log"
+ done
+ if test -r "$SMTPSD_KEYFILE" && test -r "$SMTPSD_CERTFILE" ; then
+ for i in ${SMTPSD_IPS} ; do
+ rm -f "/run/service/smtpsd-$i"
+ s6-svc -d "/run/services/smtpsd-$i"
+ dirs="$dirs /run/services/smtpsd-$i"
+ logs="$logs /run/services/smtpsd-$i/log"
+ done
+ fi
+ s6-svwait -D $dirs
+ eend $?
+
+ ebegin "Stopping the qmail-send service (this may take some time)"
+ rm -f /run/service/qmail
+ logs="$logs /var/qmail/services/qmail/log"
+ s6-svc -dwD /var/qmail/services/qmail
+ eend $?
+
+ ebegin "Stopping loggers and cleaning up qmail services"
+ for i in $logs ; do
+ s6-svc -d "$i"
+ done
+ s6-svwait -D $logs
+ s6-svscanctl -aN /run/service
+ rm -rf $dirs
+ eend $?
+}
+
+start()
+{
+ set -e
+ . /etc/conf.d/netqmail
+
+ ebegin "Parsing the relay subnets"
+ smtprelay4=
+ smtprelay6=
+ for i in ${RELAY_SUBNETS} ; do
+ j=`echo "$i" | tr / _`
+ if echo "$i" | grep -qF : ; then
+ smtprelay6="$smtprelay6 $j"
+ elif echo "$i" | grep -qF . ; then
+ smtprelay4="$smtprelay4 $j"
+ else
+ false
+ break
+ fi
+ done
+ eend $?
+
+ ebegin "Starting the qmail-send service"
+ ln -nsf ../../var/qmail/services/qmail /run/service/qmail
+ s6-svscanctl -a /run/service
+ s6-svwait -U /var/qmail/services/qmail
+ eend $?
+
+ for i in ${SMTPD_IPS} ; do
+ ebegin "Creating a service directory for a SMTP listener on $i"
+ makesmtpd "$i" false
+ eend $?
+ done
+ if test -r "$SMTPSD_KEYFILE" && test -r "$SMTPSD_CERTFILE" ; then
+ for i in ${SMTPSD_IPS} ; do
+ ebegin "Creating a service directory for a SMTPS listener on $i"
+ makesmtpd "$i" true
+ eend $?
+ done
+ fi
+
+ dirs=""
+ ebegin "Starting SMTP/S listeners"
+ for i in ${SMTPD_IPS} ; do
+ ln -nsf "../services/smtpd-$i" "/run/service/smtpd-$i"
+ dirs="$dirs /run/service/smtpd-$i"
+ done
+ if test -r "$SMTPSD_KEYFILE" && test -r "$SMTPSD_CERTFILE" ; then
+ for i in ${SMTPSD_IPS} ; do
+ ln -nsf "../services/smtpsd-$i" "/run/service/smtpsd-$i"
+ dirs="$dirs /run/service/smtpsd-$i"
+ done
+ fi
+ s6-svscanctl -aN /run/service
+ s6-svwait -U $dirs
+ eend $?
+}
diff --git a/user/netqmail/netqmail.post-install b/user/netqmail/netqmail.post-install
new file mode 100644
index 000000000..b9c03e947
--- /dev/null
+++ b/user/netqmail/netqmail.post-install
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+
+# Basic /var/qmail/control configuration so qmail has a chance to
+# work out-of-the-box for very simple installations.
+
+name=`uname -n`
+ddom=`echo "$name" | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./'`
+pdom=`echo "$name" | sed 's/^.*\.\([^\.]*\)\.\([^\.]*\)$/\1.\2/'`
+
+cd /var/qmail/control
+echo "$name" > me
+echo "$name" > locals
+echo "$name" > rcpthosts
+echo "$name powered by qmail" > smtpgreeting
+echo "$ddom" > defaultdomain
+echo "$pdom" > plusdomain
+
+{
+ echo "Minimal qmail configuration done in /var/qmail/control."
+ echo "Please check and adjust those settings before starting the service."
+ echo "Please review /etc/init.d/netqmail for more settings."
+} 1>&2
diff --git a/user/netqmail/netqmail.pre-deinstall b/user/netqmail/netqmail.pre-deinstall
new file mode 100644
index 000000000..496133f3d
--- /dev/null
+++ b/user/netqmail/netqmail.pre-deinstall
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+
+# Remove s6-supervise files so apk can clean up directories.
+
+rm -rf /var/qmail/services/qmail/event /var/qmail/services/qmail/supervise /var/qmail/services/qmail/log/event /var/qmail/services/qmail/log/supervise
diff --git a/user/netqmail/qmail.run b/user/netqmail/qmail.run
new file mode 100644
index 000000000..5d92e7540
--- /dev/null
+++ b/user/netqmail/qmail.run
@@ -0,0 +1,5 @@
+#!/bin/execlineb -P
+
+fdmove -c 2 1
+s6-envdir env
+/var/qmail/bin/qmail-start ./Maildir/
diff --git a/user/netqmail/smtpd.run b/user/netqmail/smtpd.run
new file mode 100644
index 000000000..7f10dbdbb
--- /dev/null
+++ b/user/netqmail/smtpd.run
@@ -0,0 +1,9 @@
+#!/bin/execlineb -P
+
+fdmove -c 2 1
+s6-envdir env
+importas -u IP IP
+fdmove 1 3
+s6-tcpserver -v2 -1U -c 255 -- $IP 25
+s6-tcpserver-access -v2 -DRpl0 -t 5000 -i data/rules --
+qmail-smtpd
diff --git a/user/netqmail/smtpsd.run b/user/netqmail/smtpsd.run
new file mode 100644
index 000000000..32d9f54ab
--- /dev/null
+++ b/user/netqmail/smtpsd.run
@@ -0,0 +1,8 @@
+#!/bin/execlineb -P
+
+fdmove -c 2 1
+s6-envdir env
+importas -u IP IP
+fdmove 1 3
+s6-tlsserver -v2 -1U -c 255 -DRpl0 -t 5000 -i data/rules -- $IP 465
+qmail-smtpd