commit f5df10d17375e5f1137c4e59f0e527a12a991ed7
parent d15ee51c9ddb9d233ad5ebc28fddf1de8378657d
Author: D. J. Bernstein <djb@cr.yp.to>
Date: Mon, 15 Jun 1998 12:53:00 +0200
qmail 1.03
Diffstat:
43 files changed, 1679 insertions(+), 1014 deletions(-)
diff --git a/BIN.Makefile b/BIN.Makefile
@@ -0,0 +1,24 @@
+SHELL=/bin/sh
+
+# Files are edited in the installation directory, then copied.
+# There are 40 arguments to idedit after the filename,
+# showing the positions of each byte in the following ten ints:
+# uida, uidd, uidl, uido, uidp, uidq, uidr, uids, gidq, gidn.
+# Normal little-endian positions are n n+1 n+2 ... n+39 for some n.
+# Normal big-endian positions are n+3 n+2 n+1 n n+7 ... n+36 for some n.
+
+setup:
+ mkdir /var/qmail
+ ./idedit install-big XXX
+ ./idedit qmail-lspawn XXX
+ ./idedit qmail-queue XXX
+ ./idedit qmail-rspawn XXX
+ ./idedit qmail-showctl XXX
+ ./idedit qmail-start XXX
+ ./install-big
+ cp /var/qmail/boot/binm1+df /var/qmail/rc
+ chmod 755 /var/qmail/rc
+ echo '|fastforward -d /etc/aliases.cdb' > /var/qmail/alias/.qmail-default
+ chmod 644 /var/qmail/alias/.qmail-default
+ hostname | grep -q '\.'
+ ./config-fast `hostname`
diff --git a/BIN.README b/BIN.README
@@ -0,0 +1,19 @@
+Like any other piece of software (and information generally), qmail
+comes with NO WARRANTY.
+
+Configuration: The qmail home directory is /var/qmail. (This must be a
+local directory, not shared among machines. Under Linux, make sure that
+all mail-handling filesystems are mounted with synchronous metadata.)
+The user-ext delimiter is -. The silent concurrency limit is 120. The
+queue subdirectory split is 23.
+
+To install:
+ # make setup
+
+To set up qmail to receive and deliver mail, follow the instructions in
+/var/qmail/doc/fastforward/ALIASES, and then start at step 9 of
+/var/qmail/doc/INSTALL.
+
+Compilation environment: Oops, the package creator forgot to edit this!
+He's supposed to list his OS version, compiler version, hardware, and
+name.
diff --git a/BLURB3 b/BLURB3
@@ -83,7 +83,7 @@ Local delivery (qmail-local):
* user-controlled program delivery: procmail etc. (qmail-command)
* optional new-mail notification (qbiff)
* optional NRUDT return receipts (qreceipt)
-* conditional filtering (condredirect)
+* conditional filtering (condredirect, bouncesaying)
POP3 service (qmail-popup, qmail-pop3d):
* RFC 1939
diff --git a/CHANGES b/CHANGES
@@ -1,3 +1,42 @@
+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.
+19980614 doc: added pointer to immhf.html in qmail-header.5.
+19980614 doc: added note to TEST.receive about SMTP command format.
+19980614 doc: added FAQ 5.6 on qmail-qmqpd.
+19980614 code: removed unused variables in idedit.c.
+19980613 code: changed conf-patrn to 002.
+19980613 doc: moved SENDMAIL lower in INSTALL.
+19980612 code: added install-big.
+19980612 code: added BIN.Makefile.
+19980612 doc: added BIN.README, BIN.setup.
+19980612 code: switched to new install.
+19980611 code: added idedit.
+19980611 doc: added FAQ 1.3 on $QMAILMFTFILE.
+19980611 doc: used bouncesaying in FAQ 5.5.
+19980611 code: added except.
+19980611 code: added bouncesaying.
+19980611 code: allowed unbracketed IP addresses in dns_ipplus() and
+ dns_mxip().
+19980611 code: allowed spaces after colon in non-bracketed addresses in
+ qmail-smtpd.
+19980611 doc: cleaned up UPGRADE.
+19980528 bug: qmail-smtpd skips first character in rcpthosts() call.
+ tnx NND. impact: qmail-smtpd crashes on empty address; and it
+ allows relaying to ""@any.host. fix: use addr.s.
+19980515 doc: expanded flock discussion in INSTALL.mbox.
+19980515 doc: eliminated flock warning from INSTALL.maildir.
+19980515 doc: split REMOVE.binmail out of INSTALL.
+19980515 doc: split REMOVE.sendmail out of INSTALL.
+19980515 doc: split TEST.deliver and TEST.receive out of INSTALL and
+ UPGRADE.
+19980515 doc: integrated INSTALL.boot into INSTALL.
+19980515 code: cleaned up final output in qmail-qmqpd.c.
+19980514 doc: updated procmail notes in INSTALL.mbox. tnx JRM.
+19980514 doc: changed FAQ 4.4 to point to INSTALL.mbox for procmail.
+ tnx JRM.
+19980514 code: separated HELO and EHLO; single-line response for HELO.
+ tnx to various people.
19980430 version: qmail 1.02.
19980430 doc: updated SECURITY.
19980430 doc: fixed FAQ 4.9. tnx KB.
diff --git a/FAQ b/FAQ
@@ -1,6 +1,7 @@
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?
+1.3. How do I set up Mail-Followup-To automatically?
2. Routing outgoing messages
2.1. How do I send local messages to another host?
@@ -32,6 +33,7 @@
5.3. How do I set up qmail-pop3d?
5.4. How do I allow selected clients to use this host as a relay?
5.5. How do I fix up messages from broken SMTP clients?
+5.6. How do I set up qmail-qmqpd?
6. Configuring MUAs to work with qmail
6.1. How do I make BSD mail generate a Date with the local time zone?
@@ -75,6 +77,14 @@ override From lines supplied by your MUA, add QMAILINJECT=f to your
environment.
+1.3. How do I set up Mail-Followup-To automatically? When I send a
+message to the sos@heaven.af.mil mailing list, I'd like to include
+``Mail-Followup-To: sos@heaven.af.mil''.
+
+Answer: Add QMAILMFTFILE=$HOME/.lists to your environment, and put
+sos@heaven.af.mil into ~/.lists.
+
+
2. Routing outgoing messages
@@ -226,8 +236,8 @@ Answer: Put
into ~/.qmail. You'll have to use a full path for procmail unless
procmail is in the system's startup PATH. Note that procmail will try to
-deliver to /usr/spool/mail/$USER by default; to change this, change
-SYSTEM_MBOX in procmail's config.h.
+deliver to /var/spool/mail/$USER by default; to change this, see
+INSTALL.mbox.
4.5. How do I use elm's filter with qmail?
@@ -333,7 +343,7 @@ If you have tcpserver installed, skip the inetd step, and set up
tcpserver -u 7770 -g 2108 0 qmtp /var/qmail/bin/qmail-qmtpd &
replacing 7770 and 2108 with the qmaild uid and nofiles gid. See
-question 5.1 for more details.
+question 5.1 for more details on tcpserver.
5.3. How do I set up qmail-pop3d? My old POP server works with mbox
@@ -362,7 +372,7 @@ lines)
/bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir &
replacing YOURHOST with your host's fully qualified domain name. See
-question 5.1 for more details.
+question 5.1 for more details on tcpserver.
Security note: pop3d should be used only within a secure network;
otherwise an eavesdropper can steal passwords.
@@ -411,7 +421,7 @@ after tcpserver in your qmail-smtpd invocation.
Answer: Three steps. First, put
- | [ "@$HOST" = "@fixme" ] || ( echo Permission denied; exit 100 )
+ | bouncesaying 'Permission denied' [ "@$HOST" != "@fixme" ]
| qmail-inject -f "$SENDER" -- "$DEFAULT"
into ~alias/.qmail-fixup-default. Second, put
@@ -433,6 +443,28 @@ tcpserver instead of inetd and tcpd, put
into /etc/tcp.smtp, and run tcprules as in question 5.4.
+5.6. How do I set up qmail-qmqpd? I'd like to allow fast queueing of
+outgoing mail from authorized clients.
+
+Answer: Make sure you have installed tcpserver 0.80 or above. Create
+/etc/qmqp.tcp in tcprules format to allow connections from authorized
+hosts. For example, if queueing is allowed from 1.2.3.*:
+
+ 1.2.3.:allow
+ :deny
+
+Convert /etc/qmqp.tcp to /etc/qmqp.cdb:
+
+ tcprules /etc/qmqp.cdb /etc/qmqp.tmp < /etc/qmqp.tcp
+
+Finally, set up
+
+ tcpserver -x /etc/qmqp.cdb -u 7770 -g 2108 0 628 /var/qmail/bin/qmail-qmqpd &
+
+replacing 7770 and 2108 with the qmaild uid and nofiles gid. See
+question 5.1 for more details on tcpserver.
+
+
6. Configuring MUAs to work with qmail
diff --git a/FILES b/FILES
@@ -6,12 +6,15 @@ README
FAQ
INSTALL
INSTALL.alias
-INSTALL.boot
INSTALL.ctl
INSTALL.ids
INSTALL.maildir
INSTALL.mbox
INSTALL.vsm
+REMOVE.sendmail
+REMOVE.binmail
+TEST.deliver
+TEST.receive
UPGRADE
THOUGHTS
TODO
@@ -34,6 +37,9 @@ VERSION
SYSDEPS
TARGETS
Makefile
+BIN.README
+BIN.Makefile
+idedit.c
conf-break
auto_break.h
conf-spawn
@@ -49,6 +55,8 @@ auto_uids.h
auto_usera.h
extra.h
addresses.5
+except.1
+bouncesaying.1
condredirect.1
dot-qmail.9
envelopes.5
@@ -99,7 +107,6 @@ config.sh
config-fast.sh
qmail-clean.c
qmail-getpw.c
-qmail-hier.c
qmail-inject.c
qmail-local.c
qmail-lspawn.c
@@ -138,6 +145,8 @@ qbiff.c
forward.c
preline.c
predate.c
+except.c
+bouncesaying.c
condredirect.c
maildirmake.c
maildir2mbox.c
@@ -202,8 +211,10 @@ auto-int.c
auto-int8.c
auto-gid.c
auto-uid.c
+hier.c
install.c
instcheck.c
+install-big.c
alloc.3
alloc.h
alloc.c
diff --git a/INSTALL b/INSTALL
@@ -12,7 +12,7 @@ directory, edit conf-qmail now.
names, edit conf-users and conf-groups now.
-Installation steps that won't interfere with sendmail:
+To create /var/qmail and configure qmail (won't interfere with sendmail):
1. Create the qmail home directory:
# mkdir /var/qmail
@@ -21,193 +21,64 @@ Installation steps that won't interfere with sendmail:
users before compiling the programs.
3. Compile the programs and create the qmail directory tree:
- # make setup
+ # make setup check
- 4. Run instcheck to make sure it doesn't print any warnings:
- # make check
-
- 5. Read INSTALL.ctl and FAQ. Minimal survival command:
+ 4. Read INSTALL.ctl and FAQ. Minimal survival command:
# ./config
- 6. Read INSTALL.alias. Minimal survival command:
+ 5. Read INSTALL.alias. Minimal survival command:
# (cd ~alias; touch .qmail-postmaster .qmail-mailer-daemon .qmail-root)
# chmod 644 ~alias/.qmail*
- 7. Read INSTALL.mbox and INSTALL.vsm.
+ 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.
- 8. Read INSTALL.maildir.
- 9. Read SENDMAIL. This is what your users will want to know about the
+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.
-10. Copy /var/qmail/boot/home (or proc) to /var/qmail/rc.
-
-
-Pre-upgrade tests:
-
-11. Enable deliveries of messages injected into qmail:
- # /var/qmail/rc &
-
-12. Look for a
- qmail: status: local 0/10 remote 0/20
- line in syslog. qmail-send always prints either ``cannot start'' or
- ``status''. (The big number is a splogger timestamp.)
-
-13. Do a ps and look for the qmail daemons. There should be four of
- them, all idle: qmail-send, running as qmails; qmail-lspawn, running
- as root; qmail-rspawn, running as qmailr; and qmail-clean, running
- as qmailq. You will also see splogger, running as qmaill.
-
-14. Local-local test: Send yourself an empty message. (Replace ``me''
- with your username. Make sure to include the ``to:'' colon.)
- % echo to: me | /var/qmail/bin/qmail-inject
- The message will show up immediately in your mailbox, and syslog
- will show something like this:
- qmail: new msg 53
- qmail: info msg 53: bytes 246 from <me@domain> qp 20345 uid 666
- qmail: starting delivery 1: msg 53 to local me@domain
- qmail: status: local 1/10 remote 0/20
- qmail: delivery 1: success: did_1+0+0/
- qmail: status: local 0/10 remote 0/20
- qmail: end msg 53
- (53 is an inode number; 20345 is a process ID; your numbers will
- probably be different.)
-
-15. Local-error test: Send a message to a nonexistent local address.
- % echo to: nonexistent | /var/qmail/bin/qmail-inject
- qmail: new msg 53
- qmail: info msg 53: bytes 246 from <me@domain> qp 20351 uid 666
- qmail: starting delivery 2: msg 53 to local nonexistent@domain
- qmail: status: local 1/10 remote 0/20
- qmail: delivery 2: failure: No_such_address.__#5.1.1_/
- qmail: status: local 0/10 remote 0/20
- qmail: bounce msg 53 qp 20357
- qmail: end msg 53
- qmail: new msg 54
- qmail: info msg 54: bytes 743 from <> qp 20357 uid 666
- qmail: starting delivery 3: msg 54 to local me@domain
- qmail: status: local 1/10 remote 0/20
- qmail: delivery 3: success: did_1+0+0/
- qmail: status: local 0/10 remote 0/20
- qmail: end msg 54
- You will now have a bounce message in your mailbox.
-
-16. Local-remote test: Send an empty message to your account on another
- machine.
- % echo to: me@wherever | /var/qmail/bin/qmail-inject
- qmail: new msg 53
- qmail: info msg 53: bytes 246 from <me@domain> qp 20372 uid 666
- qmail: starting delivery 4: msg 53 to remote me@wherever
- qmail: status: local 0/10 remote 1/20
- qmail: delivery 4: success: 1.2.3.4_accepted_message./...
- qmail: status: local 0/10 remote 0/20
- qmail: end msg 53
- There will be a pause between ``starting delivery'' and ``success'';
- SMTP is slow. Check that the message is in your mailbox on the other
- machine.
-
-17. Local-postmaster test: Send mail to postmaster, any capitalization.
- % echo to: POSTmaster | /var/qmail/bin/qmail-inject
- Look for the message in the alias mailbox, normally ~alias/Mailbox.
-
-18. Double-bounce test: Send a message with a completely bad envelope.
- % /var/qmail/bin/qmail-inject -f nonexistent
- To: unknownuser
- Subject: testing
-
- This is a test. This is only a test.
- %
- (Use end-of-file, not dot, to end the message.) Look for the double
- bounce in the alias mailbox.
-
-19. Group membership test:
- % cat > ~me/.qmail-groups
- |groups >> MYGROUPS; exit 0
- % /var/qmail/bin/qmail-inject me-groups < /dev/null
- % cat ~me/MYGROUPS
- MYGROUPS will show your normal gid and nothing else. (Under Solaris,
- make sure to use /usr/ucb/groups; /usr/bin/groups is broken.)
-
-
-Upgrading from sendmail to qmail:
-
-20. Read INSTALL.boot. You must replace the sendmail invocation in your
- boot scripts with an appropriate qmail invocation.
-
-21. Kill the sendmail daemon. You should first kill -STOP the daemon; if
- any children are running, you should kill -CONT, wait, kill -STOP
- again, and repeat ad nauseam. If there aren't any children, kill
- -TERM and then kill -CONT.
-
-22. Replace sendmail with a link to qmail's ``sendmail'' wrapper:
- # mv /usr/lib/sendmail /usr/lib/sendmail.bak
+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.
-23. Set up qmail-smtpd in /etc/inetd.conf (all on one line):
+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
- Also comment out comsat in /etc/inetd.conf.
+ tcp-env /var/qmail/bin/qmail-smtpd
-24. Reboot. (Or kill -HUP your inetd and make sure the qmail daemons
+17. Reboot. (Or kill -HUP your inetd and make sure the qmail daemons
are running.)
-25. Try to flush the sendmail queue:
- # /usr/lib/sendmail.bak -q
- You can safely run sendmail.bak -q (or even sendmail.bak -q15m)
- while qmail is running. Do this until the sendmail queue is empty.
- This may take several days.
-
-26. Disable all the sendmail and binmail programs in your system. The
- safest approach is to chmod 0 everything. Some locations to check:
- /usr/sbin/sendmail, /usr/lib/sendmail.bak, /usr/lib/sendmail.mx,
- /bin/mail, /usr/libexec/mail.local.
-
-27. Make sure that ``mail'' still invokes a reasonable mailer. Under
- SVR4 you may want to link mail to mailx.
-
-
-Post-upgrade tests (can be done immediately after step 24):
-
-28. SMTP server test: Forge some mail locally via SMTP.
- % telnet 127.0.0.1 25
- Trying 127.0.0.1...
- Connected to 127.0.0.1.
- Escape character is '^]'.
- 220 domain ESMTP
- helo dude
- 250-domain
- 250-PIPELINING
- 250 8BITMIME
- mail <me@domain>
- 250 ok
- rcpt <me@domain>
- 250 ok
- data
- 354 go ahead
- Subject: testing
-
- This is a test.
- .
- 250 ok 812345679 qp 12345
- quit
- 221 domain
- Connection closed by foreign host.
- %
- Look for the message in your mailbox.
-
-29. Remote-local test: Send yourself some mail from another machine.
-
-30. Remote-error test: I think you can figure this one out.
-
-31. UA test: Try sending mail, first to a local account, then to a
- remote account, with your normal user agent.
-
-32. Remote-postmaster test: Send mail from another machine to
- PoStMaStEr@domain. Look for the message in the alias mailbox.
+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.
+ % ( 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.
diff --git a/INSTALL.boot b/INSTALL.boot
@@ -1,15 +0,0 @@
-The qmail daemons have to be restarted whenever your system reboots.
-Meanwhile, sendmail doesn't have to be started any more. Here's what you
-should do.
-
-Find sendmail in your boot scripts. It's usually in either /etc/rc or
-/etc/init.d/sendmail. It looks like
-
- sendmail -bd -q15m
-
--q15m means it should run the queue every 15 minutes; you may see a
-different number. Comment out this line, and replace it with
-
- csh -cf '/var/qmail/rc &'
-
-That's it. (Make sure you include the &.)
diff --git a/INSTALL.maildir b/INSTALL.maildir
@@ -25,11 +25,6 @@ default. Nevertheless, I encourage you to start asking for maildir
versions of your favorite MUAs, and to switch over to maildir as soon as
you can.
-WARNING: qmail uses flock() to lock ~user/Mailbox. This agrees with the
-modern mail.local locking choice. If your MUA doesn't use flock(), your
-best bet is to switch to maildir, and to set up synchronous maildir2mbox
-execution, as described below.
-
2. Sun's Network F_ail_u_re System
diff --git a/INSTALL.mbox b/INSTALL.mbox
@@ -2,16 +2,17 @@ The qmail package includes a local delivery agent, qmail-local, which
provides user-controlled mailing lists, cross-host alias loop detection,
and many other important qmail features.
-There's one part of qmail-local that you need to know about right now:
-qmail-local delivers mail by default into ~user/Mailbox (in mbox format,
-using flock), rather than /var/spool/mail/user.
+There's one important difference between qmail-local and binmail:
+qmail-local delivers mail by default into ~user/Mailbox, rather than
+/var/spool/mail/user. It uses mbox format, with lockf locking on systems
+that don't have flock (HP/UX, Solaris), and flock locking otherwise.
-For an explanation of the problems with /var/spool/mail, and a list of
-options if you want to continue delivering to /var/spool/mail, see
-INSTALL.vsm.
+This file explains how to switch your system to ~user/Mailbox. You
+aren't required to do this; for further discussion of /var/spool/mail,
+and an explanation of how to continue using binmail for local
+deliveries, see INSTALL.vsm.
-This file explains how to handle the change to ~user/Mailbox. The basic
-procedure is simple:
+The basic procedure for switching to ~user/Mailbox is simple:
* Move each /var/spool/mail/user to ~user/Mailbox. For safety, do
this in single-user mode.
@@ -20,11 +21,17 @@ procedure is simple:
~user/Mailbox for each user. /var/spool/mail should be mode 1777,
so users will not be able to accidentally remove these links.
+A few mail programs are unable to handle symbolic links, so you will
+have to configure them to look at ~user/Mailbox directly:
+
+ * procmail: Change SYSTEM_MBOX in config.h and recompile; or, with
+ recent versions, define MAILSPOOLHOME in src/authenticate.c.
+
An alternative to symbolic links is hlfsd. Consult the documentation for
hlfsd if it is included in your operating system.
If /var/spool/mail is large, you can gain extra speed by configuring
-your mail software to look at ~user/Mailbox directly:
+all your mail software to look at ~user/Mailbox directly:
* Most MUAs: Put ``setenv MAIL $HOME/Mailbox'' in your system-wide
.cshrc and ``MAIL=$HOME/Mailbox; export MAIL'' in your system-wide
@@ -37,8 +44,6 @@ your mail software to look at ~user/Mailbox directly:
* pine: Put ``inbox-path=Mailbox'' in your system-wide pine.conf.
(For pine versions more recent than 3.91, see also FAQ 6.2.)
- * procmail: Change SYSTEM_MBOX in config.h and recompile.
-
* qpopper 2.2: Change /.mail to /Mailbox in pop_dropcopy.c and
recompile with -DHOMEDIRMAIL in CFLAGS.
diff --git a/Makefile b/Makefile
@@ -178,6 +178,19 @@ binm3+df.sh conf-qmail
> binm3+df
chmod 755 binm3+df
+bouncesaying: \
+load bouncesaying.o strerr.a error.a substdio.a str.a wait.a
+ ./load bouncesaying strerr.a error.a substdio.a str.a \
+ wait.a
+
+bouncesaying.0: \
+bouncesaying.1
+ nroff -man bouncesaying.1 > bouncesaying.0
+
+bouncesaying.o: \
+compile bouncesaying.c fork.h strerr.h error.h wait.h sig.h exit.h
+ ./compile bouncesaying.c
+
byte_chr.o: \
compile byte_chr.c byte.h
./compile byte_chr.c
@@ -267,8 +280,8 @@ uint32.h substdio.h
./compile cdbmss.c
check: \
-it man conf-qmail
- ./qmail-hier | ./instcheck `head -1 conf-qmail`
+it man
+ ./instcheck
chkshsgr: \
load chkshsgr.o
@@ -511,6 +524,18 @@ error_temp.o: \
compile error_temp.c error.h
./compile error_temp.c
+except: \
+load except.o strerr.a error.a substdio.a str.a wait.a
+ ./load except strerr.a error.a substdio.a str.a wait.a
+
+except.0: \
+except.1
+ nroff -man except.1 > except.0
+
+except.o: \
+compile except.c fork.h strerr.h wait.h error.h exit.h
+ ./compile except.c
+
fd.a: \
makelib fd_copy.o fd_move.o
./makelib fd.a fd_copy.o fd_move.o
@@ -676,6 +701,10 @@ hfield.o: \
compile hfield.c hfield.h
./compile hfield.c
+hier.o: \
+compile hier.c auto_qmail.h auto_split.h auto_uids.h fmt.h fifo.h
+ ./compile hier.c
+
home: \
home.sh conf-qmail
cat home.sh \
@@ -699,26 +728,48 @@ hostname.o: \
compile hostname.c substdio.h subfd.h substdio.h readwrite.h exit.h
./compile hostname.c
+idedit: \
+load idedit.o strerr.a substdio.a error.a str.a fs.a wait.a open.a \
+seek.a
+ ./load idedit strerr.a substdio.a error.a str.a fs.a \
+ wait.a open.a seek.a
+
+idedit.o: \
+compile idedit.c readwrite.h exit.h scan.h fmt.h strerr.h open.h \
+seek.h fork.h
+ ./compile idedit.c
+
install: \
-load install.o fifo.o getln.a strerr.a substdio.a stralloc.a alloc.a \
-open.a error.a str.a fs.a
- ./load install fifo.o getln.a strerr.a substdio.a \
- stralloc.a alloc.a open.a error.a str.a fs.a
+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
+
+install-big: \
+load 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 \
+ auto_split.o auto_uids.o strerr.a substdio.a open.a error.a \
+ str.a fs.a
+
+install-big.o: \
+compile install-big.c auto_qmail.h auto_split.h auto_uids.h fmt.h \
+fifo.h
+ ./compile install-big.c
install.o: \
-compile install.c substdio.h stralloc.h gen_alloc.h getln.h \
-readwrite.h exit.h open.h error.h strerr.h byte.h fifo.h
+compile install.c substdio.h strerr.h error.h open.h readwrite.h \
+exit.h
./compile install.c
instcheck: \
-load instcheck.o getln.a strerr.a substdio.a stralloc.a alloc.a \
-error.a str.a fs.a
- ./load instcheck getln.a strerr.a substdio.a stralloc.a \
- alloc.a error.a str.a fs.a
+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
instcheck.o: \
-compile instcheck.c substdio.h stralloc.h gen_alloc.h getln.h \
-readwrite.h exit.h error.h strerr.h byte.h
+compile instcheck.c strerr.h error.h readwrite.h exit.h
./compile instcheck.c
ip.o: \
@@ -754,9 +805,10 @@ 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 dnscname \
dnsptr dnsip dnsmxip dnsfq hostname ipmeprint qreceipt qsmhook qbiff \
-forward preline condredirect maildirmake maildir2mbox maildirwatch \
-qail elq pinq qmail-hier install instcheck home home+df proc proc+df \
-binm1 binm1+df binm2 binm2+df binm3 binm3+df
+forward preline condredirect bouncesaying except maildirmake \
+maildir2mbox maildirwatch qail elq pinq idedit install-big install \
+instcheck home home+df proc proc+df binm1 binm1+df binm2 binm2+df \
+binm3 binm3+df
load: \
make-load warn-auto.sh systype
@@ -879,10 +931,11 @@ qmail-queue.0 qmail-inject.0 mailsubj.0 qmail-showctl.0 qmail-newu.0 \
qmail-pw2u.0 qmail-qread.0 qmail-qstat.0 qmail-tcpto.0 qmail-tcpok.0 \
qmail-pop3d.0 qmail-popup.0 qmail-qmqpc.0 qmail-qmqpd.0 qmail-qmtpd.0 \
qmail-smtpd.0 tcp-env.0 qmail-newmrh.0 qreceipt.0 qbiff.0 forward.0 \
-preline.0 condredirect.0 maildirmake.0 maildir2mbox.0 maildirwatch.0 \
-qmail.0 qmail-limits.0 qmail-log.0 qmail-control.0 qmail-header.0 \
-qmail-users.0 dot-qmail.0 qmail-command.0 tcp-environ.0 maildir.0 \
-mbox.0 addresses.0 envelopes.0 forgeries.0
+preline.0 condredirect.0 bouncesaying.0 except.0 maildirmake.0 \
+maildir2mbox.0 maildirwatch.0 qmail.0 qmail-limits.0 qmail-log.0 \
+qmail-control.0 qmail-header.0 qmail-users.0 dot-qmail.0 \
+qmail-command.0 tcp-environ.0 maildir.0 mbox.0 addresses.0 \
+envelopes.0 forgeries.0
mbox.0: \
mbox.5
@@ -1082,17 +1135,6 @@ qmail-header.0: \
qmail-header.5
nroff -man qmail-header.5 > qmail-header.0
-qmail-hier: \
-load qmail-hier.o substdio.a error.a str.a fs.a auto_split.o \
-auto_uids.o
- ./load qmail-hier substdio.a error.a str.a fs.a \
- auto_split.o auto_uids.o
-
-qmail-hier.o: \
-compile qmail-hier.c subfd.h substdio.h substdio.h auto_split.h \
-auto_uids.h fmt.h
- ./compile qmail-hier.c
-
qmail-inject: \
load qmail-inject.o headerbody.o hfield.o newfield.o quote.o now.o \
control.o date822fmt.o constmap.o qmail.o case.a fd.a wait.a open.a \
@@ -1470,11 +1512,13 @@ fmtqfn.h readsubdir.h direntry.h
./compile qmail-send.c
qmail-showctl: \
-load qmail-showctl.o control.o open.a getln.a stralloc.a alloc.a \
-substdio.a error.a str.a fs.a auto_qmail.o auto_uids.o
- ./load qmail-showctl control.o open.a getln.a stralloc.a \
- alloc.a substdio.a error.a str.a fs.a auto_qmail.o \
- auto_uids.o
+load qmail-showctl.o auto_uids.o control.o open.a getln.a stralloc.a \
+alloc.a substdio.a error.a str.a fs.a auto_qmail.o auto_break.o \
+auto_patrn.o auto_spawn.o auto_split.o
+ ./load qmail-showctl auto_uids.o control.o open.a getln.a \
+ stralloc.a alloc.a substdio.a error.a str.a fs.a \
+ auto_qmail.o auto_break.o auto_patrn.o auto_spawn.o \
+ auto_split.o
qmail-showctl.0: \
qmail-showctl.8
@@ -1483,7 +1527,8 @@ qmail-showctl.8
qmail-showctl.o: \
compile qmail-showctl.c substdio.h subfd.h substdio.h exit.h fmt.h \
str.h control.h constmap.h stralloc.h gen_alloc.h direntry.h \
-auto_qmail.h auto_uids.h
+auto_uids.h auto_qmail.h auto_break.h auto_patrn.h auto_spawn.h \
+auto_split.h
./compile qmail-showctl.c
qmail-smtpd: \
@@ -1698,8 +1743,8 @@ substdio.h alloc.h auto_qmail.h exit.h env.h str.h
./compile sendmail.c
setup: \
-it man conf-qmail
- ./qmail-hier | ./install `head -1 conf-qmail`
+it man
+ ./install
sgetopt.o: \
compile sgetopt.c substdio.h subfd.h substdio.h sgetopt.h subgetopt.h \
@@ -1708,25 +1753,27 @@ subgetopt.h
shar: \
FILES BLURB BLURB2 BLURB3 BLURB4 README FAQ INSTALL INSTALL.alias \
-INSTALL.boot INSTALL.ctl INSTALL.ids INSTALL.maildir INSTALL.mbox \
-INSTALL.vsm UPGRADE THOUGHTS TODO THANKS CHANGES SECURITY INTERNALS \
-SENDMAIL PIC.local2alias PIC.local2ext PIC.local2local PIC.local2rem \
+INSTALL.ctl INSTALL.ids INSTALL.maildir INSTALL.mbox INSTALL.vsm \
+REMOVE.sendmail REMOVE.binmail TEST.deliver TEST.receive UPGRADE \
+THOUGHTS TODO THANKS CHANGES SECURITY INTERNALS SENDMAIL \
+PIC.local2alias PIC.local2ext PIC.local2local PIC.local2rem \
PIC.local2virt PIC.nullclient PIC.relaybad PIC.relaygood \
-PIC.rem2local FILES VERSION SYSDEPS TARGETS Makefile conf-break \
-auto_break.h conf-spawn auto_spawn.h chkspawn.c conf-split \
-auto_split.h conf-patrn auto_patrn.h conf-users conf-groups \
-auto_uids.h auto_usera.h extra.h addresses.5 condredirect.1 \
-dot-qmail.9 envelopes.5 forgeries.7 forward.1 maildir2mbox.1 \
-maildirmake.1 maildirwatch.1 mailsubj.1 mbox.5 preline.1 qbiff.1 \
-qmail-clean.8 qmail-command.8 qmail-control.9 qmail-getpw.9 \
-qmail-header.5 qmail-inject.8 qmail-limits.9 qmail-local.8 \
-qmail-log.5 qmail-lspawn.8 qmail-newmrh.9 qmail-newu.9 qmail-pop3d.8 \
+PIC.rem2local FILES VERSION SYSDEPS TARGETS Makefile BIN.README \
+BIN.Makefile BIN.setup idedit.c conf-break auto_break.h conf-spawn \
+auto_spawn.h chkspawn.c conf-split auto_split.h conf-patrn \
+auto_patrn.h conf-users conf-groups auto_uids.h auto_usera.h extra.h \
+addresses.5 except.1 bouncesaying.1 condredirect.1 dot-qmail.9 \
+envelopes.5 forgeries.7 forward.1 maildir2mbox.1 maildirmake.1 \
+maildirwatch.1 mailsubj.1 mbox.5 preline.1 qbiff.1 qmail-clean.8 \
+qmail-command.8 qmail-control.9 qmail-getpw.9 qmail-header.5 \
+qmail-inject.8 qmail-limits.9 qmail-local.8 qmail-log.5 \
+qmail-lspawn.8 qmail-newmrh.9 qmail-newu.9 qmail-pop3d.8 \
qmail-popup.8 qmail-pw2u.9 qmail-qmqpc.8 qmail-qmqpd.8 qmail-qmtpd.8 \
qmail-qread.8 qmail-qstat.8 qmail-queue.8 qmail-remote.8 \
qmail-rspawn.8 qmail-send.9 qmail-showctl.8 qmail-smtpd.8 \
qmail-start.9 qmail-tcpok.8 qmail-tcpto.8 qmail-users.9 qmail.7 \
qreceipt.1 splogger.8 tcp-env.1 config.sh config-fast.sh \
-qmail-clean.c qmail-getpw.c qmail-hier.c qmail-inject.c qmail-local.c \
+qmail-clean.c qmail-getpw.c qmail-inject.c qmail-local.c \
qmail-lspawn.c qmail-newmrh.c qmail-newu.c qmail-pop3d.c \
qmail-popup.c qmail-pw2u.c qmail-qmqpc.c qmail-qmqpd.c qmail-qmtpd.c \
qmail-qread.c qmail-qstat.sh qmail-queue.c qmail-remote.c \
@@ -1734,27 +1781,28 @@ qmail-rspawn.c qmail-send.c qmail-showctl.c qmail-smtpd.c \
qmail-start.c qmail-tcpok.c qmail-tcpto.c spawn.c dnscname.c dnsfq.c \
dnsip.c dnsmxip.c dnsptr.c hostname.c ipmeprint.c tcp-env.c \
sendmail.c qreceipt.c qsmhook.c qbiff.c forward.c preline.c predate.c \
-condredirect.c maildirmake.c maildir2mbox.c maildirwatch.c splogger.c \
-qail.sh elq.sh pinq.sh qmail-upq.sh datemail.sh mailsubj.sh qlx.h \
-rcpthosts.h rcpthosts.c commands.h commands.c dnsdoe.h dnsdoe.c \
-fmtqfn.h fmtqfn.c gfrom.h gfrom.c myctime.h myctime.c newfield.h \
-newfield.c qsutil.h qsutil.c readsubdir.h readsubdir.c received.h \
-received.c tcpto.h tcpto.c tcpto_clean.c trigger.h trigger.c \
-triggerpull.h triggerpull.c trynpbg1.c trysyslog.c conf-cc conf-ld \
-home.sh home+df.sh proc.sh proc+df.sh binm1.sh binm2.sh binm3.sh \
-binm1+df.sh binm2+df.sh binm3+df.sh find-systype.sh make-compile.sh \
-make-load.sh make-makelib.sh trycpp.c warn-auto.sh auto-str.c \
-auto-int.c auto-int8.c auto-gid.c auto-uid.c install.c instcheck.c \
-alloc.3 alloc.h alloc.c alloc_re.c case.3 case.h case_diffb.c \
-case_diffs.c case_lowerb.c case_lowers.c case_starts.c cdb.3 cdb.h \
-cdb_hash.c cdb_seek.c cdb_unpack.c cdbmake.h cdbmake_add.c \
-cdbmake_hash.c cdbmake_pack.c cdbmss.h cdbmss.c coe.3 coe.h coe.c \
-fd.h fd_copy.3 fd_copy.c fd_move.3 fd_move.c fifo_make.3 fifo.h \
-fifo.c trymkffo.c fork.h1 fork.h2 tryvfork.c now.3 now.h now.c open.h \
-open_append.c open_excl.c open_read.c open_trunc.c open_write.c \
-seek.h seek_cur.c seek_end.c seek_set.c seek_trunc.c conf-qmail \
-auto_qmail.h qmail.h qmail.c gen_alloc.h gen_allocdefs.h stralloc.3 \
-stralloc.h stralloc_eady.c stralloc_pend.c stralloc_copy.c \
+except.c bouncesaying.c condredirect.c maildirmake.c maildir2mbox.c \
+maildirwatch.c splogger.c qail.sh elq.sh pinq.sh qmail-upq.sh \
+datemail.sh mailsubj.sh qlx.h rcpthosts.h rcpthosts.c commands.h \
+commands.c dnsdoe.h dnsdoe.c fmtqfn.h fmtqfn.c gfrom.h gfrom.c \
+myctime.h myctime.c newfield.h newfield.c qsutil.h qsutil.c \
+readsubdir.h readsubdir.c received.h received.c tcpto.h tcpto.c \
+tcpto_clean.c trigger.h trigger.c triggerpull.h triggerpull.c \
+trynpbg1.c trysyslog.c conf-cc conf-ld home.sh home+df.sh proc.sh \
+proc+df.sh binm1.sh binm2.sh binm3.sh binm1+df.sh binm2+df.sh \
+binm3+df.sh find-systype.sh make-compile.sh make-load.sh \
+make-makelib.sh trycpp.c warn-auto.sh auto-str.c auto-int.c \
+auto-int8.c auto-gid.c auto-uid.c hier.c install.c instcheck.c \
+install-big.c alloc.3 alloc.h alloc.c alloc_re.c case.3 case.h \
+case_diffb.c case_diffs.c case_lowerb.c case_lowers.c case_starts.c \
+cdb.3 cdb.h cdb_hash.c cdb_seek.c cdb_unpack.c cdbmake.h \
+cdbmake_add.c cdbmake_hash.c cdbmake_pack.c cdbmss.h cdbmss.c coe.3 \
+coe.h coe.c fd.h fd_copy.3 fd_copy.c fd_move.3 fd_move.c fifo_make.3 \
+fifo.h fifo.c trymkffo.c fork.h1 fork.h2 tryvfork.c now.3 now.h now.c \
+open.h open_append.c open_excl.c open_read.c open_trunc.c \
+open_write.c seek.h seek_cur.c seek_end.c seek_set.c seek_trunc.c \
+conf-qmail auto_qmail.h qmail.h qmail.c gen_alloc.h gen_allocdefs.h \
+stralloc.3 stralloc.h stralloc_eady.c stralloc_pend.c stralloc_copy.c \
stralloc_opyb.c stralloc_opys.c stralloc_cat.c stralloc_catb.c \
stralloc_cats.c stralloc_arts.c strerr.h strerr_sys.c strerr_die.c \
substdio.h substdio.c substdi.c substdo.c substdio_copy.c subfd.h \
diff --git a/README b/README
@@ -1,5 +1,5 @@
-qmail 1.02
-19980430
+qmail 1.03
+19980615
Copyright 1998
D. J. Bernstein, qmail@pobox.com
@@ -8,8 +8,8 @@ It is meant as a replacement for the entire sendmail-binmail system on
typical Internet-connected UNIX hosts. See BLURB, BLURB2, BLURB3, and
BLURB4 for more detailed advertisements.
-INSTALL says how to set up and test qmail. If you're upgrading from
-1.01, read UPGRADE instead.
+INSTALL says how to set up and test qmail. If you're upgrading from a
+previous version, read UPGRADE instead.
See PIC.* for some ``end-to-end'' pictures of mail flowing through the
qmail system.
diff --git a/REMOVE.binmail b/REMOVE.binmail
@@ -0,0 +1,16 @@
+Here's how to remove binmail from your system. Don't do this if you have
+configured qmail to use binmail for local delivery.
+
+
+1. Find the binmail binary on your system: /usr/libexec/mail.local if
+ that exists, otherwise /bin/mail.
+
+2. Remove permissions from the binmail binary:
+ # chmod 0 /usr/libexec/mail.local
+
+3. If the binmail binary was /bin/mail, make sure that ``mail'' still
+ invokes a usable mailer. Under SVR4 you may want to link mail to
+ mailx.
+
+4. Comment out the comsat line in /etc/inetd.conf, and kill -HUP your
+ inetd.
diff --git a/REMOVE.sendmail b/REMOVE.sendmail
@@ -0,0 +1,28 @@
+Here's how to remove sendmail from your system.
+
+1. Find sendmail in your boot scripts. It's usually in either /etc/rc or
+ /etc/init.d/sendmail. It looks like
+ sendmail -bd -q15m
+ -q15m means that it should run the queue every 15 minutes; you may
+ see a different number. Comment out this line.
+
+2. Kill the sendmail daemon. You should first kill -STOP the daemon; if
+ any children are running, you should kill -CONT, wait, kill -STOP
+ again, and repeat ad nauseam. If there aren't any children, kill
+ -TERM and then kill -CONT.
+
+3. Check whether you have any messages in the sendmail queue,
+ /var/spool/mqueue. If you do, you will have to try flushing them with
+ sendmail.bak -q. If necessary, wait a while and run sendmail.bak -q
+ again. Repeat until the queue is empty. This may take several days.
+
+4. Remove the setuid bit on the sendmail binary, to prevent local users
+ from gaining extra privileges through sendmail's security holes. The
+ binary may be at several different locations:
+ # chmod 0 /usr/lib/sendmail
+ # chmod 0 /usr/sbin/sendmail
+ # chmod 0 /usr/lib/sendmail.mx
+
+5. Move the sendmail binary out of the way:
+ # mv /usr/lib/sendmail /usr/lib/sendmail.bak
+ # mv /usr/sbin/sendmail /usr/sbin/sendmail.bak
diff --git a/TARGETS b/TARGETS
@@ -288,6 +288,10 @@ preline.o
preline
condredirect.o
condredirect
+bouncesaying.o
+bouncesaying
+except.o
+except
maildirmake.o
maildirmake
maildir2mbox.o
@@ -297,9 +301,12 @@ maildirwatch
qail
elq
pinq
-qmail-hier.o
-qmail-hier
+idedit.o
+idedit
+install-big.o
install.o
+install-big
+hier.o
install
instcheck.o
instcheck
@@ -352,6 +359,8 @@ qbiff.0
forward.0
preline.0
condredirect.0
+bouncesaying.0
+except.0
maildirmake.0
maildir2mbox.0
maildirwatch.0
diff --git a/TEST.deliver b/TEST.deliver
@@ -0,0 +1,82 @@
+You can do several tests of qmail delivery without setting up qmail to
+accept messages through SMTP or through /usr/lib/sendmail:
+
+1. After you start qmail, look for a
+ qmail: status: local 0/10 remote 0/20
+ line in syslog. qmail-send always prints either ``cannot start'' or
+ ``status''. (The big number is a splogger timestamp.)
+
+2. Do a ps and look for the qmail daemons. There should be four of
+ them, all idle: qmail-send, running as qmails; qmail-lspawn, running
+ as root; qmail-rspawn, running as qmailr; and qmail-clean, running
+ as qmailq. You will also see splogger, running as qmaill.
+
+3. Local-local test: Send yourself an empty message. (Replace ``me''
+ with your username. Make sure to include the ``to:'' colon.)
+ % echo to: me | /var/qmail/bin/qmail-inject
+ The message will show up immediately in your mailbox, and syslog
+ will show something like this:
+ qmail: new msg 53
+ qmail: info msg 53: bytes 246 from <me@domain> qp 20345 uid 666
+ qmail: starting delivery 1: msg 53 to local me@domain
+ qmail: status: local 1/10 remote 0/20
+ qmail: delivery 1: success: did_1+0+0/
+ qmail: status: local 0/10 remote 0/20
+ qmail: end msg 53
+ (53 is an inode number; 20345 is a process ID; your numbers will
+ probably be different.)
+
+4. Local-error test: Send a message to a nonexistent local address.
+ % echo to: nonexistent | /var/qmail/bin/qmail-inject
+ qmail: new msg 53
+ qmail: info msg 53: bytes 246 from <me@domain> qp 20351 uid 666
+ qmail: starting delivery 2: msg 53 to local nonexistent@domain
+ qmail: status: local 1/10 remote 0/20
+ qmail: delivery 2: failure: No_such_address.__#5.1.1_/
+ qmail: status: local 0/10 remote 0/20
+ qmail: bounce msg 53 qp 20357
+ qmail: end msg 53
+ qmail: new msg 54
+ qmail: info msg 54: bytes 743 from <> qp 20357 uid 666
+ qmail: starting delivery 3: msg 54 to local me@domain
+ qmail: status: local 1/10 remote 0/20
+ qmail: delivery 3: success: did_1+0+0/
+ qmail: status: local 0/10 remote 0/20
+ qmail: end msg 54
+ You will now have a bounce message in your mailbox.
+
+5. Local-remote test: Send an empty message to your account on another
+ machine.
+ % echo to: me@wherever | /var/qmail/bin/qmail-inject
+ qmail: new msg 53
+ qmail: info msg 53: bytes 246 from <me@domain> qp 20372 uid 666
+ qmail: starting delivery 4: msg 53 to remote me@wherever
+ qmail: status: local 0/10 remote 1/20
+ qmail: delivery 4: success: 1.2.3.4_accepted_message./...
+ qmail: status: local 0/10 remote 0/20
+ qmail: end msg 53
+ There will be a pause between ``starting delivery'' and ``success'';
+ SMTP is slow. Check that the message is in your mailbox on the other
+ machine.
+
+6. Local-postmaster test: Send mail to postmaster, any capitalization.
+ % echo to: POSTmaster | /var/qmail/bin/qmail-inject
+ Look for the message in the alias mailbox, normally ~alias/Mailbox.
+
+7. Double-bounce test: Send a message with a completely bad envelope.
+ % /var/qmail/bin/qmail-inject -f nonexistent
+ To: unknownuser
+ Subject: testing
+
+ This is a test. This is only a test.
+ %
+ (Use end-of-file, not dot, to end the message.) Look for the double
+ bounce in the alias mailbox.
+
+8. Group membership test:
+ % cat > ~me/.qmail-groups
+ |groups >> MYGROUPS; exit 0
+ % /var/qmail/bin/qmail-inject me-groups < /dev/null
+ % cat ~me/MYGROUPS
+ MYGROUPS will show your normal gid and nothing else. (Under Solaris,
+ make sure to use /usr/ucb/groups; /usr/bin/groups is broken.)
diff --git a/TEST.receive b/TEST.receive
@@ -0,0 +1,41 @@
+You can do several tests of messages entering the qmail system:
+
+1. SMTP server test: Forge some mail locally via SMTP. Replace ``me''
+ with your username and ``domain'' with your host's name.
+ % telnet 127.0.0.1 25
+ Trying 127.0.0.1...
+ Connected to 127.0.0.1.
+ Escape character is '^]'.
+ 220 domain ESMTP
+ helo dude
+ 250 domain
+ mail <me@domain>
+ 250 ok
+ rcpt <me@domain>
+ 250 ok
+ data
+ 354 go ahead
+ Subject: testing
+
+ This is a test.
+ .
+ 250 ok 812345679 qp 12345
+ quit
+ 221 domain
+ Connection closed by foreign host.
+ %
+ Look for the message in your mailbox. (Note for programmers: Most
+ SMTP servers need more text after MAIL and RCPT. See RFC 821.)
+
+2. Remote-local test: Send yourself some mail from another machine.
+ Look for the message in your mailbox.
+
+3. Remote-error test: Send some mail from another machine to
+ nonexistent@domain. Look for a bounce message in the remote mailbox.
+
+4. UA test: Try sending mail, first to a local account, then to a
+ remote account, with your normal user agent.
+
+5. Remote-postmaster test: Send mail from another machine to
+ PoStMaStEr@domain. Look for the message in the alias mailbox,
+ normally ~alias/Mailbox.
diff --git a/THANKS b/THANKS
@@ -168,6 +168,7 @@ JPB = Joe Block
JPH = Justin P. Hannah
JPR = Jean-Pierre Radley
JRL = John R. Levine
+JRM = Jason R. Mastaler
JRY = Jamie R. Yukes
JS = Jesper Skriver
JTB = Jonathan T. Bowie
@@ -231,6 +232,7 @@ MWE = Mark W. Eichin
NA = Norm Aleks
NAA = Nicholas A. Amato
NH = Nick Holloway
+NND = N. Dudorov
NR = Norbert Roeding
NW = Nicholas Waples
OK = Oezguer Kesim
diff --git a/TODO b/TODO
@@ -1,6 +1,3 @@
-test qmail-qmqpc
-test qmail-qmqpd
-
consider stripping vdoms for VERPs; tnx PJH
consider ~ in qmail-local for doing defaultdelivery (not recursively)
consider POP bulletins
@@ -16,10 +13,10 @@ test for linux fifo close bug at compile time
eliminate qsmhook
finish OTBS conversion
-use lib822 in qmail-inject
-use lib822 in qreceipt
-use lib822 in qbiff
-use lib822 in maildirwatch
+use mess822 in qmail-inject
+use mess822 in qreceipt
+use mess822 in qbiff
+use mess822 in maildirwatch
eliminate token822, headerbody, hfield
replace INTERNALS and THOUGHTS with a real paper describing qmail
handle IPv6
diff --git a/UPGRADE b/UPGRADE
@@ -3,24 +3,21 @@ 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 from qmail 1.01 to qmail 1.02. 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.
+Here's how to upgrade to qmail 1.03. 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.
-WARNING: qlist has been split into a separate package. You can obtain it
-from http://pobox.com/~djb/qlist.html if you have any users who need it.
+WARNING for upgrades from 1.00 or 1.01: qlist has been split into a
+separate package. You can obtain it from http://pobox.com/~djb/qlist.html
+if you have any users who need it.
-WARNING: recipientmap is gone. The virtualdomains mechanism has been
-expanded to support virtual users.
-
-WARNING: qmail-start is now normally started from /var/qmail/rc. If you
-have changed your qmail-start line, you will have to change
-/var/qmail/rc accordingly in step 8.
+WARNING for upgrades from 1.01: recipientmap is gone. The virtualdomains
+mechanism has been expanded to support virtual users.
Before starting, compare conf* to your old conf*, and make any necessary
-changes. Do not copy your old conf*; the baseline has changed.
+changes. You can copy conf* from 1.02.
How to install:
@@ -39,144 +36,31 @@ How to install:
Wait for current qmail-smtpd processes to die.
5. Install the new binaries and man pages:
- # make setup
-
- 6. Run instcheck to make sure it doesn't print any warnings:
- # make check
+ # make setup check
- 7. Copy /var/qmail/boot/home to /var/qmail/rc. (Use home+df instead if
+ 6. If your boot scripts are using qmail-start instead of /var/qmail/rc:
+ Copy /var/qmail/boot/home to /var/qmail/rc. (Use home+df instead if
you have installed dot-forward; use proc or proc+df if you are using
- procmail by default for local deliveries.)
-
- 8. Compare /var/qmail/rc to the qmail-start boot line in your boot
- scripts. Edit /var/qmail/rc if necessary. Replace the qmail-start
- boot line in your boot scripts with
- csh -cf '/var/qmail/rc &'
+ procmail by default for local deliveries.) Compare /var/qmail/rc to
+ your qmail-start boot line, and edit /var/qmail/rc if necessary.
+ Replace your qmail-start boot line with
+ csh -cf '/var/qmail/rc &'
- 9. Reenable deliveries:
+ 7. Reenable deliveries:
# csh -cf '/var/qmail/rc &'
-10. Reenable SMTP service by restoring the smtp line in inetd.conf; kill
+ 8. Read TEST.deliver.
+
+ 9. Reenable SMTP service by restoring the smtp line in inetd.conf; kill
-HUP your inetd. (If you are using tcpserver, simply kill -CONT your
tcpserver. If you are running a QMTP server, reenable that too.)
-
-How to test (steps 11-17 can be done before step 10):
-
-11. Look for a
- qmail: status: local 0/10 remote 0/20
- line in syslog. (The big number is a splogger timestamp.)
-
-12. Local-local test: Send yourself an empty message. (Replace ``me''
- with your username. Make sure to include the ``to:'' colon.)
- % echo to: me | /var/qmail/bin/qmail-inject
- The message will show up immediately in your mailbox, and syslog
- will show something like this:
- qmail: new msg 53
- qmail: info msg 53: bytes 246 from <me@domain> qp 20345 uid 666
- qmail: starting delivery 1: msg 53 to local me@domain
- qmail: status: local 1/10 remote 0/20
- qmail: delivery 1: success: did_1+0+0/
- qmail: status: local 0/10 remote 0/20
- qmail: end msg 53
- (53 is an inode number; 20345 is a process ID; your numbers will
- probably be different.)
-
-13. Local-error test: Send a message to a nonexistent local address.
- % echo to: nonexistent | /var/qmail/bin/qmail-inject
- qmail: new msg 53
- qmail: info msg 53: bytes 246 from <me@domain> qp 20351 uid 666
- qmail: starting delivery 2: msg 53 to local nonexistent@domain
- qmail: status: local 1/10 remote 0/20
- qmail: delivery 2: failure: No_such_address.__#5.1.1_/
- qmail: status: local 0/10 remote 0/20
- qmail: bounce msg 53 qp 20357
- qmail: end msg 53
- qmail: new msg 54
- qmail: info msg 54: bytes 743 from <> qp 20357 uid 666
- qmail: starting delivery 3: msg 54 to local me@domain
- qmail: status: local 1/10 remote 0/20
- qmail: delivery 3: success: did_1+0+0/
- qmail: status: local 0/10 remote 0/20
- qmail: end msg 54
- You will now have a bounce message in your mailbox.
-
-14. Local-remote test: Send an empty message to your account on another
- machine.
- % echo to: me@wherever | /var/qmail/bin/qmail-inject
- qmail: new msg 53
- qmail: info msg 53: bytes 246 from <me@domain> qp 20372 uid 666
- qmail: starting delivery 4: msg 53 to remote me@wherever
- qmail: status: local 0/10 remote 1/20
- qmail: delivery 4: success: 1.2.3.4_accepted_message./...
- qmail: status: local 0/10 remote 0/20
- qmail: end msg 53
- There will be a pause between ``starting delivery'' and ``success'';
- SMTP is slow. Check that the message is in your mailbox on the other
- machine.
-
-15. Local-postmaster test: Send mail to postmaster, any capitalization.
- % echo to: POSTmaster | /var/qmail/bin/qmail-inject
- Look for the message in the alias mailbox.
-
-16. Double-bounce test: Send a message with a completely bad envelope.
- % /var/qmail/bin/qmail-inject -f nonexistent
- To: unknownuser
- Subject: testing
-
- This is a test. This is only a test.
- %
- (Use end-of-file, not dot, to end the message.) Look for the double
- bounce in the alias mailbox.
-
-17. Group membership test:
- % cat > ~me/.qmail-groups
- |groups >> MYGROUPS; exit 0
- % /var/qmail/bin/qmail-inject me-groups < /dev/null
- % cat ~me/MYGROUPS
- MYGROUPS will show your normal gid and nothing else. (Under Solaris,
- make sure to use /usr/ucb/groups; /usr/bin/groups is broken.)
-
-18. SMTP server test: Forge some mail locally via SMTP.
- % telnet 127.0.0.1 25
- Trying 127.0.0.1...
- Connected to 127.0.0.1.
- Escape character is '^]'.
- 220 domain ESMTP
- helo dude
- 250-domain
- 250-PIPELINING
- 250 8BITMIME
- mail <me@domain>
- 250 ok
- rcpt <me@domain>
- 250 ok
- data
- 354 go ahead
- Subject: testing
-
- This is a test.
- .
- 250 ok 812345679 qp 12345
- quit
- 221 domain
- Connection closed by foreign host.
- %
- Look for the message in your mailbox.
-
-19. Remote-local test: Send yourself some mail from another machine.
-
-20. Remote-error test: I think you can figure this one out.
-
-21. UA test: Try sending mail, first to a local account, then to a
- remote account, with your normal user agent.
-
-22. Remote-postmaster test: Send mail from another machine to
- PoStMaStEr@domain. Look for the message in the alias mailbox.
+10. 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.
+ % ( 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.
diff --git a/VERSION b/VERSION
@@ -1 +1 @@
-qmail 1.02
+qmail 1.03
diff --git a/bouncesaying.1 b/bouncesaying.1
@@ -0,0 +1,71 @@
+.TH bouncesaying 1
+.SH NAME
+bouncesaying \- perhaps bounce each incoming message
+.SH SYNOPSIS
+in
+.BR .qmail :
+.B |bouncesaying
+.I error
+[
+.I program
+[
+.I arg ...
+]
+]
+.SH DESCRIPTION
+.B bouncesaying
+feeds each new mail message to
+.I program
+with the given arguments.
+If
+.I program
+exits 0,
+.B bouncesaying
+prints
+.I error
+and bounces the message.
+
+If
+.I program
+exits 111,
+.B bouncesaying
+exits 111,
+so delivery will be retried later.
+
+If
+.I program
+exits anything else
+(or does not exist),
+.B bouncesaying
+exits 0,
+so the rest of
+.B .qmail
+will be processed as usual.
+
+Note that
+it is not safe for
+.I program
+to fork a child that
+reads the message in the background.
+
+If
+.I program
+is not supplied,
+.B bouncesaying
+always bounces the message:
+
+.EX
+ |bouncesaying 'This address no longer accepts mail.'
+.EE
+
+.B WARNING:
+If you create a
+.B .qmail
+file to enable
+.BR bouncesaying ,
+make sure to also add a line specifying delivery to your normal mailbox.
+.SH "SEE ALSO"
+condredirect(1),
+except(1),
+dot-qmail(5),
+qmail-command(8)
diff --git a/bouncesaying.c b/bouncesaying.c
@@ -0,0 +1,41 @@
+#include "fork.h"
+#include "strerr.h"
+#include "error.h"
+#include "wait.h"
+#include "sig.h"
+#include "exit.h"
+
+#define FATAL "bouncesaying: fatal: "
+
+void main(argc,argv)
+int argc;
+char **argv;
+{
+ int pid;
+ int wstat;
+
+ if (!argv[1])
+ strerr_die1x(100,"bouncesaying: usage: bouncesaying error [ program [ arg ... ] ]");
+
+ if (argv[2]) {
+ pid = fork();
+ if (pid == -1)
+ strerr_die2sys(111,FATAL,"unable to fork: ");
+ if (pid == 0) {
+ execvp(argv[2],argv + 2);
+ if (error_temp(errno)) _exit(111);
+ _exit(100);
+ }
+ if (wait_pid(&wstat,pid) == -1)
+ strerr_die2x(111,FATAL,"wait failed");
+ if (wait_crashed(wstat))
+ strerr_die2x(111,FATAL,"child crashed");
+ switch(wait_exitcode(wstat)) {
+ case 0: break;
+ case 111: strerr_die2x(111,FATAL,"temporary child error");
+ default: _exit(0);
+ }
+ }
+
+ strerr_die1x(100,argv[1]);
+}
diff --git a/condredirect.1 b/condredirect.1
@@ -56,6 +56,8 @@ file to enable
.BR condredirect ,
make sure to also add a line specifying delivery to your normal mailbox.
.SH "SEE ALSO"
+bouncesaying(1),
+except(1),
dot-qmail(5),
qmail-command(8),
qmail-queue(8)
diff --git a/conf-patrn b/conf-patrn
@@ -1,5 +1,6 @@
-022
+002
-These stat bits are not allowed in ~ and ~/.qmail.
+These stat bits are not allowed in ~ and ~/.qmail. On most systems, the
+default umask is 022 or 077, so 022 will work here.
Note that ~ftp, ~www, ~uucp, etc. should be owned by root.
diff --git a/dns.c b/dns.c
@@ -271,17 +271,16 @@ int pref;
int r;
struct ip_mx ix;
- if (sa->len && (sa->s[0] == '['))
- {
- if (!stralloc_copy(&glue,sa)) return DNS_MEM;
- if (!stralloc_0(&glue)) return DNS_MEM;
+ if (!stralloc_copy(&glue,sa)) return DNS_MEM;
+ if (!stralloc_0(&glue)) return DNS_MEM;
+ if (glue.s[0]) {
ix.pref = 0;
- if (!glue.s[ip_scanbracket(glue.s,&ix.ip)])
+ if (!glue.s[ip_scan(glue.s,&ix.ip)] || !glue.s[ip_scanbracket(glue.s,&ix.ip)])
{
if (!ipalloc_append(ia,&ix)) return DNS_MEM;
return 0;
}
- }
+ }
switch(resolve(sa,T_A))
{
@@ -316,6 +315,7 @@ unsigned long random;
{
int r;
struct mx { stralloc sa; unsigned short p; } *mx;
+ struct ip_mx ix;
int nummx;
int i;
int j;
@@ -324,18 +324,16 @@ unsigned long random;
if (!ipalloc_readyplus(ia,0)) return DNS_MEM;
ia->len = 0;
- if (sa->len && (sa->s[0] == '['))
- {
- struct ip_mx ix;
- if (!stralloc_copy(&glue,sa)) return DNS_MEM;
- if (!stralloc_0(&glue)) return DNS_MEM;
+ if (!stralloc_copy(&glue,sa)) return DNS_MEM;
+ if (!stralloc_0(&glue)) return DNS_MEM;
+ if (glue.s[0]) {
ix.pref = 0;
- if (!glue.s[ip_scanbracket(glue.s,&ix.ip)])
+ if (!glue.s[ip_scan(glue.s,&ix.ip)] || !glue.s[ip_scanbracket(glue.s,&ix.ip)])
{
if (!ipalloc_append(ia,&ix)) return DNS_MEM;
return 0;
}
- }
+ }
switch(resolve(sa,T_MX))
{
diff --git a/except.1 b/except.1
@@ -0,0 +1,33 @@
+.TH except 1
+.SH NAME
+except \- reverse the exit code of a program
+.SH SYNOPSIS
+.B except
+.I program
+[
+.I arg ...
+]
+.SH DESCRIPTION
+.B except
+runs
+.I program
+with the given arguments.
+
+If
+.I program
+exits 0,
+.B except
+exits 100.
+If
+.I program
+exits 111,
+.B except
+exits 111.
+If
+.I program
+exits anything else,
+.B except
+exits 0.
+.SH "SEE ALSO"
+bouncesaying(1),
+condredirect(1)
diff --git a/except.c b/except.c
@@ -0,0 +1,37 @@
+#include "fork.h"
+#include "strerr.h"
+#include "wait.h"
+#include "error.h"
+#include "exit.h"
+
+#define FATAL "except: fatal: "
+
+void main(argc,argv)
+int argc;
+char **argv;
+{
+ int pid;
+ int wstat;
+
+ if (!argv[1])
+ strerr_die1x(100,"except: usage: except program [ arg ... ]");
+
+ pid = fork();
+ if (pid == -1)
+ strerr_die2sys(111,FATAL,"unable to fork: ");
+ if (pid == 0) {
+ execvp(argv[1],argv + 1);
+ if (error_temp(errno)) _exit(111);
+ _exit(100);
+ }
+
+ if (wait_pid(&wstat,pid) == -1)
+ strerr_die2x(111,FATAL,"wait failed");
+ if (wait_crashed(wstat))
+ strerr_die2x(111,FATAL,"child crashed");
+ switch(wait_exitcode(wstat)) {
+ case 0: _exit(100);
+ case 111: strerr_die2x(111,FATAL,"temporary child error");
+ default: _exit(0);
+ }
+}
diff --git a/forgeries.7 b/forgeries.7
@@ -71,7 +71,7 @@ Fortunately, a system administrator can easily obtain a copy of a
931/1413/Ident/TAP server, such as
.BR pidentd .
Unfortunately,
-many incompetent system administrators fail to do this,
+some system administrators fail to do this,
and are thus unable to figure out which local user
was responsible for generating a message.
diff --git a/hier.c b/hier.c
@@ -0,0 +1,252 @@
+#include "auto_qmail.h"
+#include "auto_split.h"
+#include "auto_uids.h"
+#include "fmt.h"
+#include "fifo.h"
+
+char buf[100 + FMT_ULONG];
+
+void dsplit(base,uid,mode)
+char *base; /* must be under 100 bytes */
+int uid;
+int mode;
+{
+ char *x;
+ unsigned long i;
+
+ d(auto_qmail,base,uid,auto_gidq,mode);
+
+ for (i = 0;i < auto_split;++i) {
+ x = buf;
+ x += fmt_str(x,base);
+ x += fmt_str(x,"/");
+ x += fmt_ulong(x,i);
+ *x = 0;
+
+ d(auto_qmail,buf,uid,auto_gidq,mode);
+ }
+}
+
+void hier()
+{
+ h(auto_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(auto_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);
+
+ 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);
+
+ 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(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(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(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(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(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(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);
+}
diff --git a/idedit.c b/idedit.c
@@ -0,0 +1,147 @@
+#include <sys/types.h>
+#include <pwd.h>
+#include <grp.h>
+#include "readwrite.h"
+#include "exit.h"
+#include "scan.h"
+#include "fmt.h"
+#include "strerr.h"
+#include "open.h"
+#include "seek.h"
+#include "fork.h"
+
+#define FATAL "idedit: fatal: "
+#define WARNING "idedit: warning: "
+
+int fd;
+
+void byte(pos,value)
+char *pos;
+unsigned int value;
+{
+ unsigned long u;
+ unsigned char ch;
+
+ if (pos[scan_ulong(pos,&u)]) return;
+
+ if (seek_set(fd,(seek_pos) u) == -1)
+ strerr_die2sys(111,FATAL,"unable to seek: ");
+
+ ch = value;
+ if (write(fd,&ch,1) != 1)
+ strerr_die2sys(111,FATAL,"unable to write: ");
+}
+
+char *args[10];
+
+void run()
+{
+ int pid;
+ int wstat;
+
+ pid = fork();
+ if (pid == -1)
+ strerr_die2sys(111,FATAL,"unable to fork: ");
+
+ if (pid == 0) {
+ execv(*args,args);
+ strerr_die4sys(111,WARNING,"unable to run ",*args,": ");
+ }
+
+ if (wait_pid(&wstat,pid) != pid)
+ strerr_die2sys(111,FATAL,"waitpid surprise");
+}
+
+void u(account,group,home,pos0,pos1,pos2,pos3)
+char *account;
+char *group;
+char *home;
+char *pos0;
+char *pos1;
+char *pos2;
+char *pos3;
+{
+ struct passwd *pw;
+ unsigned int value;
+
+ pw = getpwnam(account);
+
+ if (!pw && group) {
+ args[0] = "add-account";
+ args[1] = account;
+ args[2] = group;
+ args[3] = home;
+ args[4] = 0;
+ run();
+ pw = getpwnam(account);
+ }
+
+ if (!pw)
+ strerr_die3x(111,FATAL,"unable to find uid for ",account);
+
+ value = pw->pw_uid;
+ byte(pos0,value); value >>= 8;
+ byte(pos1,value); value >>= 8;
+ byte(pos2,value); value >>= 8;
+ byte(pos3,value); value >>= 8;
+ if (value)
+ strerr_die3x(111,FATAL,"excessively large uid for ",account);
+}
+
+void g(group,pos0,pos1,pos2,pos3)
+char *group;
+char *pos0;
+char *pos1;
+char *pos2;
+char *pos3;
+{
+ struct group *gr;
+ unsigned int value;
+
+ gr = getgrnam(group);
+
+ if (!gr) {
+ args[0] = "add-group";
+ args[1] = group;
+ args[2] = 0;
+ run();
+ gr = getgrnam(group);
+ }
+
+ if (!gr)
+ strerr_die3x(111,FATAL,"unable to find gid for ",group);
+
+ value = gr->gr_gid;
+ byte(pos0,value); value >>= 8;
+ byte(pos1,value); value >>= 8;
+ byte(pos2,value); value >>= 8;
+ byte(pos3,value); value >>= 8;
+ if (value)
+ strerr_die3x(111,FATAL,"excessively large gid for ",group);
+}
+
+void main(argc,argv)
+int argc;
+char **argv;
+{
+ if (argc < 42) _exit(100);
+
+ fd = open_write(argv[1]);
+ if (fd == -1) strerr_die4sys(111,FATAL,"unable to open ",argv[1],": ");
+
+ g("qmail",argv[34],argv[35],argv[36],argv[37]);
+ g("nofiles",argv[38],argv[39],argv[40],argv[41]);
+
+ u("root",(char *) 0,"/",argv[14],argv[15],argv[16],argv[17]);
+
+ u("qmaild","nofiles","/var/qmail",argv[6],argv[7],argv[8],argv[9]);
+ u("qmaill","nofiles","/var/qmail",argv[10],argv[11],argv[12],argv[13]);
+ u("qmailp","nofiles","/var/qmail",argv[18],argv[19],argv[20],argv[21]);
+ u("alias","nofiles","/var/qmail/alias",argv[2],argv[3],argv[4],argv[5]);
+
+ u("qmailq","qmail","/var/qmail",argv[22],argv[23],argv[24],argv[25]);
+ u("qmailr","qmail","/var/qmail",argv[26],argv[27],argv[28],argv[29]);
+ u("qmails","qmail","/var/qmail",argv[30],argv[31],argv[32],argv[33]);
+
+ _exit(0);
+}
diff --git a/install-big.c b/install-big.c
@@ -0,0 +1,285 @@
+#include "auto_qmail.h"
+#include "auto_split.h"
+#include "auto_uids.h"
+#include "fmt.h"
+#include "fifo.h"
+
+char buf[100 + FMT_ULONG];
+
+void dsplit(base,uid,mode)
+char *base; /* must be under 100 bytes */
+int uid;
+int mode;
+{
+ char *x;
+ unsigned long i;
+
+ d(auto_qmail,base,uid,auto_gidq,mode);
+
+ for (i = 0;i < auto_split;++i) {
+ x = buf;
+ x += fmt_str(x,base);
+ x += fmt_str(x,"/");
+ x += fmt_ulong(x,i);
+ *x = 0;
+
+ d(auto_qmail,buf,uid,auto_gidq,mode);
+ }
+}
+
+void hier()
+{
+ h(auto_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(auto_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);
+
+ 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);
+
+ 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(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(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(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(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(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(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(auto_qmail,"bin","dot-forward",auto_uido,auto_gidq,0755);
+
+ c(auto_qmail,"man/man1","dot-forward.1",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/cat1","dot-forward.0",auto_uido,auto_gidq,0644);
+
+ d(auto_qmail,"doc/fastforward",auto_uido,auto_gidq,0755);
+
+ c(auto_qmail,"bin","fastforward",auto_uido,auto_gidq,0755);
+ c(auto_qmail,"bin","printforward",auto_uido,auto_gidq,0755);
+ c(auto_qmail,"bin","setforward",auto_uido,auto_gidq,0755);
+ c(auto_qmail,"bin","newaliases",auto_uido,auto_gidq,0755);
+ c(auto_qmail,"bin","printmaillist",auto_uido,auto_gidq,0755);
+ c(auto_qmail,"bin","setmaillist",auto_uido,auto_gidq,0755);
+ c(auto_qmail,"bin","newinclude",auto_uido,auto_gidq,0755);
+
+ c(auto_qmail,"doc/fastforward","ALIASES",auto_uido,auto_gidq,0644);
+
+ c(auto_qmail,"man/man1","fastforward.1",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/man1","printforward.1",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/man1","setforward.1",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/man1","newaliases.1",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/man1","printmaillist.1",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/man1","setmaillist.1",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/man1","newinclude.1",auto_uido,auto_gidq,0644);
+
+ c(auto_qmail,"man/cat1","fastforward.0",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/cat1","printforward.0",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/cat1","setforward.0",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/cat1","newaliases.0",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/cat1","printmaillist.0",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/cat1","setmaillist.0",auto_uido,auto_gidq,0644);
+ c(auto_qmail,"man/cat1","newinclude.0",auto_uido,auto_gidq,0644);
+}
diff --git a/install.c b/install.c
@@ -1,167 +1,164 @@
#include "substdio.h"
-#include "stralloc.h"
-#include "getln.h"
+#include "strerr.h"
+#include "error.h"
+#include "open.h"
#include "readwrite.h"
#include "exit.h"
-#include "open.h"
-#include "error.h"
-#include "strerr.h"
-#include "byte.h"
-#include "fifo.h"
-stralloc target = {0};
-char *to;
+extern void hier();
#define FATAL "install: fatal: "
-void nomem() { strerr_die2x(111,FATAL,"out of memory"); }
+
+int fdsourcedir = -1;
+
+void h(home,uid,gid,mode)
+char *home;
+int uid;
+int gid;
+int mode;
+{
+ if (mkdir(home,0700) == -1)
+ if (errno != error_exist)
+ strerr_die4sys(111,FATAL,"unable to mkdir ",home,": ");
+ if (chown(home,uid,gid) == -1)
+ strerr_die4sys(111,FATAL,"unable to chown ",home,": ");
+ if (chmod(home,mode) == -1)
+ strerr_die4sys(111,FATAL,"unable to chmod ",home,": ");
+}
+
+void d(home,subdir,uid,gid,mode)
+char *home;
+char *subdir;
+int uid;
+int gid;
+int mode;
+{
+ if (chdir(home) == -1)
+ strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
+ if (mkdir(subdir,0700) == -1)
+ if (errno != error_exist)
+ strerr_die6sys(111,FATAL,"unable to mkdir ",home,"/",subdir,": ");
+ if (chown(subdir,uid,gid) == -1)
+ strerr_die6sys(111,FATAL,"unable to chown ",home,"/",subdir,": ");
+ if (chmod(subdir,mode) == -1)
+ strerr_die6sys(111,FATAL,"unable to chmod ",home,"/",subdir,": ");
+}
+
+void p(home,fifo,uid,gid,mode)
+char *home;
+char *fifo;
+int uid;
+int gid;
+int mode;
+{
+ if (chdir(home) == -1)
+ strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
+ if (fifo_make(fifo,0700) == -1)
+ if (errno != error_exist)
+ strerr_die6sys(111,FATAL,"unable to mkfifo ",home,"/",fifo,": ");
+ if (chown(fifo,uid,gid) == -1)
+ strerr_die6sys(111,FATAL,"unable to chown ",home,"/",fifo,": ");
+ if (chmod(fifo,mode) == -1)
+ strerr_die6sys(111,FATAL,"unable to chmod ",home,"/",fifo,": ");
+}
char inbuf[SUBSTDIO_INSIZE];
char outbuf[SUBSTDIO_OUTSIZE];
substdio ssin;
substdio ssout;
-void doit(line)
-stralloc *line;
+void c(home,subdir,file,uid,gid,mode)
+char *home;
+char *subdir;
+char *file;
+int uid;
+int gid;
+int mode;
{
- char *x;
- unsigned int xlen;
- unsigned int i;
- char *type;
- char *uidstr;
- char *gidstr;
- char *modestr;
- char *mid;
- char *name;
- unsigned long uid;
- unsigned long gid;
- unsigned long mode;
int fdin;
int fdout;
- unsigned long zlen;
-
- x = line->s; xlen = line->len;
-
- type = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- uidstr = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- gidstr = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- modestr = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- mid = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- name = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- if (!stralloc_copys(&target,to)) nomem();
- if (!stralloc_cats(&target,mid)) nomem();
- if (!stralloc_cats(&target,name)) nomem();
- if (!stralloc_0(&target)) nomem();
-
- uid = -1; if (*uidstr) scan_ulong(uidstr,&uid);
- gid = -1; if (*gidstr) scan_ulong(gidstr,&gid);
- scan_8long(modestr,&mode);
-
- switch(*type) {
- case 'z':
- scan_ulong(type + 1,&zlen);
-
- fdout = open_trunc(target.s);
- if (fdout == -1)
- strerr_die4sys(111,FATAL,"unable to write ",target.s,": ");
- substdio_fdbuf(&ssout,write,fdout,outbuf,sizeof(outbuf));
-
- while (zlen--)
- if (substdio_put(&ssout,"",1) == -1)
- strerr_die4sys(111,FATAL,"unable to write ",target.s,": ");
-
- if (substdio_flush(&ssout) == -1)
- strerr_die4sys(111,FATAL,"unable to write ",target.s,": ");
- if (fsync(fdout) == -1)
- strerr_die4sys(111,FATAL,"unable to write ",target.s,": ");
- close(fdout);
- break;
-
- case 'p':
- if (fifo_make(target.s,0700) == -1)
- if (errno != error_exist)
- strerr_die4sys(111,FATAL,"unable to mkfifo ",target.s,": ");
- break;
-
- case 'd':
- if (mkdir(target.s,0700) == -1)
- if (errno != error_exist)
- strerr_die4sys(111,FATAL,"unable to mkdir ",target.s,": ");
- break;
-
- case 'c':
- fdin = open_read(name);
- if (fdin == -1)
- strerr_die4sys(111,FATAL,"unable to read ",name,": ");
- substdio_fdbuf(&ssin,read,fdin,inbuf,sizeof(inbuf));
-
- fdout = open_trunc(target.s);
- if (fdout == -1)
- strerr_die4sys(111,FATAL,"unable to write ",target.s,": ");
- substdio_fdbuf(&ssout,write,fdout,outbuf,sizeof(outbuf));
-
- switch(substdio_copy(&ssout,&ssin)) {
- case -2:
- strerr_die4sys(111,FATAL,"unable to read ",name,": ");
- case -3:
- strerr_die4sys(111,FATAL,"unable to write ",target.s,": ");
- }
-
- close(fdin);
- if (substdio_flush(&ssout) == -1)
- strerr_die4sys(111,FATAL,"unable to write ",target.s,": ");
- if (fsync(fdout) == -1)
- strerr_die4sys(111,FATAL,"unable to write ",target.s,": ");
- close(fdout);
- break;
-
- default:
- return;
+
+ if (fchdir(fdsourcedir) == -1)
+ strerr_die2sys(111,FATAL,"unable to switch back to source directory: ");
+
+ fdin = open_read(file);
+ if (fdin == -1)
+ strerr_die4sys(111,FATAL,"unable to read ",file,": ");
+ substdio_fdbuf(&ssin,read,fdin,inbuf,sizeof inbuf);
+
+ if (chdir(home) == -1)
+ strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
+ if (chdir(subdir) == -1)
+ strerr_die6sys(111,FATAL,"unable to switch to ",home,"/",subdir,": ");
+
+ fdout = open_trunc(file);
+ if (fdout == -1)
+ strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
+ substdio_fdbuf(&ssout,write,fdout,outbuf,sizeof outbuf);
+
+ switch(substdio_copy(&ssout,&ssin)) {
+ case -2:
+ strerr_die4sys(111,FATAL,"unable to read ",file,": ");
+ case -3:
+ strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
}
- if (chown(target.s,uid,gid) == -1)
- strerr_die4sys(111,FATAL,"unable to chown ",target.s,": ");
- if (chmod(target.s,mode) == -1)
- strerr_die4sys(111,FATAL,"unable to chmod ",target.s,": ");
+ close(fdin);
+ if (substdio_flush(&ssout) == -1)
+ strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
+ if (fsync(fdout) == -1)
+ strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
+ if (close(fdout) == -1) /* NFS silliness */
+ strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
+
+ if (chown(file,uid,gid) == -1)
+ strerr_die6sys(111,FATAL,"unable to chown .../",subdir,"/",file,": ");
+ if (chmod(file,mode) == -1)
+ strerr_die6sys(111,FATAL,"unable to chmod .../",subdir,"/",file,": ");
}
-char buf[256];
-substdio in = SUBSTDIO_FDBUF(read,0,buf,sizeof(buf));
-stralloc line = {0};
-
-void main(argc,argv)
-int argc;
-char **argv;
+void z(home,file,len,uid,gid,mode)
+char *home;
+char *file;
+int len;
+int uid;
+int gid;
+int mode;
{
- int match;
+ int fdout;
- umask(077);
+ if (chdir(home) == -1)
+ strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
+
+ fdout = open_trunc(file);
+ if (fdout == -1)
+ strerr_die6sys(111,FATAL,"unable to write ",home,"/",file,": ");
+ substdio_fdbuf(&ssout,write,fdout,outbuf,sizeof outbuf);
+
+ while (len-- > 0)
+ if (substdio_put(&ssout,"",1) == -1)
+ strerr_die6sys(111,FATAL,"unable to write ",home,"/",file,": ");
+
+ if (substdio_flush(&ssout) == -1)
+ strerr_die6sys(111,FATAL,"unable to write ",home,"/",file,": ");
+ if (fsync(fdout) == -1)
+ strerr_die6sys(111,FATAL,"unable to write ",home,"/",file,": ");
+ if (close(fdout) == -1) /* NFS silliness */
+ strerr_die6sys(111,FATAL,"unable to write ",home,"/",file,": ");
+
+ if (chown(file,uid,gid) == -1)
+ strerr_die6sys(111,FATAL,"unable to chown ",home,"/",file,": ");
+ if (chmod(file,mode) == -1)
+ strerr_die6sys(111,FATAL,"unable to chmod ",home,"/",file,": ");
+}
- to = argv[1];
- if (!to) strerr_die2x(100,FATAL,"install: usage: install dir");
+void main()
+{
+ fdsourcedir = open_read(".");
+ if (fdsourcedir == -1)
+ strerr_die2sys(111,FATAL,"unable to open current directory: ");
- for (;;) {
- if (getln(&in,&line,&match,'\n') == -1)
- strerr_die2sys(111,FATAL,"unable to read input: ");
- doit(&line);
- if (!match)
- _exit(0);
- }
+ umask(077);
+ hier();
+ _exit(0);
}
diff --git a/instcheck.c b/instcheck.c
@@ -1,120 +1,108 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include "substdio.h"
-#include "stralloc.h"
-#include "getln.h"
+#include "strerr.h"
+#include "error.h"
#include "readwrite.h"
#include "exit.h"
-#include "error.h"
-#include "strerr.h"
-#include "byte.h"
-stralloc target = {0};
-char *to;
+extern void hier();
-#define WARNING "instcheck: warning: "
#define FATAL "instcheck: fatal: "
-void nomem() { strerr_die2x(111,FATAL,"out of memory"); }
+#define WARNING "instcheck: warning: "
-void doit(line)
-stralloc *line;
+void perm(prefix1,prefix2,prefix3,file,type,uid,gid,mode)
+char *prefix1;
+char *prefix2;
+char *prefix3;
+char *file;
+int type;
+int uid;
+int gid;
+int mode;
{
struct stat st;
- char *x;
- unsigned int xlen;
- unsigned int i;
- char *type;
- char *uidstr;
- char *gidstr;
- char *modestr;
- char *mid;
- char *name;
- unsigned long uid;
- unsigned long gid;
- unsigned long mode;
- int ftype;
-
- x = line->s; xlen = line->len;
-
- type = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- uidstr = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- gidstr = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- modestr = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- mid = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- name = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- if (!stralloc_copys(&target,to)) nomem();
- if (!stralloc_cats(&target,mid)) nomem();
- if (!stralloc_cats(&target,name)) nomem();
- if (!stralloc_0(&target)) nomem();
-
- uid = -1; if (*uidstr) scan_ulong(uidstr,&uid);
- gid = -1; if (*gidstr) scan_ulong(gidstr,&gid);
- scan_8long(modestr,&mode);
- switch(*type) {
- case 'd': ftype = S_IFDIR; break;
- case 'c': ftype = S_IFREG; break;
- case 'z': ftype = S_IFREG; break;
- case 'p': ftype = S_IFIFO; break;
- default: return;
- }
-
- if (stat(target.s,&st) == -1) {
+ if (stat(file,&st) == -1) {
if (errno == error_noent)
- strerr_warn3(WARNING,target.s," does not exist",0);
+ strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," does not exist",0);
else
- strerr_warn4(WARNING,"unable to stat ",target.s,": ",&strerr_sys);
+ strerr_warn4(WARNING,"unable to stat .../",file,": ",&strerr_sys);
return;
}
if ((uid != -1) && (st.st_uid != uid))
- strerr_warn3(WARNING,target.s," has wrong owner",0);
+ strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," has wrong owner",0);
if ((gid != -1) && (st.st_gid != gid))
- strerr_warn3(WARNING,target.s," has wrong group",0);
+ strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," has wrong group",0);
if ((st.st_mode & 07777) != mode)
- strerr_warn3(WARNING,target.s," has wrong permissions",0);
- if ((st.st_mode & S_IFMT) != ftype)
- strerr_warn3(WARNING,target.s," has wrong type",0);
+ strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," has wrong permissions",0);
+ if ((st.st_mode & S_IFMT) != type)
+ strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," has wrong type",0);
}
-char buf[256];
-substdio in = SUBSTDIO_FDBUF(read,0,buf,sizeof(buf));
-stralloc line = {0};
+void h(home,uid,gid,mode)
+char *home;
+int uid;
+int gid;
+int mode;
+{
+ perm("","","",home,S_IFDIR,uid,gid,mode);
+}
+
+void d(home,subdir,uid,gid,mode)
+char *home;
+char *subdir;
+int uid;
+int gid;
+int mode;
+{
+ if (chdir(home) == -1)
+ strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
+ perm("",home,"/",subdir,S_IFDIR,uid,gid,mode);
+}
-void main(argc,argv)
-int argc;
-char **argv;
+void p(home,fifo,uid,gid,mode)
+char *home;
+char *fifo;
+int uid;
+int gid;
+int mode;
{
- int match;
+ if (chdir(home) == -1)
+ strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
+ perm("",home,"/",fifo,S_IFIFO,uid,gid,mode);
+}
- umask(077);
+void c(home,subdir,file,uid,gid,mode)
+char *home;
+char *subdir;
+char *file;
+int uid;
+int gid;
+int mode;
+{
+ if (chdir(home) == -1)
+ strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
+ if (chdir(subdir) == -1)
+ strerr_die6sys(111,FATAL,"unable to switch to ",home,"/",subdir,": ");
+ perm(".../",subdir,"/",file,S_IFREG,uid,gid,mode);
+}
- to = argv[1];
- if (!to) strerr_die2x(100,FATAL,"instcheck: usage: instcheck dir");
+void z(home,file,len,uid,gid,mode)
+char *home;
+char *file;
+int len;
+int uid;
+int gid;
+int mode;
+{
+ if (chdir(home) == -1)
+ strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
+ perm("",home,"/",file,S_IFREG,uid,gid,mode);
+}
- for (;;) {
- if (getln(&in,&line,&match,'\n') == -1)
- strerr_die2sys(111,FATAL,"unable to read input: ");
- doit(&line);
- if (!match)
- _exit(0);
- }
+void main()
+{
+ hier();
+ _exit(0);
}
diff --git a/qmail-header.5 b/qmail-header.5
@@ -11,7 +11,8 @@ The main function of
.B qmail-inject
is to make sure that each outgoing message has an appropriate header.
-For more detailed information, see RFC 822 and RFC 1123.
+For more detailed information, see
+.BR http://pobox.com/~djb/proto/immhf.html .
.SH "MESSAGE STRUCTURE"
A message contains a series of
.I header fields\fR,
diff --git a/qmail-hier.c b/qmail-hier.c
@@ -1,288 +0,0 @@
-#include "subfd.h"
-#include "substdio.h"
-#include "auto_split.h"
-#include "auto_uids.h"
-#include "fmt.h"
-
-char strnum[FMT_ULONG];
-
-void uidgid(uid)
-int uid;
-{
- substdio_put(subfdout,strnum,fmt_ulong(strnum,(unsigned long) uid));
- substdio_puts(subfdout,":");
- substdio_put(subfdout,strnum,fmt_ulong(strnum,(unsigned long) auto_gidq));
- substdio_puts(subfdout,":");
-}
-
-void copy(uid,mode,sub,fn)
-int uid;
-char *mode;
-char *sub;
-char *fn;
-{
- substdio_puts(subfdout,"c:");
- uidgid(uid);
- substdio_puts(subfdout,mode);
- substdio_puts(subfdout,":");
- substdio_puts(subfdout,sub);
- substdio_puts(subfdout,":");
- substdio_puts(subfdout,fn);
- substdio_puts(subfdout,":\n");
-}
-
-void dir(uid,mode,fn)
-int uid;
-char *mode;
-char *fn;
-{
- substdio_puts(subfdout,"d:");
- uidgid(uid);
- substdio_puts(subfdout,mode);
- substdio_puts(subfdout,":");
- substdio_puts(subfdout,fn);
- substdio_puts(subfdout,"::\n");
-}
-
-void dirsplit(uid,mode,fn)
-int uid;
-char *mode;
-char *fn;
-{
- unsigned long i;
- dir(uid,mode,fn);
- for (i = 0;i < auto_split;++i) {
- substdio_puts(subfdout,"d:");
- uidgid(uid);
- substdio_puts(subfdout,mode);
- substdio_puts(subfdout,":");
- substdio_puts(subfdout,fn);
- substdio_puts(subfdout,":/");
- substdio_put(subfdout,strnum,fmt_ulong(strnum,i));
- substdio_puts(subfdout,":\n");
- }
-}
-
-void main()
-{
- dir(auto_uido,"755","");
- dir(auto_uido,"755","/control");
- dir(auto_uido,"755","/users");
- dir(auto_uido,"755","/bin");
- dir(auto_uido,"755","/man");
- dir(auto_uido,"755","/man/cat1");
- dir(auto_uido,"755","/man/cat5");
- dir(auto_uido,"755","/man/cat7");
- dir(auto_uido,"755","/man/cat8");
- dir(auto_uido,"755","/man/man1");
- dir(auto_uido,"755","/man/man5");
- dir(auto_uido,"755","/man/man7");
- dir(auto_uido,"755","/man/man8");
- dir(auto_uido,"755","/doc");
- dir(auto_uido,"755","/boot");
-
- copy(auto_uido,"755","/boot/","home");
- copy(auto_uido,"755","/boot/","home+df");
- copy(auto_uido,"755","/boot/","proc");
- copy(auto_uido,"755","/boot/","proc+df");
- copy(auto_uido,"755","/boot/","binm1");
- copy(auto_uido,"755","/boot/","binm1+df");
- copy(auto_uido,"755","/boot/","binm2");
- copy(auto_uido,"755","/boot/","binm2+df");
- copy(auto_uido,"755","/boot/","binm3");
- copy(auto_uido,"755","/boot/","binm3+df");
-
- copy(auto_uido,"644","/doc/","FAQ");
- copy(auto_uido,"644","/doc/","UPGRADE");
- copy(auto_uido,"644","/doc/","SENDMAIL");
- copy(auto_uido,"644","/doc/","INSTALL");
- copy(auto_uido,"644","/doc/","INSTALL.alias");
- copy(auto_uido,"644","/doc/","INSTALL.boot");
- copy(auto_uido,"644","/doc/","INSTALL.ctl");
- copy(auto_uido,"644","/doc/","INSTALL.ids");
- copy(auto_uido,"644","/doc/","INSTALL.maildir");
- copy(auto_uido,"644","/doc/","INSTALL.mbox");
- copy(auto_uido,"644","/doc/","INSTALL.vsm");
- copy(auto_uido,"644","/doc/","PIC.local2alias");
- copy(auto_uido,"644","/doc/","PIC.local2ext");
- copy(auto_uido,"644","/doc/","PIC.local2local");
- copy(auto_uido,"644","/doc/","PIC.local2rem");
- copy(auto_uido,"644","/doc/","PIC.local2virt");
- copy(auto_uido,"644","/doc/","PIC.nullclient");
- copy(auto_uido,"644","/doc/","PIC.relaybad");
- copy(auto_uido,"644","/doc/","PIC.relaygood");
- copy(auto_uido,"644","/doc/","PIC.rem2local");
-
- dir(auto_uida,"2755","/alias");
- dir(auto_uidq,"750","/queue");
- dir(auto_uidq,"700","/queue/pid");
- dir(auto_uidq,"700","/queue/intd");
- dir(auto_uidq,"750","/queue/todo");
- dir(auto_uidq,"750","/queue/lock");
- dir(auto_uids,"700","/queue/bounce");
-
- substdio_puts(subfdout,"z0:");
- uidgid(auto_uids);
- substdio_puts(subfdout,"600:/queue/lock/:sendmutex:\n");
-
- substdio_puts(subfdout,"z1024:");
- uidgid(auto_uidr);
- substdio_puts(subfdout,"644:/queue/lock/:tcpto:\n");
-
- substdio_puts(subfdout,"p:");
- uidgid(auto_uids);
- substdio_puts(subfdout,"622:/queue/lock/:trigger:\n");
-
- dirsplit(auto_uidq,"750","/queue/mess");
- dirsplit(auto_uids,"700","/queue/info");
- dirsplit(auto_uids,"700","/queue/local");
- dirsplit(auto_uids,"700","/queue/remote");
-
- copy(auto_uidq,"4711","/bin/","qmail-queue");
- copy(auto_uido,"700","/bin/","qmail-lspawn");
- copy(auto_uido,"700","/bin/","qmail-start");
- copy(auto_uido,"711","/bin/","qmail-getpw");
- copy(auto_uido,"711","/bin/","qmail-local");
- copy(auto_uido,"711","/bin/","qmail-remote");
- copy(auto_uido,"711","/bin/","qmail-rspawn");
- copy(auto_uido,"711","/bin/","qmail-clean");
- copy(auto_uido,"711","/bin/","qmail-send");
- copy(auto_uido,"711","/bin/","splogger");
- copy(auto_uido,"700","/bin/","qmail-newu");
- copy(auto_uido,"700","/bin/","qmail-newmrh");
- copy(auto_uido,"711","/bin/","qmail-pw2u");
- copy(auto_uido,"755","/bin/","qmail-inject");
- copy(auto_uido,"755","/bin/","predate");
- copy(auto_uido,"755","/bin/","datemail");
- copy(auto_uido,"755","/bin/","mailsubj");
- copy(auto_uido,"755","/bin/","qmail-showctl");
- copy(auto_uido,"755","/bin/","qmail-qread");
- copy(auto_uido,"755","/bin/","qmail-qstat");
- copy(auto_uido,"755","/bin/","qmail-tcpto");
- copy(auto_uido,"755","/bin/","qmail-tcpok");
- copy(auto_uido,"755","/bin/","qmail-pop3d");
- copy(auto_uido,"711","/bin/","qmail-popup");
- copy(auto_uido,"755","/bin/","qmail-qmqpc");
- copy(auto_uido,"755","/bin/","qmail-qmqpd");
- copy(auto_uido,"755","/bin/","qmail-qmtpd");
- copy(auto_uido,"755","/bin/","qmail-smtpd");
- copy(auto_uido,"755","/bin/","sendmail");
- copy(auto_uido,"755","/bin/","tcp-env");
- copy(auto_uido,"755","/bin/","qreceipt");
- copy(auto_uido,"755","/bin/","qsmhook");
- copy(auto_uido,"755","/bin/","qbiff");
- copy(auto_uido,"755","/bin/","forward");
- copy(auto_uido,"755","/bin/","preline");
- copy(auto_uido,"755","/bin/","condredirect");
- copy(auto_uido,"755","/bin/","maildirmake");
- copy(auto_uido,"755","/bin/","maildir2mbox");
- copy(auto_uido,"755","/bin/","maildirwatch");
- copy(auto_uido,"755","/bin/","qail");
- copy(auto_uido,"755","/bin/","elq");
- copy(auto_uido,"755","/bin/","pinq");
-
- copy(auto_uido,"644","/man/man5/","addresses.5");
- copy(auto_uido,"644","/man/cat5/","addresses.0");
- copy(auto_uido,"644","/man/man5/","envelopes.5");
- copy(auto_uido,"644","/man/cat5/","envelopes.0");
- copy(auto_uido,"644","/man/man5/","maildir.5");
- copy(auto_uido,"644","/man/cat5/","maildir.0");
- copy(auto_uido,"644","/man/man5/","mbox.5");
- copy(auto_uido,"644","/man/cat5/","mbox.0");
- copy(auto_uido,"644","/man/man5/","dot-qmail.5");
- copy(auto_uido,"644","/man/cat5/","dot-qmail.0");
- copy(auto_uido,"644","/man/man5/","qmail-control.5");
- copy(auto_uido,"644","/man/cat5/","qmail-control.0");
- copy(auto_uido,"644","/man/man5/","qmail-header.5");
- copy(auto_uido,"644","/man/cat5/","qmail-header.0");
- copy(auto_uido,"644","/man/man5/","qmail-log.5");
- copy(auto_uido,"644","/man/cat5/","qmail-log.0");
- copy(auto_uido,"644","/man/man5/","qmail-users.5");
- copy(auto_uido,"644","/man/cat5/","qmail-users.0");
- copy(auto_uido,"644","/man/man5/","tcp-environ.5");
- copy(auto_uido,"644","/man/cat5/","tcp-environ.0");
-
- copy(auto_uido,"644","/man/man7/","forgeries.7");
- copy(auto_uido,"644","/man/cat7/","forgeries.0");
- copy(auto_uido,"644","/man/man7/","qmail-limits.7");
- copy(auto_uido,"644","/man/cat7/","qmail-limits.0");
- copy(auto_uido,"644","/man/man7/","qmail.7");
- copy(auto_uido,"644","/man/cat7/","qmail.0");
-
- copy(auto_uido,"644","/man/man1/","forward.1");
- copy(auto_uido,"644","/man/cat1/","forward.0");
- copy(auto_uido,"644","/man/man1/","condredirect.1");
- copy(auto_uido,"644","/man/cat1/","condredirect.0");
- copy(auto_uido,"644","/man/man1/","maildirmake.1");
- copy(auto_uido,"644","/man/cat1/","maildirmake.0");
- copy(auto_uido,"644","/man/man1/","maildir2mbox.1");
- copy(auto_uido,"644","/man/cat1/","maildir2mbox.0");
- copy(auto_uido,"644","/man/man1/","maildirwatch.1");
- copy(auto_uido,"644","/man/cat1/","maildirwatch.0");
- copy(auto_uido,"644","/man/man1/","mailsubj.1");
- copy(auto_uido,"644","/man/cat1/","mailsubj.0");
- copy(auto_uido,"644","/man/man1/","qreceipt.1");
- copy(auto_uido,"644","/man/cat1/","qreceipt.0");
- copy(auto_uido,"644","/man/man1/","qbiff.1");
- copy(auto_uido,"644","/man/cat1/","qbiff.0");
- copy(auto_uido,"644","/man/man1/","preline.1");
- copy(auto_uido,"644","/man/cat1/","preline.0");
- copy(auto_uido,"644","/man/man1/","tcp-env.1");
- copy(auto_uido,"644","/man/cat1/","tcp-env.0");
-
- copy(auto_uido,"644","/man/man8/","qmail-local.8");
- copy(auto_uido,"644","/man/cat8/","qmail-local.0");
- copy(auto_uido,"644","/man/man8/","qmail-lspawn.8");
- copy(auto_uido,"644","/man/cat8/","qmail-lspawn.0");
- copy(auto_uido,"644","/man/man8/","qmail-getpw.8");
- copy(auto_uido,"644","/man/cat8/","qmail-getpw.0");
- copy(auto_uido,"644","/man/man8/","qmail-remote.8");
- copy(auto_uido,"644","/man/cat8/","qmail-remote.0");
- copy(auto_uido,"644","/man/man8/","qmail-rspawn.8");
- copy(auto_uido,"644","/man/cat8/","qmail-rspawn.0");
- copy(auto_uido,"644","/man/man8/","qmail-clean.8");
- copy(auto_uido,"644","/man/cat8/","qmail-clean.0");
- copy(auto_uido,"644","/man/man8/","qmail-send.8");
- copy(auto_uido,"644","/man/cat8/","qmail-send.0");
- copy(auto_uido,"644","/man/man8/","qmail-start.8");
- copy(auto_uido,"644","/man/cat8/","qmail-start.0");
- copy(auto_uido,"644","/man/man8/","splogger.8");
- copy(auto_uido,"644","/man/cat8/","splogger.0");
- copy(auto_uido,"644","/man/man8/","qmail-queue.8");
- copy(auto_uido,"644","/man/cat8/","qmail-queue.0");
- copy(auto_uido,"644","/man/man8/","qmail-inject.8");
- copy(auto_uido,"644","/man/cat8/","qmail-inject.0");
- copy(auto_uido,"644","/man/man8/","qmail-showctl.8");
- copy(auto_uido,"644","/man/cat8/","qmail-showctl.0");
- copy(auto_uido,"644","/man/man8/","qmail-newmrh.8");
- copy(auto_uido,"644","/man/cat8/","qmail-newmrh.0");
- copy(auto_uido,"644","/man/man8/","qmail-newu.8");
- copy(auto_uido,"644","/man/cat8/","qmail-newu.0");
- copy(auto_uido,"644","/man/man8/","qmail-pw2u.8");
- copy(auto_uido,"644","/man/cat8/","qmail-pw2u.0");
- copy(auto_uido,"644","/man/man8/","qmail-qread.8");
- copy(auto_uido,"644","/man/cat8/","qmail-qread.0");
- copy(auto_uido,"644","/man/man8/","qmail-qstat.8");
- copy(auto_uido,"644","/man/cat8/","qmail-qstat.0");
- copy(auto_uido,"644","/man/man8/","qmail-tcpok.8");
- copy(auto_uido,"644","/man/cat8/","qmail-tcpok.0");
- copy(auto_uido,"644","/man/man8/","qmail-tcpto.8");
- copy(auto_uido,"644","/man/cat8/","qmail-tcpto.0");
- copy(auto_uido,"644","/man/man8/","qmail-pop3d.8");
- copy(auto_uido,"644","/man/cat8/","qmail-pop3d.0");
- copy(auto_uido,"644","/man/man8/","qmail-popup.8");
- copy(auto_uido,"644","/man/cat8/","qmail-popup.0");
- copy(auto_uido,"644","/man/man8/","qmail-qmqpc.8");
- copy(auto_uido,"644","/man/cat8/","qmail-qmqpc.0");
- copy(auto_uido,"644","/man/man8/","qmail-qmqpd.8");
- copy(auto_uido,"644","/man/cat8/","qmail-qmqpd.0");
- copy(auto_uido,"644","/man/man8/","qmail-qmtpd.8");
- copy(auto_uido,"644","/man/cat8/","qmail-qmtpd.0");
- copy(auto_uido,"644","/man/man8/","qmail-smtpd.8");
- copy(auto_uido,"644","/man/cat8/","qmail-smtpd.0");
- copy(auto_uido,"644","/man/man8/","qmail-command.8");
- copy(auto_uido,"644","/man/cat8/","qmail-command.0");
-
- substdio_flush(subfdout);
- _exit(0);
-}
diff --git a/qmail-qmqpc.8 b/qmail-qmqpc.8
@@ -16,12 +16,6 @@ installation,
.B qmail-queue
is replaced with a symbolic link to
.BR qmail-qmqpc .
-
-.B qmail-qmqpc
-is currently experimental;
-use it at your own risk.
-It will be fully supported in the next release of
-.BR qmail .
.SH "CONTROL FILES"
.TP 5
.I qmqpservers
diff --git a/qmail-qmqpc.c b/qmail-qmqpc.c
@@ -1,5 +1,3 @@
-/* EXPERIMENTAL! Use at your own risk. */
-
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/qmail-qmqpd.8 b/qmail-qmqpd.8
@@ -17,12 +17,6 @@ see
.B qmail-qmqpd
will relay messages to any destination.
It should be invoked only for connections from preauthorized users.
-
-.B qmail-qmqpd
-is currently experimental;
-use it at your own risk.
-It will be fully supported in the next release of
-.BR qmail .
.SH "SEE ALSO"
tcp-env(1),
tcpserver(1),
diff --git a/qmail-qmqpd.c b/qmail-qmqpd.c
@@ -1,5 +1,3 @@
-/* EXPERIMENTAL! Use at your own risk. */
-
#include "auto_qmail.h"
#include "qmail.h"
#include "received.h"
@@ -167,9 +165,7 @@ main()
if (!flagok)
result = "Dsorry, I can't accept addresses like that (#5.1.3)";
- fmt_ulong(strnum,str_len(result));
-
- substdio_puts(&ssout,strnum);
+ substdio_put(&ssout,strnum,fmt_ulong(strnum,(unsigned long) str_len(result)));
substdio_puts(&ssout,":");
substdio_puts(&ssout,result);
substdio_puts(&ssout,",");
diff --git a/qmail-showctl.c b/qmail-showctl.c
@@ -9,8 +9,12 @@
#include "constmap.h"
#include "stralloc.h"
#include "direntry.h"
-#include "auto_qmail.h"
#include "auto_uids.h"
+#include "auto_qmail.h"
+#include "auto_break.h"
+#include "auto_patrn.h"
+#include "auto_spawn.h"
+#include "auto_split.h"
stralloc me = {0};
int meok;
@@ -139,11 +143,27 @@ void main()
struct stat stmrh;
struct stat stmrhcdb;
- substdio_puts(subfdout,"The qmail control files are stored in ");
+ substdio_puts(subfdout,"qmail home directory: ");
substdio_puts(subfdout,auto_qmail);
- substdio_puts(subfdout,"/control.\n");
+ substdio_puts(subfdout,".\n");
+
+ substdio_puts(subfdout,"user-ext delimiter: ");
+ substdio_puts(subfdout,auto_break);
+ substdio_puts(subfdout,".\n");
+
+ substdio_puts(subfdout,"paternalism (in decimal): ");
+ substdio_put(subfdout,num,fmt_ulong(num,(unsigned long) auto_patrn));
+ substdio_puts(subfdout,".\n");
- substdio_puts(subfdout,"The uids and gids are ");
+ substdio_puts(subfdout,"silent concurrency limit: ");
+ substdio_put(subfdout,num,fmt_ulong(num,(unsigned long) auto_spawn));
+ substdio_puts(subfdout,".\n");
+
+ substdio_puts(subfdout,"subdirectory split: ");
+ substdio_put(subfdout,num,fmt_ulong(num,(unsigned long) auto_split));
+ substdio_puts(subfdout,".\n");
+
+ substdio_puts(subfdout,"user ids: ");
substdio_put(subfdout,num,fmt_ulong(num,(unsigned long) auto_uida));
substdio_puts(subfdout,", ");
substdio_put(subfdout,num,fmt_ulong(num,(unsigned long) auto_uidd));
@@ -159,7 +179,9 @@ void main()
substdio_put(subfdout,num,fmt_ulong(num,(unsigned long) auto_uidr));
substdio_puts(subfdout,", ");
substdio_put(subfdout,num,fmt_ulong(num,(unsigned long) auto_uids));
- substdio_puts(subfdout,", ");
+ substdio_puts(subfdout,".\n");
+
+ substdio_puts(subfdout,"group ids: ");
substdio_put(subfdout,num,fmt_ulong(num,(unsigned long) auto_gidn));
substdio_puts(subfdout,", ");
substdio_put(subfdout,num,fmt_ulong(num,(unsigned long) auto_gidq));
diff --git a/qmail-smtpd.c b/qmail-smtpd.c
@@ -149,12 +149,14 @@ char *arg;
terminator = '>';
i = str_chr(arg,'<');
- if (!arg[i]) { /* partner should go read rfc 821 */
+ if (arg[i])
+ arg += i + 1;
+ else { /* partner should go read rfc 821 */
terminator = ' ';
- i = str_chr(arg,':');
- if (!arg[i]) return 0;
+ arg += str_chr(arg,':');
+ if (*arg == ':') ++arg;
+ while (*arg == ' ') ++arg;
}
- arg += i + 1;
/* strip source route */
if (*arg == '@') while (*arg) if (*arg++ == ':') break;
@@ -209,7 +211,7 @@ int bmfcheck()
int addrallowed()
{
int r;
- r = rcpthosts(addr.s + 1,addr.len - 2);
+ r = rcpthosts(addr.s,str_len(addr.s));
if (r == -1) die_control();
return r;
}
@@ -222,6 +224,11 @@ stralloc rcptto = {0};
void smtp_helo(arg) char *arg;
{
+ smtp_greet("250 "); out("\r\n");
+ seenmail = 0; dohelo(arg);
+}
+void smtp_ehlo(arg) char *arg;
+{
smtp_greet("250-"); out("\r\n250-PIPELINING\r\n250 8BITMIME\r\n");
seenmail = 0; dohelo(arg);
}
@@ -393,7 +400,7 @@ struct commands smtpcommands[] = {
, { "data", smtp_data, flush }
, { "quit", smtp_quit, flush }
, { "helo", smtp_helo, flush }
-, { "ehlo", smtp_helo, flush }
+, { "ehlo", smtp_ehlo, flush }
, { "rset", smtp_rset, 0 }
, { "help", smtp_help, flush }
, { "noop", err_noop, flush }
diff --git a/qmail.7 b/qmail.7
@@ -14,7 +14,8 @@ file include
.BR qbiff (1),
.BR qreceipt (1),
.BR forward (1),
-and (for advanced users)
+.BR bouncesaying (1),
+and
.BR condredirect (1).
Other helpful commands include
.BR maildirmake (1),
@@ -55,7 +56,7 @@ and
.BR qmail-pop3d (8).
This documentation describes version
-1.02
+1.03
of
.BR qmail .
See