summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorschmonz <schmonz@pkgsrc.org>2004-07-21 22:35:59 +0000
committerschmonz <schmonz@pkgsrc.org>2004-07-21 22:35:59 +0000
commitf863c03b03bae83242a19a86aa3a723b50a2118a (patch)
tree0e219997176ed712b58bc7fd80787bceed459d09 /mail
parentea313d384305ff6a3326e66a0a7f71c2a6343329 (diff)
downloadpkgsrc-f863c03b03bae83242a19a86aa3a723b50a2118a.tar.gz
Short story:
1) Mostly conform to hier(7) and honor PKG_SYSCONFDIR. 2) Follow more closely Dave Sill's "Life with qmail" (LWQ). 3) Add a bunch of features to the rc.d scripts. 4) Remove some (but not all) obstacles to binary packaging. 5) Introduce QMAIL_AUTOCONFIG, QMAIL_QUEUE_DIR, and QMAIL_QUEUE_EXTRA. 6) Enable pkgviews installation. 7) Bump PKGREVISION. Long story: 1) Mostly conform to hier(7) and honor PKG_SYSCONFDIR. Based on a January 1997 post by mrg to the qmail list: prior to installation, we create symlinks in ${QMAILDIR} that point into ${LOCALBASE} or ${PKG_SYSCONFDIR}, causing installation to place files in those locations while allowing the canonical /var/qmail paths to continue to work. The notable deviation from hier(7) is that even though some binaries ought to go in sbin, they've all been lumped into bin for simplicity. Pleasant effects: * We no longer need to set LOCALBASE (a big no-no), and as a result also no longer need to set NO_MTREE, RCD_SCRIPTS_EXAMPLEDIR, or EVAL_PREFIX. This will also allow a few qmail-related packages to do likewise. * The commands and manual pages are in easily accessible paths by default. * Package installation and deinstallation work much better. Side effects: * There were a few minor conflicts with mail/courier-maildirmake, mail/mutt, and mail/pulsar. The latest versions of each are fine, so we add CONFLICTS only for older versions. (Thanks to those packages' maintainers!) There's also a conflict with security/mirrordir, which has a "bin/forward" command and corresponding section 1 man page. * Some directories under ${PREFIX} get chown'd to group qmail. Rather than modify the qmail installer, the affected directories are simply chown'd back afterward during post-install if PKG_INSTALLATION_TYPE is "overwrite". (If it's "pkgviews", then only the package's depot directory is affected, so we leave it alone.) 2) Follow more closely Dave Sill's "Life with qmail" (LWQ). Similarities: * Installs into /var/qmail from source. * Installs ucspi-tcp and daemontools. * Uses tcpserver(1). * Uses tcp.smtp.cdb for relay access control. * Uses control/defaultdelivery. * Uses control/concurrencyincoming. * Requires that control/rcpthosts exist to prevent open relays. * Uses similar chains of commands in run scripts. * Provides a script much like qmailctl. Differences: * This package does the following work for you automatically: * Creates user accounts. * Fetches, extracts, patches, configures, and compiles the source. * Installs binaries. * Runs ./config-fast. * Creates tcp.smtp{,cdb} and tcp.pop3d{,cdb}. * Creates control/concurrencyincoming. * Creates control/defaultdelivery (defaulting to "./Mailbox"). * Creates the three required system aliases. * LWQ suggests doing some things this package doesn't do: * Applying patches. * Copying a script from /var/qmail/boot to /var/qmail/rc. * Configuring svscan(8) to run at boot. * Creating and populating /service. * Using supervise(8) and multilog(8). * Using the qmailctl script to control qmail. * Using the inst_check script to verify the installation. * Storing tcp.smtp{,cdb} in /etc. * Renaming the system sendmail(8) and marking it non-executable. * Instead, this package: * Builds from unmodified source. (See also mail/netqmail.) * Uses NetBSD-style rc.d scripts (including one similar to qmailctl). * Sends log messages to syslog(3). * Stores tcp.smtp{,cdb} and tcp.pop3{,cdb} in ${PKG_SYSCONFDIR}. * Provides an example mailer.conf(5). 3) Add a bunch of features to the rc.d scripts. Rename the qmail script and rcvar to qmailsend. Add "doqueue" (synonyms: alrm, flush) and "queue" commands, add "hup" as a synonym for "reload", and determine default delivery instruction from control/defaultdelivery (LWQ). Add control/defaultdelivery to required_files. Rename qmailsend_flags to qmailsend_defaultdelivery, which overrides control/defaultdelivery if set. In the qmailpop3d and qmailsmtpd scripts, enforce resource limits with softlimit(8) (LWQ). Add dependency on sysutils/daemontools for this. Rename qmailfoo_flags to qmailfoo_tcpflags. Add qmailfoo_tcphost (default: 0, meaning "any address") and qmailfoo_tcpport (default: 110 and 25, respectively). Add qmailfoo_softlimit (default: 2000000). Add qmailfoo_pretcpserver and qmailfoo_prefoo (default: empty), useful for inserting commands such as rblsmtpd(1) or relay-ctrl into the chain. Log to splogger's default syslog facility ("mail"), and use the name of the script as the tag. In the qmailpop3d, qmailsend, and qmailsmtpd scripts, add qmailfoo_postenv (defaults: empty, PATH=${PREFIX}/bin:$PATH, and QMAILQUEUE=${PREFIX}/bin/qmail-queue, respectively), useful primarily for setting environment variables for each service. Add "pause" and "cont" commands (LWQ). They send -STOP and -CONT signals, respectively. Add "stat" as a synonym for "status" (LWQ). In the qmailpop3d script, add -x to qmailpop3d_tcpflags and add "cdb" command. Add qmailpop3d_checkpassword (useful for authenticating against alternate user databases) and qmailpop3d_maildirname (useful if your maildirs are named something other than "Maildir"). Add tcp.pop3.cdb to required_files. In the qmailsmtpd script, add -x and remove -H from qmailsmtpd_tcpflags, limit the number of incoming connections to control/concurrencyincoming, and add "cdb" command (LWQ). Add control/concurrencyincoming and tcp.smtp.cdb to required_files. Add qmailqread script and ${PREFIX}/bin/qmail-qread-client, based on Steinar Haug's example on www.qmail.org. If enabled, this allows local non-root users to see the queue. Add qmail script (structure copied from net/samba/files/samba.sh). Its interface is very similar to LWQ's qmailctl: it provides the commands "start stop restart rcvar pause cont stat status cdb doqueue reload queue alrm flush hup help". These commands can be run either directly from the appropriate service-specific script(s), or from this qmail script (which will call the right script(s) for you). 4) Remove some (but not all) obstacles to binary packaging. Each of these is better explained elsewhere. Summary: * Installs into the normal ${LOCALBASE}. * /var/qmail paths still work. * No patches are applied. (See also mail/netqmail.) 5) Introduce QMAIL_AUTOCONFIG, QMAIL_QUEUE_DIR, and QMAIL_QUEUE_EXTRA. QMAIL_AUTOCONFIG (default: YES): whether to automatically create basic config files. QMAIL_QUEUE_DIR (default: ${VARBASE}/spool/qmail): the path to the queue. QMAIL_QUEUE_EXTRA (default: empty): an additional recipient that will be added to every delivery. This is used primarily for logging. If this is set to a non-empty value, the necessary dot-qmail(5) file is created automatically at install time. 6) Enable pkgviews installation. 7) Bump PKGREVISION. Other user-visible changes: This package no longer applies patches to qmail. mail/netqmail, to be imported shortly, does. Restrictions on the redistribution of modified qmail apply not only to binaries but also to source. Clarify this in RESTRICTED. Add "newaliases", "hoststat", and "purgestat" entries to the sample mailer.conf. Install it to ${PREFIX}/share/examples/${PKGBASE}, as other pkgsrc mailers do. ("newaliases" is actually provided by the fastforward package, and isn't needed unless you're using it.) Explain how to enable qmail in MESSAGE (cribbed from the postfix package). Thanks to zuntum, snj, salo, and jlam for ideas, discussion, and review.
Diffstat (limited to 'mail')
-rw-r--r--mail/qmail/DEINSTALL26
-rw-r--r--mail/qmail/INSTALL100
-rw-r--r--mail/qmail/MESSAGE25
-rw-r--r--mail/qmail/Makefile57
-rw-r--r--mail/qmail/Makefile.common112
-rw-r--r--mail/qmail/PLIST390
-rw-r--r--mail/qmail/distinfo19
-rw-r--r--mail/qmail/files/mailer.conf11
-rw-r--r--mail/qmail/files/qmail-qread-client.sh7
-rw-r--r--mail/qmail/files/qmail.sh102
-rw-r--r--mail/qmail/files/qmailpop3d.sh63
-rw-r--r--mail/qmail/files/qmailqread.sh28
-rw-r--r--mail/qmail/files/qmailsend.sh90
-rw-r--r--mail/qmail/files/qmailsmtpd.sh64
-rw-r--r--mail/qmail/patches/patch-aa37
-rw-r--r--mail/qmail/patches/patch-ab32
-rw-r--r--mail/qmail/patches/patch-ac74
-rw-r--r--mail/qmail/patches/patch-ad11
-rw-r--r--mail/qmail/patches/patch-ae9
-rw-r--r--mail/qmail/patches/patch-af15
-rw-r--r--mail/qmail/patches/patch-ag13
-rw-r--r--mail/qmail/patches/patch-ah16
-rw-r--r--mail/qmail/patches/patch-ai13
-rw-r--r--mail/qmail/patches/patch-aj16
-rw-r--r--mail/qmail/patches/patch-ak103
-rw-r--r--mail/qmail/patches/patch-al27
-rw-r--r--mail/qmail/patches/patch-am17
-rw-r--r--mail/qmail/patches/patch-an113
-rw-r--r--mail/qmail/patches/patch-ao22
-rw-r--r--mail/qmail/patches/patch-ap51
-rw-r--r--mail/qmail/patches/patch-aq12
31 files changed, 777 insertions, 898 deletions
diff --git a/mail/qmail/DEINSTALL b/mail/qmail/DEINSTALL
index 0b34804ac93..60ec34c9034 100644
--- a/mail/qmail/DEINSTALL
+++ b/mail/qmail/DEINSTALL
@@ -1,11 +1,25 @@
-# $NetBSD: DEINSTALL,v 1.3 2002/01/28 17:56:19 zuntum Exp $
+# $NetBSD: DEINSTALL,v 1.4 2004/07/21 22:35:59 schmonz Exp $
+
+QMAILDIR=@QMAILDIR@
+
+VAR_QMAIL_DIRS="alias bin boot control doc man queue users"
case "${STAGE}" in
+
POST-DEINSTALL)
- ${ECHO} ===========================================================================
- ${ECHO}
- ${ECHO} You may remove qmail-users package now, as it is no longer needed.
- ${ECHO}
- ${ECHO} ===========================================================================
+
+ for dir in $VAR_QMAIL_DIRS; do
+ if [ -h ${QMAILDIR}/$dir ]; then
+ ${RM} -f ${QMAILDIR}/$dir
+ fi
+ done
+
+ ${CAT} <<EOF
+===========================================================================
+
+You may remove the qmail-users package now, as it is no longer needed.
+
+===========================================================================
+EOF
;;
esac
diff --git a/mail/qmail/INSTALL b/mail/qmail/INSTALL
new file mode 100644
index 00000000000..a5589944d84
--- /dev/null
+++ b/mail/qmail/INSTALL
@@ -0,0 +1,100 @@
+# $NetBSD: INSTALL,v 1.1 2004/07/21 22:35:59 schmonz Exp $
+
+DOCDIR=@DOCDIR@
+EGDIR=@EGDIR@
+SHAREDIR=@SHAREDIR@
+QMAILDIR=@QMAILDIR@
+QMAIL_AUTOCONFIG=@QMAIL_AUTOCONFIG@
+QMAIL_QUEUE_DIR=@QMAIL_QUEUE_DIR@
+QMAIL_QUEUE_EXTRA=@QMAIL_QUEUE_EXTRA@
+
+VAR_QMAIL_DIRS="alias bin boot control doc man queue users"
+
+case ${STAGE} in
+
+PRE-INSTALL)
+ for dir in $VAR_QMAIL_DIRS; do
+ if [ -e ${QMAILDIR}/$dir ]; then
+ ${CAT} <<EOF
+===========================================================================
+
+ERROR: ${QMAILDIR} exists and is non-empty.
+
+Please remove or rename it, then try again.
+
+===========================================================================
+EOF
+ exit 1
+ fi
+ done
+
+ if ${ECHO} ${QMAIL_QUEUE_DIR} | ${GREP} -q "^${QMAILDIR}/"; then
+ ${CAT} <<EOF
+===========================================================================
+
+ERROR: QMAIL_QUEUE_DIR must not be under ${QMAILDIR}.
+
+Please adjust your definition of QMAIL_QUEUE_DIR, then try again.
+
+===========================================================================
+EOF
+ exit 1
+ fi
+
+ ${LN} -s ${PKG_SYSCONFDIR}/alias ${QMAILDIR}/alias
+ ${LN} -s ${PREFIX}/bin ${QMAILDIR}/bin
+ ${LN} -s ${EGDIR}/boot ${QMAILDIR}/boot
+ ${LN} -s ${PKG_SYSCONFDIR}/control ${QMAILDIR}/control
+ ${LN} -s ${DOCDIR} ${QMAILDIR}/doc
+ ${LN} -s ${PREFIX}/man ${QMAILDIR}/man
+ ${LN} -s ${QMAIL_QUEUE_DIR} ${QMAILDIR}/queue
+ ${LN} -s ${PKG_SYSCONFDIR}/users ${QMAILDIR}/users
+
+ ;;
+
+POST-INSTALL)
+ if [ "${QMAIL_AUTOCONFIG}" = YES ]; then
+
+ cd ${SHAREDIR}/setup && ./config-fast `./hostname`
+
+ cd ${PKG_SYSCONFDIR}/alias && ${TOUCH} .qmail-postmaster .qmail-mailer-daemon .qmail-root
+
+ if ! [ -s ${PKG_SYSCONFDIR}/control/concurrencyincoming ]; then
+ ${ECHO} 20 > ${PKG_SYSCONFDIR}/control/concurrencyincoming
+ ${CHMOD} 644 ${PKG_SYSCONFDIR}/control/concurrencyincoming
+ fi
+
+ if ! [ -s ${PKG_SYSCONFDIR}/control/defaultdelivery ]; then
+ ${ECHO} ./Mailbox > ${PKG_SYSCONFDIR}/control/defaultdelivery
+ ${CHMOD} 644 ${PKG_SYSCONFDIR}/control/defaultdelivery
+ fi
+
+ pop3rule=':allow'
+ smtprule='127.:allow,RELAYCLIENT=""'
+ for i in pop3 smtp; do
+ if ! [ -s ${PKG_SYSCONFDIR}/tcp.${i} ]; then
+ eval ${ECHO} \"\$${i}rule\" > ${PKG_SYSCONFDIR}/tcp.${i}
+ fi
+ ${CHMOD} 644 ${PKG_SYSCONFDIR}/tcp.${i}
+ ${LOCALBASE}/bin/tcprules ${PKG_SYSCONFDIR}/tcp.${i}.cdb ${PKG_SYSCONFDIR}/tcp.${i}.tmp < ${PKG_SYSCONFDIR}/tcp.${i}
+ ${CHMOD} 644 ${PKG_SYSCONFDIR}/tcp.${i}.cdb
+ done
+
+ if ! [ -z ${QMAIL_QUEUE_EXTRA} ]; then
+ ${ECHO} '#' >> ${PKG_SYSCONFDIR}/alias/.qmail-${QMAIL_QUEUE_EXTRA}
+ ${CHMOD} 644 ${PKG_SYSCONFDIR}/alias/.qmail-${QMAIL_QUEUE_EXTRA}
+ fi
+
+ else
+ ${CAT} <<EOF
+===========================================================================
+
+You may need to create some config files manually.
+
+===========================================================================
+EOF
+ fi
+
+ ;;
+
+esac
diff --git a/mail/qmail/MESSAGE b/mail/qmail/MESSAGE
index 13047d06601..97457900b7a 100644
--- a/mail/qmail/MESSAGE
+++ b/mail/qmail/MESSAGE
@@ -1,12 +1,23 @@
===========================================================================
-$NetBSD: MESSAGE,v 1.7 2004/04/24 05:29:36 schmonz Exp $
+$NetBSD: MESSAGE,v 1.8 2004/07/21 22:35:59 schmonz Exp $
- To be able to view manpages either add "${QMAILDIR}/man/" to the
- _default line in /etc/man.conf or specify this directory in
- MANPATH variable in your environment.
+To activate ${PKGBASE} for local and outgoing deliveries:
+- Check the configuration files in ${PKG_SYSCONFDIR}.
+- Modify /etc/mailer.conf (see ${EGDIR}/mailer.conf).
+- Set qmailsend=YES in /etc/rc.conf.
- To start qmail at startup, set qmail=YES in /etc/rc.conf.
- To start qmail-pop3d at startup, set qmailpop3d=YES in /etc/rc.conf.
- To start qmail-smtpd at startup, set qmailsmtpd=YES in /etc/rc.conf.
+To enable SMTP:
+- Set qmailsmtpd=YES in /etc/rc.conf.
+
+To enable POP3 (only for Maildirs):
+- Set qmailpop3d=YES in /etc/rc.conf.
+
+To allow local non-root users to see the queue:
+- Set qmailqread=YES in /etc/rc.conf.
+- Change the mailq entry in /etc/mailer.conf to qmail-qread-client.
+
+Alternatively, you can manage the qmail daemons with daemontools
+by creating appropriate run scripts in /service. There are many
+ways to do this; you may find the qmail-conf package helpful.
===========================================================================
diff --git a/mail/qmail/Makefile b/mail/qmail/Makefile
index a96f1b52241..ea0ee7e31b0 100644
--- a/mail/qmail/Makefile
+++ b/mail/qmail/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.23 2004/04/24 05:29:36 schmonz Exp $
+# $NetBSD: Makefile,v 1.24 2004/07/21 22:35:59 schmonz Exp $
#
DISTNAME= qmail-1.03
-PKGREVISION= 6
+PKGREVISION= 7
CATEGORIES= mail
MASTER_SITES= http://cr.yp.to/software/ \
ftp://ftp.ntnu.no/pub/unix/mail/qmail/ \
@@ -10,55 +10,18 @@ MASTER_SITES= http://cr.yp.to/software/ \
ftp://ftp.net.ohio-state.edu/pub/networking/mail/qmail/
MAINTAINER= schmonz@NetBSD.org
-HOMEPAGE= http://www.qmail.org/
-COMMENT= Secure, reliable, efficient, simple, and fast MTA for UNIX systems
+HOMEPAGE= http://cr.yp.to/qmail.html
+COMMENT= Secure, reliable, efficient, simple, and fast MTA
-DEPENDS+= checkpassword-[0-9]*:../../sysutils/checkpassword
-DEPENDS+= qmail-users>=1.0:../../mail/qmail-users
-DEPENDS+= ucspi-tcp-[0-9]*:../../net/ucspi-tcp
+CONFLICTS+= netqmail-[0-9]*
USE_BUILDLINK3= yes
-ALL_TARGET= it man
-INSTALL_TARGET= setup check
+RESTRICTED= "modified source and binaries may not be distributed"
+NO_BIN_ON_CDROM=${RESTRICTED}
+NO_BIN_ON_FTP= ${RESTRICTED}
+NO_PACKAGE= "needs work to function properly as a binary package"
-RESTRICTED= "djb does not permit modified binary packages"
-NO_BIN_ON_CDROM= ${RESTRICTED}
-NO_BIN_ON_FTP= ${RESTRICTED}
-
-NO_PACKAGE= "needs work to function properly as a binary package"
-
-USE_PKGINSTALL= yes
-DEINSTALL_EXTRA_TMPL+= ${.CURDIR}/DEINSTALL
-OWN_DIRS+= ${QMAILDIR}
-
-EVAL_PREFIX+= LOCALBASE_NORMAL=ucspi-tcp
-
-FILES_SUBST+= QMAILDIR=${QMAILDIR}
-FILES_SUBST+= LOCALBASE_NORMAL=${LOCALBASE_NORMAL}
-RCD_SCRIPTS= qmail qmailsmtpd qmailpop3d
-RCD_SCRIPTS_EXAMPLEDIR= ${QMAILDIR}/etc/rc.d
-
-.include "../../mk/bsd.prefs.mk"
-
-NO_MTREE= YES
-LOCALBASE= /
-
-do-configure:
- ${ECHO} ${CC} ${CFLAGS} > ${WRKSRC}/conf-cc
- ${ECHO} ${CC} ${_STRIPFLAG_CC} > ${WRKSRC}/conf-ld
- ${ECHO} ${QMAILDIR} > ${WRKSRC}/conf-qmail
-
-pre-install:
- @${SED} ${FILES_SUBST_SED} ${FILESDIR}/mailer.conf \
- > ${WRKDIR}/mailer.conf.qmail
-
-post-install:
- ${INSTALL_DATA_DIR} ${QMAILDIR}/etc
- ${INSTALL_DATA} ${WRKDIR}/mailer.conf.qmail ${QMAILDIR}/etc
-
- ${INSTALL_DATA_DIR} ${QMAILDIR}/alias
- cd ${QMAILDIR}/alias && \
- ${TOUCH} .qmail-postmaster .qmail-mailer-daemon .qmail-root
+.include "../../mail/qmail/Makefile.common"
.include "../../mk/bsd.pkg.mk"
diff --git a/mail/qmail/Makefile.common b/mail/qmail/Makefile.common
new file mode 100644
index 00000000000..6ee459be2a6
--- /dev/null
+++ b/mail/qmail/Makefile.common
@@ -0,0 +1,112 @@
+# $NetBSD: Makefile.common,v 1.1 2004/07/21 22:35:59 schmonz Exp $
+#
+
+DEPENDS+= checkpassword-[0-9]*:../../sysutils/checkpassword
+DEPENDS+= daemontools-[0-9]*:../../sysutils/daemontools
+DEPENDS+= qmail-users>=1.0:../../mail/qmail-users
+DEPENDS+= ucspi-tcp-[0-9]*:../../net/ucspi-tcp
+
+CONFLICTS+= courier-maildirmake-[0-9]*
+CONFLICTS+= mirrordir-[0-9]*
+CONFLICTS+= mutt<=1.4.2.1nb1
+CONFLICTS+= pulsar<=0.1.1
+
+PKG_INSTALLATION_TYPES= overwrite pkgviews
+
+ALL_TARGET= it man
+INSTALL_TARGET= setup check
+
+FILESDIR= ${.CURDIR}/../../mail/qmail/files
+MESSAGE_SRC= ${.CURDIR}/../../mail/qmail/MESSAGE
+PLIST_SRC= ${.CURDIR}/../../mail/qmail/PLIST
+
+USE_PKGINSTALL= yes
+DEINSTALL_EXTRA_TMPL+= ${.CURDIR}/../../mail/qmail/DEINSTALL
+INSTALL_EXTRA_TMPL+= ${.CURDIR}/../../mail/qmail/INSTALL
+MAKE_DIRS+= ${PKG_SYSCONFDIR} ${PKG_SYSCONFDIR}/alias ${EGDIR}/boot
+MAKE_DIRS+= ${PKG_SYSCONFDIR}/control ${DOCDIR}
+MAKE_DIRS+= ${PKG_SYSCONFDIR}/users
+OWN_DIRS+= ${QMAILDIR} ${QMAIL_QUEUE_DIR}
+RCD_SCRIPTS= qmail qmailqread qmailpop3d qmailsend qmailsmtpd
+PKG_SYSCONFSUBDIR= qmail
+
+DOCDIR= ${PREFIX}/share/doc/qmail
+EGDIR= ${PREFIX}/share/examples/qmail
+SHAREDIR= ${PREFIX}/share/qmail
+MESSAGE_SUBST+= EGDIR=${EGDIR}
+MESSAGE_SUBST+= PKGBASE=${PKGBASE}
+FILES_SUBST+= DOCDIR=${DOCDIR}
+FILES_SUBST+= EGDIR=${EGDIR}
+FILES_SUBST+= SHAREDIR=${SHAREDIR}
+FILES_SUBST+= QMAILDIR=${QMAILDIR}
+FILES_SUBST+= QMAIL_AUTOCONFIG=${QMAIL_AUTOCONFIG}
+FILES_SUBST+= QMAIL_QUEUE_DIR=${QMAIL_QUEUE_DIR}
+FILES_SUBST+= QMAIL_QUEUE_EXTRA=${QMAIL_QUEUE_EXTRA}
+
+SETUP_PROGRAMS= dnsfq dnsip dnsptr hostname install ipmeprint
+SETUP_SCRIPTS= config config-fast
+
+MANDIRS= man
+.for i in cat man
+. for j in 1 5 7 8
+MANDIRS+= man/${i}${j}
+. endfor
+.endfor
+INSTALLATION_DIRS= bin ${MANDIRS}
+INSTALLATION_DIRS+= share/doc/qmail share/examples/qmail share/qmail
+
+.include "../../mk/bsd.prefs.mk"
+
+BUILD_DEFS+= QMAILDIR QMAIL_AUTOCONFIG
+BUILD_DEFS+= QMAIL_QUEUE_DIR QMAIL_QUEUE_EXTRA
+
+.if !empty(QMAIL_QUEUE_DIR:M${QMAILDIR}/*)
+PKG_FAIL_REASON+= "QMAIL_QUEUE_DIR must not be under ${QMAILDIR}"
+.endif
+
+.if !empty(QMAIL_QUEUE_EXTRA)
+QUEUE_EXTRA= "T${QMAIL_QUEUE_EXTRA}\\0"
+QUEUE_EXTRALEN!= ${EXPR} `${ECHO} ${QUEUE_EXTRA} | ${WC} -c` - 2
+SUBST_CLASSES+= logging
+SUBST_STAGE.logging= do-configure
+SUBST_FILES.logging= extra.h
+SUBST_SED.logging= -e 's|0|${QUEUE_EXTRALEN}|g'
+SUBST_SED.logging+= -e 's|""|${QUEUE_EXTRA}|g'
+.endif
+
+do-configure:
+ ${ECHO} ${CC} ${CFLAGS} > ${WRKSRC}/conf-cc
+ ${ECHO} ${CC} ${_STRIPFLAG_CC} > ${WRKSRC}/conf-ld
+ ${ECHO} ${QMAILDIR} > ${WRKSRC}/conf-qmail
+
+post-build:
+ @${SED} ${FILES_SUBST_SED} ${FILESDIR}/mailer.conf \
+ > ${WRKDIR}/mailer.conf.qmail
+ @${SED} ${FILES_SUBST_SED} ${FILESDIR}/qmail-qread-client.sh \
+ > ${WRKDIR}/qmail-qread-client
+
+post-install:
+ # qmail's installer sets strange permissions; set them back
+. if (${PKG_INSTALLATION_TYPE} == "overwrite")
+. for i in bin boot
+ ${CHGRP} ${BINGRP} ${QMAILDIR}/${i}
+. endfor
+. for i in doc
+ ${CHGRP} ${SHAREGRP} ${QMAILDIR}/${i}
+. endfor
+. for i in ${MANDIRS}
+ ${CHGRP} ${MANGRP} ${QMAILDIR}/${i}
+. endfor
+. endif
+
+ ${INSTALL_DATA} ${WRKDIR}/mailer.conf.qmail ${EGDIR}/mailer.conf
+ ${INSTALL_SCRIPT} ${WRKDIR}/qmail-qread-client ${PREFIX}/bin
+
+ ${INSTALL_DATA_DIR} ${SHAREDIR}
+ ${INSTALL_PROGRAM_DIR} ${SHAREDIR}/setup
+ for i in ${SETUP_PROGRAMS}; do \
+ ${INSTALL_PROGRAM} ${WRKSRC}/$$i ${SHAREDIR}/setup; \
+ done
+ for i in ${SETUP_SCRIPTS}; do \
+ ${INSTALL_SCRIPT} ${WRKSRC}/$$i ${SHAREDIR}/setup; \
+ done
diff --git a/mail/qmail/PLIST b/mail/qmail/PLIST
index 650c1385791..9950bf9c062 100644
--- a/mail/qmail/PLIST
+++ b/mail/qmail/PLIST
@@ -1,195 +1,195 @@
-@comment $NetBSD: PLIST,v 1.6 2004/04/24 00:54:42 schmonz Exp $
-${QMAILDIR}/etc/mailer.conf.qmail
-${QMAILDIR}/bin/bouncesaying
-${QMAILDIR}/bin/condredirect
-${QMAILDIR}/bin/datemail
-${QMAILDIR}/bin/elq
-${QMAILDIR}/bin/except
-${QMAILDIR}/bin/forward
-${QMAILDIR}/bin/maildir2mbox
-${QMAILDIR}/bin/maildirmake
-${QMAILDIR}/bin/maildirwatch
-${QMAILDIR}/bin/mailsubj
-${QMAILDIR}/bin/pinq
-${QMAILDIR}/bin/predate
-${QMAILDIR}/bin/preline
-${QMAILDIR}/bin/qail
-${QMAILDIR}/bin/qbiff
-${QMAILDIR}/bin/qmail-clean
-${QMAILDIR}/bin/qmail-getpw
-${QMAILDIR}/bin/qmail-inject
-${QMAILDIR}/bin/qmail-local
-${QMAILDIR}/bin/qmail-lspawn
-${QMAILDIR}/bin/qmail-newmrh
-${QMAILDIR}/bin/qmail-newu
-${QMAILDIR}/bin/qmail-pop3d
-${QMAILDIR}/bin/qmail-popup
-${QMAILDIR}/bin/qmail-pw2u
-${QMAILDIR}/bin/qmail-qmqpc
-${QMAILDIR}/bin/qmail-qmqpd
-${QMAILDIR}/bin/qmail-qmtpd
-${QMAILDIR}/bin/qmail-qread
-${QMAILDIR}/bin/qmail-qstat
-${QMAILDIR}/bin/qmail-queue
-${QMAILDIR}/bin/qmail-remote
-${QMAILDIR}/bin/qmail-rspawn
-${QMAILDIR}/bin/qmail-send
-${QMAILDIR}/bin/qmail-showctl
-${QMAILDIR}/bin/qmail-smtpd
-${QMAILDIR}/bin/qmail-start
-${QMAILDIR}/bin/qmail-tcpok
-${QMAILDIR}/bin/qmail-tcpto
-${QMAILDIR}/bin/qreceipt
-${QMAILDIR}/bin/qsmhook
-${QMAILDIR}/bin/sendmail
-${QMAILDIR}/bin/splogger
-${QMAILDIR}/bin/tcp-env
-${QMAILDIR}/boot/binm1
-${QMAILDIR}/boot/binm1+df
-${QMAILDIR}/boot/binm2
-${QMAILDIR}/boot/binm2+df
-${QMAILDIR}/boot/binm3
-${QMAILDIR}/boot/binm3+df
-${QMAILDIR}/boot/home
-${QMAILDIR}/boot/home+df
-${QMAILDIR}/boot/proc
-${QMAILDIR}/boot/proc+df
-${QMAILDIR}/doc/FAQ
-${QMAILDIR}/doc/INSTALL
-${QMAILDIR}/doc/INSTALL.alias
-${QMAILDIR}/doc/INSTALL.ctl
-${QMAILDIR}/doc/INSTALL.ids
-${QMAILDIR}/doc/INSTALL.maildir
-${QMAILDIR}/doc/INSTALL.mbox
-${QMAILDIR}/doc/INSTALL.vsm
-${QMAILDIR}/doc/PIC.local2alias
-${QMAILDIR}/doc/PIC.local2ext
-${QMAILDIR}/doc/PIC.local2local
-${QMAILDIR}/doc/PIC.local2rem
-${QMAILDIR}/doc/PIC.local2virt
-${QMAILDIR}/doc/PIC.nullclient
-${QMAILDIR}/doc/PIC.relaybad
-${QMAILDIR}/doc/PIC.relaygood
-${QMAILDIR}/doc/PIC.rem2local
-${QMAILDIR}/doc/REMOVE.binmail
-${QMAILDIR}/doc/REMOVE.sendmail
-${QMAILDIR}/doc/SENDMAIL
-${QMAILDIR}/doc/TEST.deliver
-${QMAILDIR}/doc/TEST.receive
-${QMAILDIR}/doc/UPGRADE
-${QMAILDIR}/man/cat1/bouncesaying.0
-${QMAILDIR}/man/cat1/condredirect.0
-${QMAILDIR}/man/cat1/except.0
-${QMAILDIR}/man/cat1/forward.0
-${QMAILDIR}/man/cat1/maildir2mbox.0
-${QMAILDIR}/man/cat1/maildirmake.0
-${QMAILDIR}/man/cat1/maildirwatch.0
-${QMAILDIR}/man/cat1/mailsubj.0
-${QMAILDIR}/man/cat1/preline.0
-${QMAILDIR}/man/cat1/qbiff.0
-${QMAILDIR}/man/cat1/qreceipt.0
-${QMAILDIR}/man/cat1/tcp-env.0
-${QMAILDIR}/man/cat5/addresses.0
-${QMAILDIR}/man/cat5/dot-qmail.0
-${QMAILDIR}/man/cat5/envelopes.0
-${QMAILDIR}/man/cat5/maildir.0
-${QMAILDIR}/man/cat5/mbox.0
-${QMAILDIR}/man/cat5/qmail-control.0
-${QMAILDIR}/man/cat5/qmail-header.0
-${QMAILDIR}/man/cat5/qmail-log.0
-${QMAILDIR}/man/cat5/qmail-users.0
-${QMAILDIR}/man/cat5/tcp-environ.0
-${QMAILDIR}/man/cat7/forgeries.0
-${QMAILDIR}/man/cat7/qmail-limits.0
-${QMAILDIR}/man/cat7/qmail.0
-${QMAILDIR}/man/cat8/qmail-clean.0
-${QMAILDIR}/man/cat8/qmail-command.0
-${QMAILDIR}/man/cat8/qmail-getpw.0
-${QMAILDIR}/man/cat8/qmail-inject.0
-${QMAILDIR}/man/cat8/qmail-local.0
-${QMAILDIR}/man/cat8/qmail-lspawn.0
-${QMAILDIR}/man/cat8/qmail-newmrh.0
-${QMAILDIR}/man/cat8/qmail-newu.0
-${QMAILDIR}/man/cat8/qmail-pop3d.0
-${QMAILDIR}/man/cat8/qmail-popup.0
-${QMAILDIR}/man/cat8/qmail-pw2u.0
-${QMAILDIR}/man/cat8/qmail-qmqpc.0
-${QMAILDIR}/man/cat8/qmail-qmqpd.0
-${QMAILDIR}/man/cat8/qmail-qmtpd.0
-${QMAILDIR}/man/cat8/qmail-qread.0
-${QMAILDIR}/man/cat8/qmail-qstat.0
-${QMAILDIR}/man/cat8/qmail-queue.0
-${QMAILDIR}/man/cat8/qmail-remote.0
-${QMAILDIR}/man/cat8/qmail-rspawn.0
-${QMAILDIR}/man/cat8/qmail-send.0
-${QMAILDIR}/man/cat8/qmail-showctl.0
-${QMAILDIR}/man/cat8/qmail-smtpd.0
-${QMAILDIR}/man/cat8/qmail-start.0
-${QMAILDIR}/man/cat8/qmail-tcpok.0
-${QMAILDIR}/man/cat8/qmail-tcpto.0
-${QMAILDIR}/man/cat8/splogger.0
-${QMAILDIR}/man/man1/bouncesaying.1
-${QMAILDIR}/man/man1/condredirect.1
-${QMAILDIR}/man/man1/except.1
-${QMAILDIR}/man/man1/forward.1
-${QMAILDIR}/man/man1/maildir2mbox.1
-${QMAILDIR}/man/man1/maildirmake.1
-${QMAILDIR}/man/man1/maildirwatch.1
-${QMAILDIR}/man/man1/mailsubj.1
-${QMAILDIR}/man/man1/preline.1
-${QMAILDIR}/man/man1/qbiff.1
-${QMAILDIR}/man/man1/qreceipt.1
-${QMAILDIR}/man/man1/tcp-env.1
-${QMAILDIR}/man/man5/addresses.5
-${QMAILDIR}/man/man5/dot-qmail.5
-${QMAILDIR}/man/man5/envelopes.5
-${QMAILDIR}/man/man5/maildir.5
-${QMAILDIR}/man/man5/mbox.5
-${QMAILDIR}/man/man5/qmail-control.5
-${QMAILDIR}/man/man5/qmail-header.5
-${QMAILDIR}/man/man5/qmail-log.5
-${QMAILDIR}/man/man5/qmail-users.5
-${QMAILDIR}/man/man5/tcp-environ.5
-${QMAILDIR}/man/man7/forgeries.7
-${QMAILDIR}/man/man7/qmail-limits.7
-${QMAILDIR}/man/man7/qmail.7
-${QMAILDIR}/man/man8/qmail-clean.8
-${QMAILDIR}/man/man8/qmail-command.8
-${QMAILDIR}/man/man8/qmail-getpw.8
-${QMAILDIR}/man/man8/qmail-inject.8
-${QMAILDIR}/man/man8/qmail-local.8
-${QMAILDIR}/man/man8/qmail-lspawn.8
-${QMAILDIR}/man/man8/qmail-newmrh.8
-${QMAILDIR}/man/man8/qmail-newu.8
-${QMAILDIR}/man/man8/qmail-pop3d.8
-${QMAILDIR}/man/man8/qmail-popup.8
-${QMAILDIR}/man/man8/qmail-pw2u.8
-${QMAILDIR}/man/man8/qmail-qmqpc.8
-${QMAILDIR}/man/man8/qmail-qmqpd.8
-${QMAILDIR}/man/man8/qmail-qmtpd.8
-${QMAILDIR}/man/man8/qmail-qread.8
-${QMAILDIR}/man/man8/qmail-qstat.8
-${QMAILDIR}/man/man8/qmail-queue.8
-${QMAILDIR}/man/man8/qmail-remote.8
-${QMAILDIR}/man/man8/qmail-rspawn.8
-${QMAILDIR}/man/man8/qmail-send.8
-${QMAILDIR}/man/man8/qmail-showctl.8
-${QMAILDIR}/man/man8/qmail-smtpd.8
-${QMAILDIR}/man/man8/qmail-start.8
-${QMAILDIR}/man/man8/qmail-tcpok.8
-${QMAILDIR}/man/man8/qmail-tcpto.8
-${QMAILDIR}/man/man8/splogger.8
-@dirrm ${QMAILDIR}/man/man8
-@dirrm ${QMAILDIR}/man/man7
-@dirrm ${QMAILDIR}/man/man5
-@dirrm ${QMAILDIR}/man/man1
-@dirrm ${QMAILDIR}/man/cat8
-@dirrm ${QMAILDIR}/man/cat7
-@dirrm ${QMAILDIR}/man/cat5
-@dirrm ${QMAILDIR}/man/cat1
-@dirrm ${QMAILDIR}/man
-@dirrm ${QMAILDIR}/etc/rc.d
-@dirrm ${QMAILDIR}/etc
-@dirrm ${QMAILDIR}/doc
-@dirrm ${QMAILDIR}/boot
-@dirrm ${QMAILDIR}/bin
+@comment $NetBSD: PLIST,v 1.7 2004/07/21 22:35:59 schmonz Exp $
+bin/bouncesaying
+bin/condredirect
+bin/datemail
+bin/elq
+bin/except
+bin/forward
+bin/maildir2mbox
+bin/maildirmake
+bin/maildirwatch
+bin/mailsubj
+bin/pinq
+bin/predate
+bin/preline
+bin/qail
+bin/qbiff
+bin/qmail-clean
+bin/qmail-getpw
+bin/qmail-inject
+bin/qmail-local
+bin/qmail-lspawn
+bin/qmail-newmrh
+bin/qmail-newu
+bin/qmail-pop3d
+bin/qmail-popup
+bin/qmail-pw2u
+bin/qmail-qmqpc
+bin/qmail-qmqpd
+bin/qmail-qmtpd
+bin/qmail-qread
+bin/qmail-qread-client
+bin/qmail-qstat
+bin/qmail-queue
+bin/qmail-remote
+bin/qmail-rspawn
+bin/qmail-send
+bin/qmail-showctl
+bin/qmail-smtpd
+bin/qmail-start
+bin/qmail-tcpok
+bin/qmail-tcpto
+bin/qreceipt
+bin/qsmhook
+bin/sendmail
+bin/splogger
+bin/tcp-env
+man/cat1/bouncesaying.0
+man/cat1/condredirect.0
+man/cat1/except.0
+man/cat1/forward.0
+man/cat1/maildir2mbox.0
+man/cat1/maildirmake.0
+man/cat1/maildirwatch.0
+man/cat1/mailsubj.0
+man/cat1/preline.0
+man/cat1/qbiff.0
+man/cat1/qreceipt.0
+man/cat1/tcp-env.0
+man/cat5/addresses.0
+man/cat5/dot-qmail.0
+man/cat5/envelopes.0
+man/cat5/maildir.0
+man/cat5/mbox.0
+man/cat5/qmail-control.0
+man/cat5/qmail-header.0
+man/cat5/qmail-log.0
+man/cat5/qmail-users.0
+man/cat5/tcp-environ.0
+man/cat7/forgeries.0
+man/cat7/qmail-limits.0
+man/cat7/qmail.0
+man/cat8/qmail-clean.0
+man/cat8/qmail-command.0
+man/cat8/qmail-getpw.0
+man/cat8/qmail-inject.0
+man/cat8/qmail-local.0
+man/cat8/qmail-lspawn.0
+man/cat8/qmail-newmrh.0
+man/cat8/qmail-newu.0
+man/cat8/qmail-pop3d.0
+man/cat8/qmail-popup.0
+man/cat8/qmail-pw2u.0
+man/cat8/qmail-qmqpc.0
+man/cat8/qmail-qmqpd.0
+man/cat8/qmail-qmtpd.0
+man/cat8/qmail-qread.0
+man/cat8/qmail-qstat.0
+man/cat8/qmail-queue.0
+man/cat8/qmail-remote.0
+man/cat8/qmail-rspawn.0
+man/cat8/qmail-send.0
+man/cat8/qmail-showctl.0
+man/cat8/qmail-smtpd.0
+man/cat8/qmail-start.0
+man/cat8/qmail-tcpok.0
+man/cat8/qmail-tcpto.0
+man/cat8/splogger.0
+man/man1/bouncesaying.1
+man/man1/condredirect.1
+man/man1/except.1
+man/man1/forward.1
+man/man1/maildir2mbox.1
+man/man1/maildirmake.1
+man/man1/maildirwatch.1
+man/man1/mailsubj.1
+man/man1/preline.1
+man/man1/qbiff.1
+man/man1/qreceipt.1
+man/man1/tcp-env.1
+man/man5/addresses.5
+man/man5/dot-qmail.5
+man/man5/envelopes.5
+man/man5/maildir.5
+man/man5/mbox.5
+man/man5/qmail-control.5
+man/man5/qmail-header.5
+man/man5/qmail-log.5
+man/man5/qmail-users.5
+man/man5/tcp-environ.5
+man/man7/forgeries.7
+man/man7/qmail-limits.7
+man/man7/qmail.7
+man/man8/qmail-clean.8
+man/man8/qmail-command.8
+man/man8/qmail-getpw.8
+man/man8/qmail-inject.8
+man/man8/qmail-local.8
+man/man8/qmail-lspawn.8
+man/man8/qmail-newmrh.8
+man/man8/qmail-newu.8
+man/man8/qmail-pop3d.8
+man/man8/qmail-popup.8
+man/man8/qmail-pw2u.8
+man/man8/qmail-qmqpc.8
+man/man8/qmail-qmqpd.8
+man/man8/qmail-qmtpd.8
+man/man8/qmail-qread.8
+man/man8/qmail-qstat.8
+man/man8/qmail-queue.8
+man/man8/qmail-remote.8
+man/man8/qmail-rspawn.8
+man/man8/qmail-send.8
+man/man8/qmail-showctl.8
+man/man8/qmail-smtpd.8
+man/man8/qmail-start.8
+man/man8/qmail-tcpok.8
+man/man8/qmail-tcpto.8
+man/man8/splogger.8
+share/doc/qmail/FAQ
+share/doc/qmail/INSTALL
+share/doc/qmail/INSTALL.alias
+share/doc/qmail/INSTALL.ctl
+share/doc/qmail/INSTALL.ids
+share/doc/qmail/INSTALL.maildir
+share/doc/qmail/INSTALL.mbox
+share/doc/qmail/INSTALL.vsm
+share/doc/qmail/PIC.local2alias
+share/doc/qmail/PIC.local2ext
+share/doc/qmail/PIC.local2local
+share/doc/qmail/PIC.local2rem
+share/doc/qmail/PIC.local2virt
+share/doc/qmail/PIC.nullclient
+share/doc/qmail/PIC.relaybad
+share/doc/qmail/PIC.relaygood
+share/doc/qmail/PIC.rem2local
+share/doc/qmail/REMOVE.binmail
+share/doc/qmail/REMOVE.sendmail
+share/doc/qmail/SENDMAIL
+share/doc/qmail/TEST.deliver
+share/doc/qmail/TEST.receive
+share/doc/qmail/UPGRADE
+share/examples/qmail/boot/binm1
+share/examples/qmail/boot/binm1+df
+share/examples/qmail/boot/binm2
+share/examples/qmail/boot/binm2+df
+share/examples/qmail/boot/binm3
+share/examples/qmail/boot/binm3+df
+share/examples/qmail/boot/home
+share/examples/qmail/boot/home+df
+share/examples/qmail/boot/proc
+share/examples/qmail/boot/proc+df
+share/examples/qmail/mailer.conf
+share/qmail/setup/config
+share/qmail/setup/config-fast
+share/qmail/setup/dnsfq
+share/qmail/setup/dnsip
+share/qmail/setup/dnsptr
+share/qmail/setup/hostname
+share/qmail/setup/install
+share/qmail/setup/ipmeprint
+@dirrm share/qmail/setup
+@dirrm share/qmail
+@dirrm share/examples/qmail/boot
+@dirrm share/examples/qmail
+@dirrm share/doc/qmail
diff --git a/mail/qmail/distinfo b/mail/qmail/distinfo
index e90b3e7aae3..7d8dd48e675 100644
--- a/mail/qmail/distinfo
+++ b/mail/qmail/distinfo
@@ -1,21 +1,4 @@
-$NetBSD: distinfo,v 1.5 2004/04/24 05:29:36 schmonz Exp $
+$NetBSD: distinfo,v 1.6 2004/07/21 22:35:59 schmonz Exp $
SHA1 (qmail-1.03.tar.gz) = 18fb960481291a0503e93a94df3f6094edb7f27a
Size (qmail-1.03.tar.gz) = 220668 bytes
-SHA1 (patch-aa) = d876fb59c6e1e93d0332696c1ebf06e04a8fafb2
-SHA1 (patch-ab) = 47f788fd28feca2442bbb9094d99633a1578e447
-SHA1 (patch-ac) = e05c2c1c4066a2fd1b6c3763c6fe73d541994014
-SHA1 (patch-ad) = eacd740cf85abbb385b241cf4f33f7b80a03ce4b
-SHA1 (patch-ae) = 56311eb87ee8325ba347c6cdbfd8b5484c7142e0
-SHA1 (patch-af) = 582ce985dde5df7eb507e2abe90c62b6d73485e2
-SHA1 (patch-ag) = bfd2ae4613add0ab9b4c2672466600abf9de38ae
-SHA1 (patch-ah) = 48d9c4f5a47372dd13c380edf50ceeb209d61ea3
-SHA1 (patch-ai) = 67ac4722837e5dd6136d4fbe900ef80eda74ea95
-SHA1 (patch-aj) = a1691a04a90f3969ac8853e7d04833603195880e
-SHA1 (patch-ak) = d1e88006f04874df6c1896b08bbdfb4e5d67f654
-SHA1 (patch-al) = 20a8bb4d44477522135762219c4aaeebddfd6085
-SHA1 (patch-am) = fd1d09686dcdbb58b7a45c114aa56d0b1360035b
-SHA1 (patch-an) = 352fefafcf726fa9b5ae69822519d4c976032da2
-SHA1 (patch-ao) = 63176ba524913c6e693de7460d25016a10a438f8
-SHA1 (patch-ap) = de2d4d409c5e588e1cf9c6ca2cd966eeef022a55
-SHA1 (patch-aq) = 2e5f0a4870b13ff60f79edf5dc58eff783fd5bea
diff --git a/mail/qmail/files/mailer.conf b/mail/qmail/files/mailer.conf
index 0ce56a4ecbb..c918d862c6b 100644
--- a/mail/qmail/files/mailer.conf
+++ b/mail/qmail/files/mailer.conf
@@ -1,7 +1,10 @@
-# $NetBSD: mailer.conf,v 1.2 2004/03/29 05:10:04 snj Exp $
+# $NetBSD: mailer.conf,v 1.3 2004/07/21 22:35:59 schmonz Exp $
#
# Use "qmail" as replacement for "sendmail".
#
-sendmail @QMAILDIR@/bin/sendmail
-send-mail @QMAILDIR@/bin/sendmail
-mailq @QMAILDIR@/bin/qmail-qread
+sendmail @PREFIX@/bin/sendmail
+send-mail @PREFIX@/bin/sendmail
+mailq @PREFIX@/bin/qmail-qread
+newaliases @PREFIX@/bin/newaliases
+hoststat @PREFIX@/bin/qmail-tcpto
+purgestat @PREFIX@/bin/qmail-tcpok
diff --git a/mail/qmail/files/qmail-qread-client.sh b/mail/qmail/files/qmail-qread-client.sh
new file mode 100644
index 00000000000..1a175d07787
--- /dev/null
+++ b/mail/qmail/files/qmail-qread-client.sh
@@ -0,0 +1,7 @@
+#!@SH@
+#
+# Client program to allow local non-root users to see the queue.
+# Requires that the corresponding server program be running. From
+# Steinar Haug.
+
+exec @LOCALBASE@/bin/tcpclient -RHl0 -- 127.0.0.1 20025 @SH@ -c 'exec @CAT@ <&6'
diff --git a/mail/qmail/files/qmail.sh b/mail/qmail/files/qmail.sh
index 0b10892ede1..a7c8bead012 100644
--- a/mail/qmail/files/qmail.sh
+++ b/mail/qmail/files/qmail.sh
@@ -1,32 +1,90 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: qmail.sh,v 1.4 2004/04/27 03:05:09 schmonz Exp $
+# $NetBSD: qmail.sh,v 1.5 2004/07/21 22:35:59 schmonz Exp $
+#
+# Master script for administrators to control qmail services.
+# Usage resembles the qmailctl script from "Life with qmail".
#
-# PROVIDE: mail qmail
-# REQUIRE: LOGIN
-
-. /etc/rc.subr
+# KEYWORD: nostart
-name="qmail"
-rcvar=${name}
-required_files="@QMAILDIR@/control/me"
-command="@QMAILDIR@/bin/qmail-send"
-start_precmd="qmail_precmd"
-extra_commands="reload"
-
-if [ -z "$qmail_flags" ]; then
- qmail_flags="./Mailbox"
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
fi
-qmail_precmd()
+rcd_dir=`@DIRNAME@ $0`
+
+# NOTE: run_rc_command sets $rc_arg
+#
+forward_commands()
+{
+ # Backward compat with NetBSD <1.6:
+ [ -z "$rc_arg" ] && rc_arg=$_arg
+
+ for file in $COMMAND_LIST; do
+ $rcd_dir/$file $rc_arg
+ done
+}
+
+reverse_commands()
+{
+ # Backward compat with NetBSD <1.6:
+ [ -z "$rc_arg" ] && rc_arg=$_arg
+
+ REVCOMMAND_LIST=
+ for file in $COMMAND_LIST; do
+ REVCOMMAND_LIST="$file $REVCOMMAND_LIST"
+ done
+ for file in $REVCOMMAND_LIST; do
+ $rcd_dir/$file $rc_arg
+ done
+}
+
+qmailrcd()
+{
+ for service in $@; do
+ $rcd_dir/qmail${service} $rc_arg
+ done
+}
+
+qmail_help()
{
- # qmail-start(8) starts the various qmail processes, then exits.
- # qmail-send(8) is the process we want to signal later.
- command="@SETENV@ - PATH=@QMAILDIR@/bin:$PATH qmail-start '$qmail_flags' splogger qmail"
- command_args="&"
- rc_flags=""
+ @CAT@ <<HELP
+ stop -- stops mail service (smtp connections refused, nothing goes out)
+ start -- starts mail service (smtp connection accepted, mail can go out)
+ pause -- temporarily stops mail service (connections accepted, nothing leaves)
+ cont -- continues paused mail service
+ stat -- displays status of mail service
+ cdb -- rebuild the tcpserver cdb file for smtp and/or pop3
+restart -- stops and restarts smtp, sends qmail-send a TERM & restarts it
+doqueue -- schedules queued messages for immediate delivery
+ reload -- sends qmail-send HUP, rereading locals and virtualdomains
+ queue -- shows status of queue
+ alrm -- same as doqueue
+ flush -- same as doqueue
+ hup -- same as reload
+HELP
}
-load_rc_config $name
-run_rc_command "$1"
+COMMAND_LIST="qmailsend qmailsmtpd qmailpop3d"
+
+name="qmail"
+start_cmd="forward_commands"
+stop_cmd="reverse_commands"
+doqueue_cmd="qmailrcd send"; alrm_cmd=${doqueue_cmd}; flush_cmd=${doqueue_cmd}
+reload_cmd="qmailrcd send"; hup_cmd=${reload_cmd}
+status_cmd="forward_commands"; stat_cmd=${status_cmd}
+pause_cmd="forward_commands"
+cont_cmd="forward_commands"
+cdb_cmd="qmailrcd smtpd pop3d"
+queue_cmd="qmailrcd send"
+help_cmd="qmail_help"
+extra_commands="pause cont stat status cdb doqueue reload queue alrm flush hup help"
+
+if [ -f /etc/rc.subr ]; then
+ run_rc_command "$1"
+else
+ @ECHO@ -n " ${name}"
+ _arg="$1"
+ ${start_cmd}
+fi
diff --git a/mail/qmail/files/qmailpop3d.sh b/mail/qmail/files/qmailpop3d.sh
index ec016ca4e6c..47f226a46fa 100644
--- a/mail/qmail/files/qmailpop3d.sh
+++ b/mail/qmail/files/qmailpop3d.sh
@@ -1,33 +1,78 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: qmailpop3d.sh,v 1.2 2004/04/27 03:05:09 schmonz Exp $
+# $NetBSD: qmailpop3d.sh,v 1.3 2004/07/21 22:35:59 schmonz Exp $
+#
+# Script to control qmail-pop3d (POP3 server for Maildirs).
#
-# PROVIDE: mail
-# REQUIRE: qmail
+# PROVIDE: qmailpop3d mail
. /etc/rc.subr
name="qmailpop3d"
rcvar=${name}
-required_files="@QMAILDIR@/control/me"
-command="@LOCALBASE_NORMAL@/bin/tcpserver"
+required_files="@PKG_SYSCONFDIR@/control/me"
+required_files="${required_files} @PKG_SYSCONFDIR@/tcp.pop3.cdb"
+command="@LOCALBASE@/bin/tcpserver"
procname=${name}
start_precmd="qmailpop3d_precmd"
+extra_commands="stat pause cont cdb"
+stat_cmd="qmailpop3d_stat"
+pause_cmd="qmailpop3d_pause"
+cont_cmd="qmailpop3d_cont"
+cdb_cmd="qmailpop3d_cdb"
-if [ -z "$qmailpop3d_flags" ]; then
- qmailpop3d_flags="-v -H -R -l 0"
-fi
+# User-settable rc.conf variables and their default values:
+qmailpop3d_postenv=${qmailpop3d_postenv-""}
+qmailpop3d_tcpflags=${qmailpop3d_tcpflags-"-v -R -H -l 0"}
+qmailpop3d_tcphost=${qmailpop3d_tcphost-"0"}
+qmailpop3d_tcpport=${qmailpop3d_tcpport-"110"}
+qmailpop3d_softlimit=${qmailpop3d_softlimit-"2000000"}
+qmailpop3d_pretcpserver=${qmailpop3d_pretcpserver-""}
+qmailpop3d_prepop3d=${qmailpop3d_prepop3d-""}
+qmailpop3d_checkpassword=${qmailpop3d_checkpassword-"@LOCALBASE@/bin/checkpassword"}
+qmailpop3d_maildirname=${qmailpop3d_maildirname-"Maildir"}
qmailpop3d_precmd()
{
# tcpserver(1) is akin to inetd(8), but runs one service per process.
# We want to signal only the tcpserver process responsible for POP
# service. Use argv0(1) to set procname to "qmailpop3d".
- command="@SETENV@ - @LOCALBASE_NORMAL@/bin/argv0 @LOCALBASE_NORMAL@/bin/tcpserver $name $qmailpop3d_flags 0 110 @QMAILDIR@/bin/qmail-popup `@CAT@ @QMAILDIR@/control/me` @LOCALBASE_NORMAL@/bin/checkpassword @QMAILDIR@/bin/qmail-pop3d Maildir 2>&1 | @QMAILDIR@/bin/splogger pop3d 3"
+ command="@SETENV@ - ${qmailpop3d_postenv} @LOCALBASE@/bin/softlimit -m ${qmailpop3d_softlimit} ${qmailpop3d_pretcpserver} @LOCALBASE@/bin/argv0 @LOCALBASE@/bin/tcpserver ${name} ${qmailpop3d_tcpflags} -x @PKG_SYSCONFDIR@/tcp.pop3.cdb ${qmailpop3d_tcphost} ${qmailpop3d_tcpport} @PREFIX@/bin/qmail-popup `@CAT@ @PKG_SYSCONFDIR@/control/me` ${qmailpop3d_checkpassword} ${qmailpop3d_prepop3d} @PREFIX@/bin/qmail-pop3d ${qmailpop3d_maildirname} 2>&1 | @PREFIX@/bin/splogger ${name}"
command_args="&"
rc_flags=""
}
+qmailpop3d_stat()
+{
+ run_rc_command status
+}
+
+qmailpop3d_pause()
+{
+ if ! statusmsg=`run_rc_command status`; then
+ @ECHO@ $statusmsg
+ return 1
+ fi
+ @ECHO@ "Pausing ${name}."
+ kill -STOP $rc_pid
+}
+
+qmailpop3d_cont()
+{
+ if ! statusmsg=`run_rc_command status`; then
+ @ECHO@ $statusmsg
+ return 1
+ fi
+ @ECHO@ "Continuing ${name}."
+ kill -CONT $rc_pid
+}
+
+qmailpop3d_cdb()
+{
+ echo "Reloading @PKG_SYSCONFDIR@/tcp.pop3."
+ @LOCALBASE@/bin/tcprules @PKG_SYSCONFDIR@/tcp.pop3.cdb @PKG_SYSCONFDIR@/tcp.pop3.tmp < @PKG_SYSCONFDIR@/tcp.pop3
+ @CHMOD@ 644 @PKG_SYSCONFDIR@/tcp.pop3.cdb
+}
load_rc_config $name
run_rc_command "$1"
diff --git a/mail/qmail/files/qmailqread.sh b/mail/qmail/files/qmailqread.sh
new file mode 100644
index 00000000000..28dbb522788
--- /dev/null
+++ b/mail/qmail/files/qmailqread.sh
@@ -0,0 +1,28 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: qmailqread.sh,v 1.1 2004/07/21 22:35:59 schmonz Exp $
+#
+# Script to control a service providing local non-root users access
+# to see the queue. Adapted from a script by Steinar Haug.
+#
+
+# PROVIDE: qmailqread mail
+# REQUIRE: qmailsend
+
+. /etc/rc.subr
+
+name="qmailqread"
+rcvar=${name}
+command="@LOCALBASE@/bin/tcpserver"
+procname=${name}
+start_precmd="qmailqread_precmd"
+
+qmailqread_precmd()
+{
+ command="@SETENV@ - @LOCALBASE@/bin/argv0 @LOCALBASE@/bin/tcpserver ${name} -R -1 -u `@ID@ -u qmails` -g `@ID@ -g qmails` 127.0.0.1 20025 @PREFIX@/bin/qmail-qread 2>&1 | @PREFIX@/bin/splogger ${name}"
+ command_args="&"
+ rc_flags=""
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mail/qmail/files/qmailsend.sh b/mail/qmail/files/qmailsend.sh
new file mode 100644
index 00000000000..6966e0f5afa
--- /dev/null
+++ b/mail/qmail/files/qmailsend.sh
@@ -0,0 +1,90 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: qmailsend.sh,v 1.1 2004/07/21 22:35:59 schmonz Exp $
+#
+# Script to control qmail-send (local and outgoing mail).
+#
+
+# PROVIDE: qmailsend mail
+# REQUIRE: LOGIN
+
+. /etc/rc.subr
+
+name="qmailsend"
+rcvar=${name}
+required_files="@PKG_SYSCONFDIR@/control/defaultdelivery"
+required_files="${required_files} @PKG_SYSCONFDIR@/control/me"
+command="@PREFIX@/bin/qmail-send"
+start_precmd="qmailsend_precmd"
+extra_commands="stat pause cont doqueue reload queue alrm flush hup"
+stat_cmd="qmailsend_stat"
+pause_cmd="qmailsend_pause"
+cont_cmd="qmailsend_cont"
+doqueue_cmd="qmailsend_doqueue"
+queue_cmd="qmailsend_queue"
+alrm_cmd="qmailsend_doqueue"
+flush_cmd="qmailsend_doqueue"
+hup_cmd="qmailsend_hup"
+
+# User-settable rc.conf variables and their default values:
+qmailsend_postenv=${qmailsend_postenv-"PATH=@PREFIX@/bin:$PATH"}
+qmailsend_defaultdelivery=${qmailsend_defaultdelivery-"`cat @PKG_SYSCONFDIR@/control/defaultdelivery`"}
+
+qmailsend_precmd()
+{
+ # qmail-start(8) starts the various qmail processes, then exits.
+ # qmail-send(8) is the process we want to signal later.
+ command="@SETENV@ - ${qmailsend_postenv} qmail-start '$qmailsend_defaultdelivery' splogger ${name}"
+ command_args="&"
+ rc_flags=""
+}
+
+qmailsend_stat()
+{
+ run_rc_command status
+}
+
+qmailsend_pause()
+{
+ if ! statusmsg=`run_rc_command status`; then
+ @ECHO@ $statusmsg
+ return 1
+ fi
+ @ECHO@ "Pausing ${name}."
+ kill -STOP $rc_pid
+}
+
+qmailsend_cont()
+{
+ if ! statusmsg=`run_rc_command status`; then
+ @ECHO@ $statusmsg
+ return 1
+ fi
+ @ECHO@ "Continuing ${name}."
+ kill -CONT $rc_pid
+}
+
+qmailsend_doqueue()
+{
+ if ! statusmsg=`run_rc_command status`; then
+ @ECHO@ $statusmsg
+ return 1
+ fi
+ @ECHO@ "Flushing timeout table and sending ALRM signal to qmail-send."
+ @PREFIX@/bin/qmail-tcpok
+ kill -ALRM $rc_pid
+}
+
+qmailsend_queue()
+{
+ @PREFIX@/bin/qmail-qstat
+ @PREFIX@/bin/qmail-qread
+}
+
+qmailsend_hup()
+{
+ run_rc_command reload
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mail/qmail/files/qmailsmtpd.sh b/mail/qmail/files/qmailsmtpd.sh
index ddb26ba94ad..37b412882bd 100644
--- a/mail/qmail/files/qmailsmtpd.sh
+++ b/mail/qmail/files/qmailsmtpd.sh
@@ -1,33 +1,79 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: qmailsmtpd.sh,v 1.3 2004/04/27 03:05:09 schmonz Exp $
+# $NetBSD: qmailsmtpd.sh,v 1.4 2004/07/21 22:35:59 schmonz Exp $
+#
+# Script to control qmail-smtpd (SMTP service).
#
-# PROVIDE: mail
-# REQUIRE: qmail
+# PROVIDE: qmailsmtpd mail
+# REQUIRE: qmailsend
. /etc/rc.subr
name="qmailsmtpd"
rcvar=${name}
-required_files="@QMAILDIR@/control/rcpthosts"
-command="@LOCALBASE_NORMAL@/bin/tcpserver"
+required_files="@PKG_SYSCONFDIR@/control/concurrencyincoming"
+required_files="${required_files} @PKG_SYSCONFDIR@/tcp.smtp.cdb"
+required_files="${required_files} @PKG_SYSCONFDIR@/control/rcpthosts"
+command="@LOCALBASE@/bin/tcpserver"
procname=${name}
start_precmd="qmailsmtpd_precmd"
+extra_commands="stat pause cont cdb"
+stat_cmd="qmailsmtpd_stat"
+pause_cmd="qmailsmtpd_pause"
+cont_cmd="qmailsmtpd_cont"
+cdb_cmd="qmailsmtpd_cdb"
-if [ -z "$qmailsmtpd_flags" ]; then
- qmailsmtpd_flags="-v -H -R -l 0"
-fi
+# User-settable rc.conf variables and their default values:
+qmailsmtpd_postenv=${qmailsmtpd_postenv-"QMAILQUEUE=@PREFIX@/bin/qmail-queue"}
+qmailsmtpd_tcpflags=${qmailsmtpd_tcpflags-"-v -R -l 0"}
+qmailsmtpd_tcphost=${qmailsmtpd_tcphost-"0"}
+qmailsmtpd_tcpport=${qmailsmtpd_tcpport-"25"}
+qmailsmtpd_softlimit=${qmailsmtpd_softlimit-"2000000"}
+qmailsmtpd_pretcpserver=${qmailsmtpd_pretcpserver-""}
+qmailsmtpd_presmtpd=${qmailsmtpd_presmtpd-""}
qmailsmtpd_precmd()
{
# tcpserver(1) is akin to inetd(8), but runs one service per process.
# We want to signal only the tcpserver process responsible for SMTP
# service. Use argv0(1) to set procname to "qmailsmtpd".
- command="@SETENV@ - @LOCALBASE_NORMAL@/bin/argv0 @LOCALBASE_NORMAL@/bin/tcpserver $name $qmailsmtpd_flags -u `@ID@ -u qmaild` -g `@ID@ -g qmaild` 0 25 @QMAILDIR@/bin/qmail-smtpd 2>&1 | @QMAILDIR@/bin/splogger smtpd 3"
+ command="@SETENV@ - ${qmailsmtpd_postenv} @LOCALBASE@/bin/softlimit -m ${qmailsmtpd_softlimit} ${qmailsmtpd_pretcpserver} @LOCALBASE@/bin/argv0 @LOCALBASE@/bin/tcpserver ${name} ${qmailsmtpd_tcpflags} -x @PKG_SYSCONFDIR@/tcp.smtp.cdb -c `@CAT@ @PKG_SYSCONFDIR@/control/concurrencyincoming` -u `@ID@ -u qmaild` -g `@ID@ -g qmaild` ${qmailsmtpd_tcphost} ${qmailsmtpd_tcpport} ${qmailsmtpd_presmtpd} @PREFIX@/bin/qmail-smtpd 2>&1 | @PREFIX@/bin/splogger ${name}"
command_args="&"
rc_flags=""
}
+qmailsmtpd_stat()
+{
+ run_rc_command status
+}
+
+qmailsmtpd_pause()
+{
+ if ! statusmsg=`run_rc_command status`; then
+ @ECHO@ $statusmsg
+ return 1
+ fi
+ @ECHO@ "Pausing ${name}."
+ kill -STOP $rc_pid
+}
+
+qmailsmtpd_cont()
+{
+ if ! statusmsg=`run_rc_command status`; then
+ @ECHO@ $statusmsg
+ return 1
+ fi
+ @ECHO@ "Continuing ${name}."
+ kill -CONT $rc_pid
+}
+
+qmailsmtpd_cdb()
+{
+ echo "Reloading @PKG_SYSCONFDIR@/tcp.smtp."
+ @LOCALBASE@/bin/tcprules @PKG_SYSCONFDIR@/tcp.smtp.cdb @PKG_SYSCONFDIR@/tcp.smtp.tmp < @PKG_SYSCONFDIR@/tcp.smtp
+ @CHMOD@ 644 @PKG_SYSCONFDIR@/tcp.smtp.cdb
+}
+
load_rc_config $name
run_rc_command "$1"
diff --git a/mail/qmail/patches/patch-aa b/mail/qmail/patches/patch-aa
deleted file mode 100644
index 8415513de1f..00000000000
--- a/mail/qmail/patches/patch-aa
+++ /dev/null
@@ -1,37 +0,0 @@
-$NetBSD: patch-aa,v 1.2 2004/04/10 05:30:06 schmonz Exp $
-
---- Makefile.orig 1998-06-15 06:53:16.000000000 -0400
-+++ Makefile
-@@ -263,7 +263,7 @@ makelib cdbmake_pack.o cdbmake_hash.o cd
- cdbmake_add.o
-
- cdbmake_add.o: \
--compile cdbmake_add.c cdbmake.h uint32.h
-+compile cdbmake_add.c cdbmake.h alloc.h uint32.h
- ./compile cdbmake_add.c
-
- cdbmake_hash.o: \
-@@ -1483,12 +1483,12 @@ load qmail-send.o qsutil.o control.o con
- trigger.o fmtqfn.o quote.o now.o readsubdir.o qmail.o date822fmt.o \
- datetime.a case.a ndelay.a getln.a wait.a seek.a fd.a sig.a open.a \
- lock.a stralloc.a alloc.a substdio.a error.a str.a fs.a auto_qmail.o \
--auto_split.o
-+auto_split.o env.a
- ./load qmail-send qsutil.o control.o constmap.o newfield.o \
- prioq.o trigger.o fmtqfn.o quote.o now.o readsubdir.o \
- qmail.o date822fmt.o datetime.a case.a ndelay.a getln.a \
- wait.a seek.a fd.a sig.a open.a lock.a stralloc.a alloc.a \
-- substdio.a error.a str.a fs.a auto_qmail.o auto_split.o
-+ substdio.a error.a str.a fs.a auto_qmail.o auto_split.o env.a
-
- qmail-send.0: \
- qmail-send.8
-@@ -1892,7 +1892,7 @@ trylsock.c compile load
-
- spawn.o: \
- compile chkspawn spawn.c sig.h wait.h substdio.h byte.h str.h \
--stralloc.h gen_alloc.h select.h exit.h coe.h open.h error.h \
-+stralloc.h gen_alloc.h select.h exit.h alloc.h coe.h open.h error.h \
- auto_qmail.h auto_uids.h auto_spawn.h
- ./chkspawn
- ./compile spawn.c
diff --git a/mail/qmail/patches/patch-ab b/mail/qmail/patches/patch-ab
deleted file mode 100644
index 6a46485025e..00000000000
--- a/mail/qmail/patches/patch-ab
+++ /dev/null
@@ -1,32 +0,0 @@
-$NetBSD: patch-ab,v 1.2 2004/04/10 05:30:06 schmonz Exp $
-
---- qmail.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ qmail.c
-@@ -6,8 +6,17 @@
- #include "fd.h"
- #include "qmail.h"
- #include "auto_qmail.h"
-+#include "env.h"
-
--static char *binqqargs[2] = { "bin/qmail-queue", 0 } ;
-+static char *binqqargs[2] = { 0, 0 } ;
-+
-+static void setup_qqargs()
-+{
-+ if(!binqqargs[0])
-+ binqqargs[0] = env_get("QMAILQUEUE");
-+ if(!binqqargs[0])
-+ binqqargs[0] = "bin/qmail-queue";
-+}
-
- int qmail_open(qq)
- struct qmail *qq;
-@@ -15,6 +24,8 @@ struct qmail *qq;
- int pim[2];
- int pie[2];
-
-+ setup_qqargs();
-+
- if (pipe(pim) == -1) return -1;
- if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }
-
diff --git a/mail/qmail/patches/patch-ac b/mail/qmail/patches/patch-ac
deleted file mode 100644
index b548ebe3ddd..00000000000
--- a/mail/qmail/patches/patch-ac
+++ /dev/null
@@ -1,74 +0,0 @@
-$NetBSD: patch-ac,v 1.2 2004/04/10 05:30:06 schmonz Exp $
-
---- dns.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ dns.c
-@@ -7,8 +7,6 @@
- #include <errno.h>
- extern int res_query();
- extern int res_search();
--extern int errno;
--extern int h_errno;
- #include "ip.h"
- #include "ipalloc.h"
- #include "fmt.h"
-@@ -21,10 +19,12 @@ extern int h_errno;
- static unsigned short getshort(c) unsigned char *c;
- { unsigned short u; u = c[0]; return (u << 8) + c[1]; }
-
--static union { HEADER hdr; unsigned char buf[PACKETSZ]; } response;
-+static struct { unsigned char *buf; } response;
-+static int responsebuflen = 0;
- static int responselen;
- static unsigned char *responseend;
- static unsigned char *responsepos;
-+static u_long saveresoptions;
-
- static int numanswers;
- static char name[MAXDNAME];
-@@ -45,18 +45,33 @@ int type;
- errno = 0;
- if (!stralloc_copy(&glue,domain)) return DNS_MEM;
- if (!stralloc_0(&glue)) return DNS_MEM;
-- responselen = lookup(glue.s,C_IN,type,response.buf,sizeof(response));
-+ if (!responsebuflen)
-+ if (response.buf = (unsigned char *)alloc(PACKETSZ+1))
-+ responsebuflen = PACKETSZ+1;
-+ else return DNS_MEM;
-+
-+ responselen = lookup(glue.s,C_IN,type,response.buf,responsebuflen);
-+ if ((responselen >= responsebuflen) ||
-+ (responselen > 0 && (((HEADER *)response.buf)->tc)))
-+ {
-+ if (responsebuflen < 65536)
-+ if (alloc_re(&response.buf, responsebuflen, 65536))
-+ responsebuflen = 65536;
-+ else return DNS_MEM;
-+ saveresoptions = _res.options;
-+ _res.options |= RES_USEVC;
-+ responselen = lookup(glue.s,C_IN,type,response.buf,responsebuflen);
-+ _res.options = saveresoptions;
-+ }
- if (responselen <= 0)
- {
- if (errno == ECONNREFUSED) return DNS_SOFT;
- if (h_errno == TRY_AGAIN) return DNS_SOFT;
- return DNS_HARD;
- }
-- if (responselen >= sizeof(response))
-- responselen = sizeof(response);
- responseend = response.buf + responselen;
- responsepos = response.buf + sizeof(HEADER);
-- n = ntohs(response.hdr.qdcount);
-+ n = ntohs(((HEADER *)response.buf)->qdcount);
- while (n-- > 0)
- {
- i = dn_expand(response.buf,responseend,responsepos,name,MAXDNAME);
-@@ -66,7 +81,7 @@ int type;
- if (i < QFIXEDSZ) return DNS_SOFT;
- responsepos += QFIXEDSZ;
- }
-- numanswers = ntohs(response.hdr.ancount);
-+ numanswers = ntohs(((HEADER *)response.buf)->ancount);
- return 0;
- }
-
diff --git a/mail/qmail/patches/patch-ad b/mail/qmail/patches/patch-ad
deleted file mode 100644
index 802665bda1c..00000000000
--- a/mail/qmail/patches/patch-ad
+++ /dev/null
@@ -1,11 +0,0 @@
-$NetBSD: patch-ad,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- cdb_seek.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ cdb_seek.c
-@@ -1,6 +1,5 @@
- #include <sys/types.h>
- #include <errno.h>
--extern int errno;
- #include "cdb.h"
-
- #ifndef SEEK_SET
diff --git a/mail/qmail/patches/patch-ae b/mail/qmail/patches/patch-ae
deleted file mode 100644
index aedb6dc669d..00000000000
--- a/mail/qmail/patches/patch-ae
+++ /dev/null
@@ -1,9 +0,0 @@
-$NetBSD: patch-ae,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- cdbmake_add.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ cdbmake_add.c
-@@ -1,3 +1,4 @@
-+#include "alloc.h"
- #include "cdbmake.h"
-
- void cdbmake_init(cdbm)
diff --git a/mail/qmail/patches/patch-af b/mail/qmail/patches/patch-af
deleted file mode 100644
index d459b90d2c5..00000000000
--- a/mail/qmail/patches/patch-af
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-af,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- error.3.orig 1998-06-15 06:53:16.000000000 -0400
-+++ error.3
-@@ -3,8 +3,8 @@
- error \- syscall error codes
- .SH SYNTAX
- .B #include <error.h>
--
--extern int \fBerrno\fP;
-+.br
-+.B #include <errno.h>
-
- extern int \fBerror_intr\fP;
- .br
diff --git a/mail/qmail/patches/patch-ag b/mail/qmail/patches/patch-ag
deleted file mode 100644
index b6137736520..00000000000
--- a/mail/qmail/patches/patch-ag
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-ag,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- error.h.orig 1998-06-15 06:53:16.000000000 -0400
-+++ error.h
-@@ -1,7 +1,7 @@
- #ifndef ERROR_H
- #define ERROR_H
-
--extern int errno;
-+#include <errno.h>
-
- extern int error_intr;
- extern int error_nomem;
diff --git a/mail/qmail/patches/patch-ah b/mail/qmail/patches/patch-ah
deleted file mode 100644
index f9f5a8d6ba3..00000000000
--- a/mail/qmail/patches/patch-ah
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-ah,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- ipme.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ ipme.c
-@@ -46,6 +46,11 @@ int ipme_init()
- ipme.len = 0;
- ix.pref = 0;
-
-+ /* 0.0.0.0 is a special address which always refers to
-+ * "this host, this network", according to RFC 1122, Sec. 3.2.1.3a.
-+ */
-+ byte_copy(&ix.ip,4,"\0\0\0\0");
-+ if (!ipalloc_append(&ipme,&ix)) { return 0; }
- if ((s = socket(AF_INET,SOCK_STREAM,0)) == -1) return -1;
-
- len = 256;
diff --git a/mail/qmail/patches/patch-ai b/mail/qmail/patches/patch-ai
deleted file mode 100644
index 85846ad1071..00000000000
--- a/mail/qmail/patches/patch-ai
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-ai,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- qmail-local.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ qmail-local.c
-@@ -645,7 +645,7 @@ char **argv;
- {
- cmds.s[j] = 0;
- k = j;
-- while ((k > i) && (cmds.s[k - 1] == ' ') || (cmds.s[k - 1] == '\t'))
-+ while ((k > i) && ((cmds.s[k - 1] == ' ') || (cmds.s[k - 1] == '\t')))
- cmds.s[--k] = 0;
- switch(cmds.s[i])
- {
diff --git a/mail/qmail/patches/patch-aj b/mail/qmail/patches/patch-aj
deleted file mode 100644
index e709c9b9e63..00000000000
--- a/mail/qmail/patches/patch-aj
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-aj,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- qmail-log.5.orig 1998-06-15 06:53:16.000000000 -0400
-+++ qmail-log.5
-@@ -232,6 +232,11 @@ It will try again later.
- is unable to queue a bounce message,
- usually because the machine is almost out of memory.
- It will try again later.
-+This can also be caused by incorrect settings of
-+.B $QMAILQUEUE
-+or errors in a program or script which
-+.B $QMAILQUEUE
-+points to.
- .TP
- .B unable to stat ...
- .B qmail-send
diff --git a/mail/qmail/patches/patch-ak b/mail/qmail/patches/patch-ak
deleted file mode 100644
index adae72f70ce..00000000000
--- a/mail/qmail/patches/patch-ak
+++ /dev/null
@@ -1,103 +0,0 @@
-$NetBSD: patch-ak,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- qmail-pop3d.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ qmail-pop3d.c
-@@ -66,14 +66,14 @@ void die_nomaildir() { err("this user ha
- void die_scan() { err("unable to scan $HOME/Maildir"); die(); }
-
- void err_syntax() { err("syntax error"); }
--void err_unimpl() { err("unimplemented"); }
-+void err_unimpl(arg) char *arg; { err("unimplemented"); }
- void err_deleted() { err("already deleted"); }
- void err_nozero() { err("messages are counted from 1"); }
- void err_toobig() { err("not that many messages"); }
- void err_nosuch() { err("unable to open that message"); }
- void err_nounlink() { err("unable to unlink all deleted messages"); }
-
--void okay() { puts("+OK \r\n"); flush(); }
-+void okay(arg) char *arg; { puts("+OK \r\n"); flush(); }
-
- void printfn(fn) char *fn;
- {
-@@ -146,7 +146,7 @@ void getlist()
- }
- }
-
--void pop3_stat()
-+void pop3_stat(arg) char *arg;
- {
- int i;
- unsigned long total;
-@@ -161,15 +161,15 @@ void pop3_stat()
- flush();
- }
-
--void pop3_rset()
-+void pop3_rset(arg) char *arg;
- {
- int i;
- for (i = 0;i < numm;++i) m[i].flagdeleted = 0;
- last = 0;
-- okay();
-+ okay(0);
- }
-
--void pop3_last()
-+void pop3_last(arg) char *arg;
- {
- puts("+OK ");
- put(strnum,fmt_uint(strnum,last));
-@@ -177,7 +177,7 @@ void pop3_last()
- flush();
- }
-
--void pop3_quit()
-+void pop3_quit(arg) char *arg;
- {
- int i;
- for (i = 0;i < numm;++i)
-@@ -192,7 +192,7 @@ void pop3_quit()
- if (!stralloc_0(&line)) die_nomem();
- rename(m[i].fn,line.s); /* if it fails, bummer */
- }
-- okay();
-+ okay(0);
- die();
- }
-
-@@ -214,7 +214,7 @@ void pop3_dele(arg) char *arg;
- if (i == -1) return;
- m[i].flagdeleted = 1;
- if (i + 1 > last) last = i + 1;
-- okay();
-+ okay(0);
- }
-
- void list(i,flaguidl)
-@@ -238,7 +238,7 @@ void dolisting(arg,flaguidl) char *arg;
- list(i,flaguidl);
- }
- else {
-- okay();
-+ okay(0);
- for (i = 0;i < numm;++i)
- if (!m[i].flagdeleted)
- list(i,flaguidl);
-@@ -267,7 +267,7 @@ void pop3_top(arg) char *arg;
-
- fd = open_read(m[i].fn);
- if (fd == -1) { err_nosuch(); return; }
-- okay();
-+ okay(0);
- substdio_fdbuf(&ssmsg,read,fd,ssmsgbuf,sizeof(ssmsgbuf));
- blast(&ssmsg,limit);
- close(fd);
-@@ -299,7 +299,7 @@ char **argv;
-
- getlist();
-
-- okay();
-+ okay(0);
- commands(&ssin,pop3commands);
- die();
- }
diff --git a/mail/qmail/patches/patch-al b/mail/qmail/patches/patch-al
deleted file mode 100644
index 8f3e467ca9a..00000000000
--- a/mail/qmail/patches/patch-al
+++ /dev/null
@@ -1,27 +0,0 @@
-$NetBSD: patch-al,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- qmail-popup.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ qmail-popup.c
-@@ -64,10 +64,10 @@ void die_badauth() { err("authorization
-
- void err_syntax() { err("syntax error"); }
- void err_wantuser() { err("USER first"); }
--void err_authoriz() { err("authorization first"); }
-+void err_authoriz(arg) char *arg; { err("authorization first"); }
-
--void okay() { puts("+OK \r\n"); flush(); }
--void pop3_quit() { okay(); die(); }
-+void okay(arg) char *arg; { puts("+OK \r\n"); flush(); }
-+void pop3_quit(arg) char *arg; { okay(0); die(); }
-
-
- char unique[FMT_ULONG + FMT_ULONG + 3];
-@@ -136,7 +136,7 @@ void pop3_greet()
- void pop3_user(arg) char *arg;
- {
- if (!*arg) { err_syntax(); return; }
-- okay();
-+ okay(0);
- seenuser = 1;
- if (!stralloc_copys(&username,arg)) die_nomem();
- if (!stralloc_0(&username)) die_nomem();
diff --git a/mail/qmail/patches/patch-am b/mail/qmail/patches/patch-am
deleted file mode 100644
index 7526aafef39..00000000000
--- a/mail/qmail/patches/patch-am
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-am,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- qmail-queue.8.orig 1998-06-15 06:53:16.000000000 -0400
-+++ qmail-queue.8
-@@ -40,6 +40,12 @@ and does not enforce any restrictions on
- However, the recipients probably expect to see a proper header,
- as described in
- .BR qmail-header(5) .
-+
-+Programs included with qmail which invoke
-+.B qmail-queue
-+will invoke the contents of
-+.B $QMAILQUEUE
-+instead, if that environment variable is set.
- .SH "FILESYSTEM RESTRICTIONS"
- .B qmail-queue
- imposes two constraints on the queue structure:
diff --git a/mail/qmail/patches/patch-an b/mail/qmail/patches/patch-an
deleted file mode 100644
index a183669395e..00000000000
--- a/mail/qmail/patches/patch-an
+++ /dev/null
@@ -1,113 +0,0 @@
-$NetBSD: patch-an,v 1.2 2004/04/24 05:29:36 schmonz Exp $
-
---- qmail-smtpd.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ qmail-smtpd.c
-@@ -50,13 +50,14 @@ void die_ipme() { out("421 unable to fig
- void straynewline() { out("451 See http://pobox.com/~djb/docs/smtplf.html.\r\n"); flush(); _exit(1); }
-
- void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list (#5.7.1)\r\n"); }
-+void err_brt() { out("553 sorry, this recipient is in my badrecipientto list (#5.7.1)\r\n"); }
- void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)\r\n"); }
--void err_unimpl() { out("502 unimplemented (#5.5.1)\r\n"); }
-+void err_unimpl(arg) char *arg; { out("502 unimplemented (#5.5.1)\r\n"); }
- void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); }
- void err_wantmail() { out("503 MAIL first (#5.5.1)\r\n"); }
- void err_wantrcpt() { out("503 RCPT first (#5.5.1)\r\n"); }
--void err_noop() { out("250 ok\r\n"); }
--void err_vrfy() { out("252 send some mail, i'll try my best\r\n"); }
-+void err_noop(arg) char *arg; { out("250 ok\r\n"); }
-+void err_vrfy(arg) char *arg; { out("252 send some mail, i'll try my best\r\n"); }
- void err_qqt() { out("451 qqt failure (#4.3.0)\r\n"); }
-
-
-@@ -67,11 +68,11 @@ void smtp_greet(code) char *code;
- substdio_puts(&ssout,code);
- substdio_put(&ssout,greeting.s,greeting.len);
- }
--void smtp_help()
-+void smtp_help(arg) char *arg;
- {
-- out("214 qmail home page: http://pobox.com/~djb/qmail.html\r\n");
-+ out("214 netqmail home page: http://qmail.org/netqmail\r\n");
- }
--void smtp_quit()
-+void smtp_quit(arg) char *arg;
- {
- smtp_greet("221 "); out("\r\n"); flush(); _exit(0);
- }
-@@ -96,6 +97,9 @@ stralloc liphost = {0};
- int bmfok = 0;
- stralloc bmf = {0};
- struct constmap mapbmf;
-+int brtok = 0;
-+stralloc brt = {0};
-+struct constmap mapbrt;
-
- void setup()
- {
-@@ -116,6 +120,11 @@ void setup()
- if (bmfok == -1) die_control();
- if (bmfok)
- if (!constmap_init(&mapbmf,bmf.s,bmf.len,0)) die_nomem();
-+
-+ brtok = control_readfile(&brt,"control/badrcptto",0);
-+ if (brtok == -1) die_control();
-+ if (brtok)
-+ if (!constmap_init(&mapbrt,brt.s,brt.len,0)) die_nomem();
-
- if (control_readint(&databytes,"control/databytes") == -1) die_control();
- x = env_get("DATABYTES");
-@@ -208,6 +217,17 @@ int bmfcheck()
- return 0;
- }
-
-+int brtcheck()
-+{
-+ int j;
-+ if (!brtok) return 0;
-+ if (constmap(&mapbrt,addr.s,addr.len - 1)) return 1;
-+ j = byte_rchr(addr.s,addr.len,'@');
-+ if (j < addr.len)
-+ if (constmap(&mapbrt,addr.s + j,addr.len - j - 1)) return 1;
-+ return 0;
-+}
-+
- int addrallowed()
- {
- int r;
-@@ -232,7 +252,7 @@ void smtp_ehlo(arg) char *arg;
- smtp_greet("250-"); out("\r\n250-PIPELINING\r\n250 8BITMIME\r\n");
- seenmail = 0; dohelo(arg);
- }
--void smtp_rset()
-+void smtp_rset(arg) char *arg;
- {
- seenmail = 0;
- out("250 flushed\r\n");
-@@ -258,6 +278,7 @@ void smtp_rcpt(arg) char *arg; {
- }
- else
- if (!addrallowed()) { err_nogateway(); return; }
-+ if (!env_get("RELAYCLIENT") && brtcheck()) { err_brt(); return; }
- if (!stralloc_cats(&rcptto,"T")) die_nomem();
- if (!stralloc_cats(&rcptto,addr.s)) die_nomem();
- if (!stralloc_0(&rcptto)) die_nomem();
-@@ -316,8 +337,8 @@ int *hops;
- if (flagmaybex) if (pos == 7) ++*hops;
- if (pos < 2) if (ch != "\r\n"[pos]) flagmaybey = 0;
- if (flagmaybey) if (pos == 1) flaginheader = 0;
-+ ++pos;
- }
-- ++pos;
- if (ch == '\n') { pos = 0; flagmaybex = flagmaybey = flagmaybez = 1; }
- }
- switch(state) {
-@@ -365,7 +386,7 @@ void acceptmessage(qp) unsigned long qp;
- out("\r\n");
- }
-
--void smtp_data() {
-+void smtp_data(arg) char *arg; {
- int hops;
- unsigned long qp;
- char *qqx;
diff --git a/mail/qmail/patches/patch-ao b/mail/qmail/patches/patch-ao
deleted file mode 100644
index 3c506904b50..00000000000
--- a/mail/qmail/patches/patch-ao
+++ /dev/null
@@ -1,22 +0,0 @@
-$NetBSD: patch-ao,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- qmail.7.orig 1998-06-15 06:53:16.000000000 -0400
-+++ qmail.7
-@@ -55,12 +55,14 @@ Miscellaneous documentation includes
- and
- .BR qmail-pop3d (8).
-
--This documentation describes version
--1.03
-+This documentation describes netqmail version
-+1.05
- of
- .BR qmail .
- See
- .B http://pobox.com/~djb/qmail.html
- for other
- .BR qmail -related
--software.
-+software, and
-+.B http://qmail.org/
-+for other qmail community contributions.
diff --git a/mail/qmail/patches/patch-ap b/mail/qmail/patches/patch-ap
deleted file mode 100644
index d81694906d3..00000000000
--- a/mail/qmail/patches/patch-ap
+++ /dev/null
@@ -1,51 +0,0 @@
-$NetBSD: patch-ap,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- sendmail.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ sendmail.c
-@@ -45,6 +45,38 @@ void mailq()
- _exit(111);
- }
-
-+void do_sender(s)
-+const char *s;
-+{
-+ char *x;
-+ int n;
-+ int a;
-+ int i;
-+
-+ env_unset("QMAILNAME");
-+ env_unset("MAILNAME");
-+ env_unset("NAME");
-+ env_unset("QMAILHOST");
-+ env_unset("MAILHOST");
-+
-+ n = str_len(s);
-+ a = str_rchr(s, '@');
-+ if (a == n)
-+ {
-+ env_put2("QMAILUSER", s);
-+ return;
-+ }
-+ env_put2("QMAILHOST", s + a + 1);
-+
-+ x = (char *) alloc((a + 1) * sizeof(char));
-+ if (!x) nomem();
-+ for (i = 0; i < a; i++)
-+ x[i] = s[i];
-+ x[i] = 0;
-+ env_put2("QMAILUSER", x);
-+ alloc_free(x);
-+}
-+
- int flagh;
- char *sender;
-
-@@ -118,6 +150,7 @@ char **argv;
- if (sender) {
- *arg++ = "-f";
- *arg++ = sender;
-+ do_sender(sender);
- }
- *arg++ = "--";
- for (i = 0;i < argc;++i) *arg++ = argv[i];
diff --git a/mail/qmail/patches/patch-aq b/mail/qmail/patches/patch-aq
deleted file mode 100644
index cf2c09685b5..00000000000
--- a/mail/qmail/patches/patch-aq
+++ /dev/null
@@ -1,12 +0,0 @@
-$NetBSD: patch-aq,v 1.1 2004/04/10 05:30:06 schmonz Exp $
-
---- spawn.c.orig 1998-06-15 06:53:16.000000000 -0400
-+++ spawn.c
-@@ -5,6 +5,7 @@
- #include "substdio.h"
- #include "byte.h"
- #include "str.h"
-+#include "alloc.h"
- #include "stralloc.h"
- #include "select.h"
- #include "exit.h"