nightmaremail

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

commit 2bb7433cc9aaa89edf223d57e904553b31cce4b9
parent f5df10d17375e5f1137c4e59f0e527a12a991ed7
Author: Russell Nelson <nelson@qmail.org>
Date:   Thu, 30 Oct 2003 19:41:00 +0100

netqmail 1.04

Diffstat:
MCHANGES | 14++++++++++++++
MFAQ | 3+++
MFILES | 1+
MINSTALL | 85+------------------------------------------------------------------------------
MMakefile | 4++--
MREADME | 9+++++++++
MUPGRADE | 4++--
MVERSION | 2+-
Mcdb_seek.c | 1-
Mdns.c | 2--
Merror.3 | 3+--
Merror.h | 2+-
Mipme.c | 5+++++
Mqmail-local.c | 2+-
Mqmail-log.5 | 5+++++
Mqmail-queue.8 | 6++++++
Mqmail-smtpd.c | 2+-
Mqmail.7 | 8+++++---
Mqmail.c | 13++++++++++++-
Msendmail.c | 33+++++++++++++++++++++++++++++++++
20 files changed, 103 insertions(+), 101 deletions(-)

diff --git a/CHANGES b/CHANGES @@ -1,3 +1,17 @@ +20031027 version: netqmail 1.04. +20031027 doc: INSTALL points to http://lifewithqmail.org/lwq.html +20031027 doc: qmail.7 identifies installation as netqmail and points to + http://qmail.org/ +20031027 doc: qmail-queue.8 adds explanation of $QMAILQUEUE +20031027 doc: qmail-log.5 adds reference to errors from $QMAILQUEUE script +20031027 doc: FAQ also points to http://cr.yp.to/qmail/faq.html and + http://qmail.org/ +20031027 code: qmail-smtpd identifies itself as netqmail +20031027 code: if $QMAILQUEUE is set, it's invoked instead of qmail-queue +20031024 code: changed errno from int to #include. +20031024 code: fixed .qmail parsing bug. +20031024 code: recognize 0.0.0.0 as a local address. +20031024 code: sendmail's -f flag now overrides environment variables. 19980615 version: qmail 1.03. 19980614 doc: eliminated BIN.setup in favor of a web page. 19980614 code: added other auto* to qmail-showctl output. diff --git a/FAQ b/FAQ @@ -1,3 +1,6 @@ +See http://cr.yp.to/qmail/faq.html for newer FAQs not included in this +document, and http://qmail.org/ for qmail community contributions. + 1. Controlling the appearance of outgoing messages 1.1. How do I set up host masquerading? 1.2. How do I set up user masquerading? diff --git a/FILES b/FILES @@ -10,6 +10,7 @@ INSTALL.ctl INSTALL.ids INSTALL.maildir INSTALL.mbox +INSTALL-1.03 INSTALL.vsm REMOVE.sendmail REMOVE.binmail diff --git a/INSTALL b/INSTALL @@ -1,84 +1 @@ -SAVE COPIES OF YOUR OUTGOING MAIL! Like any other piece of software (and -information generally), the qmail system comes with NO WARRANTY. It's -much more secure and reliable than sendmail, but that's not saying much. - - -Things you have to decide before starting: - -* The qmail home directory, normally /var/qmail. To change this -directory, edit conf-qmail now. - -* The names of the qmail users and the qmail groups. To change these -names, edit conf-users and conf-groups now. - - -To create /var/qmail and configure qmail (won't interfere with sendmail): - - 1. Create the qmail home directory: - # mkdir /var/qmail - - 2. Read INSTALL.ids. You must set up the qmail group and the qmail - users before compiling the programs. - - 3. Compile the programs and create the qmail directory tree: - # make setup check - - 4. Read INSTALL.ctl and FAQ. Minimal survival command: - # ./config - - 5. Read INSTALL.alias. Minimal survival command: - # (cd ~alias; touch .qmail-postmaster .qmail-mailer-daemon .qmail-root) - # chmod 644 ~alias/.qmail* - - 6. Read INSTALL.mbox and INSTALL.vsm. - - 7. Read INSTALL.maildir. - - 8. Copy /var/qmail/boot/home (or proc) to /var/qmail/rc. - - -To test qmail deliveries (won't interfere with sendmail): - - 9. Enable deliveries of messages injected into qmail: - # csh -cf '/var/qmail/rc &' - -10. Read TEST.deliver. - - -To upgrade from sendmail to qmail: - -11. Read SENDMAIL. This is what your users will want to know about the - switch from sendmail to qmail. - -12. Read REMOVE.sendmail. You must remove sendmail before installing - qmail. - -13. Read REMOVE.binmail. - -14. Add - csh -cf '/var/qmail/rc &' - to your boot scripts, so that the qmail daemons are restarted - whenever your system reboots. Make sure you include the &. - -15. Make qmail's ``sendmail'' wrapper available to MUAs: - # ln -s /var/qmail/bin/sendmail /usr/lib/sendmail - # ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail - /usr/sbin might not exist on your system. - -16. Set up qmail-smtpd in /etc/inetd.conf (all on one line): - smtp stream tcp nowait qmaild /var/qmail/bin/tcp-env - tcp-env /var/qmail/bin/qmail-smtpd - -17. Reboot. (Or kill -HUP your inetd and make sure the qmail daemons - are running.) - -18. Read TEST.receive. - - - -That's it! To report success: - % ( echo 'First M. Last'; cat `cat SYSDEPS` ) | mail djb-qst@cr.yp.to -Replace First M. Last with your name. - -If you have questions about qmail, join the qmail mailing list; see -http://pobox.com/~djb/qmail.html. +See http://lifewithqmail.org/lwq.html diff --git a/Makefile b/Makefile @@ -1483,12 +1483,12 @@ load qmail-send.o qsutil.o control.o constmap.o newfield.o prioq.o \ trigger.o fmtqfn.o quote.o now.o readsubdir.o qmail.o date822fmt.o \ datetime.a case.a ndelay.a getln.a wait.a seek.a fd.a sig.a open.a \ lock.a stralloc.a alloc.a substdio.a error.a str.a fs.a auto_qmail.o \ -auto_split.o +auto_split.o env.a ./load qmail-send qsutil.o control.o constmap.o newfield.o \ prioq.o trigger.o fmtqfn.o quote.o now.o readsubdir.o \ qmail.o date822fmt.o datetime.a case.a ndelay.a getln.a \ wait.a seek.a fd.a sig.a open.a lock.a stralloc.a alloc.a \ - substdio.a error.a str.a fs.a auto_qmail.o auto_split.o + substdio.a error.a str.a fs.a auto_qmail.o auto_split.o env.a qmail-send.0: \ qmail-send.8 diff --git a/README b/README @@ -3,6 +3,15 @@ qmail 1.03 Copyright 1998 D. J. Bernstein, qmail@pobox.com +netqmail 1.04 +20031024 +No copyright claimed for changes from qmail 1.03 to netqmail 1.04 +Russell Nelson, nelson@qmail.org +NOTE: netqmail 1.04 is a community-assembled distribution of qmail from +the official qmail-1.03.tar.gz and patches approved by the community. +D. J. Bernstein did not participate in, nor has he been asked to +approve of this distribution. + qmail is a secure, reliable, efficient, simple message transfer agent. It is meant as a replacement for the entire sendmail-binmail system on typical Internet-connected UNIX hosts. See BLURB, BLURB2, BLURB3, and diff --git a/UPGRADE b/UPGRADE @@ -3,7 +3,7 @@ information generally), the qmail system comes with NO WARRANTY. It's much more secure and reliable than sendmail, but that's not saying much. -Here's how to upgrade to qmail 1.03. This procedure will overwrite the +Here's how to upgrade to netqmail 1.04. This procedure will overwrite the old qmail binaries. Furthermore, it may begin delivering messages from the queue before you have had a chance to test it. @@ -17,7 +17,7 @@ mechanism has been expanded to support virtual users. Before starting, compare conf* to your old conf*, and make any necessary -changes. You can copy conf* from 1.02. +changes. You can copy conf* from 1.02 or 1.03. How to install: diff --git a/VERSION b/VERSION @@ -1 +1 @@ -qmail 1.03 +netqmail 1.04 diff --git a/cdb_seek.c b/cdb_seek.c @@ -1,6 +1,5 @@ #include <sys/types.h> #include <errno.h> -extern int errno; #include "cdb.h" #ifndef SEEK_SET diff --git a/dns.c b/dns.c @@ -7,8 +7,6 @@ #include <errno.h> extern int res_query(); extern int res_search(); -extern int errno; -extern int h_errno; #include "ip.h" #include "ipalloc.h" #include "fmt.h" diff --git a/error.3 b/error.3 @@ -3,8 +3,7 @@ error \- syscall error codes .SH SYNTAX .B #include <error.h> - -extern int \fBerrno\fP; +.B #include <errno.h> extern int \fBerror_intr\fP; .br diff --git a/error.h b/error.h @@ -1,7 +1,7 @@ #ifndef ERROR_H #define ERROR_H -extern int errno; +#include <errno.h> extern int error_intr; extern int error_nomem; diff --git a/ipme.c b/ipme.c @@ -46,6 +46,11 @@ int ipme_init() ipme.len = 0; ix.pref = 0; + /* 0.0.0.0 is a special address which always refers to + * "this host, this network", according to RFC 1122, Sec. 3.2.1.3a. + */ + byte_copy(&ix.ip,4,"\0\0\0\0"); + if (!ipalloc_append(&ipme,&ix)) { return 0; } if ((s = socket(AF_INET,SOCK_STREAM,0)) == -1) return -1; len = 256; diff --git a/qmail-local.c b/qmail-local.c @@ -645,7 +645,7 @@ char **argv; { cmds.s[j] = 0; k = j; - while ((k > i) && (cmds.s[k - 1] == ' ') || (cmds.s[k - 1] == '\t')) + while ((k > i) && ((cmds.s[k - 1] == ' ') || (cmds.s[k - 1] == '\t'))) cmds.s[--k] = 0; switch(cmds.s[i]) { diff --git a/qmail-log.5 b/qmail-log.5 @@ -232,6 +232,11 @@ It will try again later. is unable to queue a bounce message, usually because the machine is almost out of memory. It will try again later. +This can also be caused by incorrect settings of +.B $QMAILQUEUE +or errors in a program or script which +.B $QMAILQUEUE +points to. .TP .B unable to stat ... .B qmail-send diff --git a/qmail-queue.8 b/qmail-queue.8 @@ -40,6 +40,12 @@ and does not enforce any restrictions on its contents. However, the recipients probably expect to see a proper header, as described in .BR qmail-header(5) . + +Programs included with qmail which invoke +.B qmail-queue +will invoke the contents of +.B $QMAILQUEUE +instead, if that environment variable is set. .SH "FILESYSTEM RESTRICTIONS" .B qmail-queue imposes two constraints on the queue structure: diff --git a/qmail-smtpd.c b/qmail-smtpd.c @@ -69,7 +69,7 @@ void smtp_greet(code) char *code; } void smtp_help() { - out("214 qmail home page: http://pobox.com/~djb/qmail.html\r\n"); + out("214 netqmail home page: http://qmail.org/netqmail\r\n"); } void smtp_quit() { diff --git a/qmail.7 b/qmail.7 @@ -55,12 +55,14 @@ Miscellaneous documentation includes and .BR qmail-pop3d (8). -This documentation describes version -1.03 +This documentation describes netqmail version +1.04 of .BR qmail . See .B http://pobox.com/~djb/qmail.html for other .BR qmail -related -software. +software, and +.B http://qmail.org/ +for other qmail community contributions. diff --git a/qmail.c b/qmail.c @@ -6,8 +6,17 @@ #include "fd.h" #include "qmail.h" #include "auto_qmail.h" +#include "env.h" -static char *binqqargs[2] = { "bin/qmail-queue", 0 } ; +static char *binqqargs[2] = { 0, 0 } ; + +static void setup_qqargs() +{ + if(!binqqargs[0]) + binqqargs[0] = env_get("QMAILQUEUE"); + if(!binqqargs[0]) + binqqargs[0] = "bin/qmail-queue"; +} int qmail_open(qq) struct qmail *qq; @@ -15,6 +24,8 @@ struct qmail *qq; int pim[2]; int pie[2]; + setup_qqargs(); + if (pipe(pim) == -1) return -1; if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; } diff --git a/sendmail.c b/sendmail.c @@ -45,6 +45,38 @@ void mailq() _exit(111); } +void do_sender(s) +const char *s; +{ + char *x; + int n; + int a; + int i; + + env_unset("QMAILNAME"); + env_unset("MAILNAME"); + env_unset("NAME"); + env_unset("QMAILHOST"); + env_unset("MAILHOST"); + + n = str_len(s); + a = str_rchr(s, '@'); + if (a == n) + { + env_put2("QMAILUSER", s); + return; + } + env_put2("QMAILHOST", s + a + 1); + + x = (char *) alloc((a + 1) * sizeof(char)); + if (!x) nomem(); + for (i = 0; i < a; i++) + x[i] = s[i]; + x[i] = 0; + env_put2("QMAILUSER", x); + alloc_free(x); +} + int flagh; char *sender; @@ -118,6 +150,7 @@ char **argv; if (sender) { *arg++ = "-f"; *arg++ = sender; + do_sender(sender); } *arg++ = "--"; for (i = 0;i < argc;++i) *arg++ = argv[i];