pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

(mail/sendmail) Update candidate, but snapshot version. 8.16.0.21



Module Name:	pkgsrc-wip
Committed By:	Makoto Fujiwara (CF-SX2) <makoto%ki.nu@localhost>
Pushed By:	mef
Date:		Sun Apr 1 22:46:14 2018 +0900
Changeset:	fabc25d0ce9f22672784fd8b7ca6c169fe4abac1

Added Files:
	sendmail/DESCR
	sendmail/MESSAGE
	sendmail/Makefile
	sendmail/Makefile.common
	sendmail/PLIST
	sendmail/TODO
	sendmail/distinfo
	sendmail/files/mailer.conf
	sendmail/files/netbsd-proto.mc
	sendmail/files/sendmail.sh
	sendmail/files/site.config.m4
	sendmail/files/site.config.m4-db2
	sendmail/files/site.config.m4-db4
	sendmail/files/site.config.m4-ffr_tls
	sendmail/files/site.config.m4-fpic
	sendmail/files/site.config.m4-ldap
	sendmail/files/site.config.m4-libresolv
	sendmail/files/site.config.m4-milter
	sendmail/files/site.config.m4-sasl2
	sendmail/files/site.config.m4-starttls
	sendmail/files/site.config.m4-stdbool
	sendmail/files/site.config.m4-tcpwrappers
	sendmail/files/site.config.m4-v6
	sendmail/files/site.config.m4-v6-not-solaris
	sendmail/files/sm_os_netbsd.h
	sendmail/files/smf/manifest.xml
	sendmail/files/smf/sendmail.sh
	sendmail/files/smf/sendmail_include.sh
	sendmail/files/smf/smmsp.sh
	sendmail/files/smmsp.sh
	sendmail/options.mk
	sendmail/patches/patch-aa
	sendmail/patches/patch-af
	sendmail/patches/patch-ag
	sendmail/patches/patch-ah
	sendmail/patches/patch-ai
	sendmail/patches/patch-aj
	sendmail/patches/patch-an
	sendmail/patches/patch-ao
	sendmail/patches/patch-ap
	sendmail/patches/patch-aq
	sendmail/patches/patch-ar
	sendmail/patches/patch-as
	sendmail/patches/patch-at
	sendmail/patches/patch-au
	sendmail/patches/patch-av
	sendmail/patches/patch-aw
	sendmail/patches/patch-ax
	sendmail/patches/patch-ay
	sendmail/patches/patch-az
	sendmail/patches/patch-ba
	sendmail/patches/patch-bb
	sendmail/patches/patch-bc
	sendmail/patches/patch-bd
	sendmail/patches/patch-be
	sendmail/patches/patch-bf
	sendmail/patches/patch-bg
	sendmail/patches/patch-libsm_notify.c

Log Message:
(mail/sendmail) Update candidate, but snapshot version. 8.16.0.21

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=fabc25d0ce9f22672784fd8b7ca6c169fe4abac1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 sendmail/DESCR                               |   8 +
 sendmail/MESSAGE                             |  67 +++++++
 sendmail/Makefile                            | 142 ++++++++++++++
 sendmail/Makefile.common                     |  71 +++++++
 sendmail/PLIST                               | 234 ++++++++++++++++++++++
 sendmail/TODO                                |   7 +
 sendmail/distinfo                            |  33 ++++
 sendmail/files/mailer.conf                   |  10 +
 sendmail/files/netbsd-proto.mc               |  66 +++++++
 sendmail/files/sendmail.sh                   |  60 ++++++
 sendmail/files/site.config.m4                |  31 +++
 sendmail/files/site.config.m4-db2            |   5 +
 sendmail/files/site.config.m4-db4            |   5 +
 sendmail/files/site.config.m4-ffr_tls        |   5 +
 sendmail/files/site.config.m4-fpic           |   4 +
 sendmail/files/site.config.m4-ldap           |   6 +
 sendmail/files/site.config.m4-libresolv      |   4 +
 sendmail/files/site.config.m4-milter         |   4 +
 sendmail/files/site.config.m4-sasl2          |   8 +
 sendmail/files/site.config.m4-starttls       |   5 +
 sendmail/files/site.config.m4-stdbool        |   4 +
 sendmail/files/site.config.m4-tcpwrappers    |   5 +
 sendmail/files/site.config.m4-v6             |   4 +
 sendmail/files/site.config.m4-v6-not-solaris |   4 +
 sendmail/files/sm_os_netbsd.h                |  29 +++
 sendmail/files/smf/manifest.xml              | 284 +++++++++++++++++++++++++++
 sendmail/files/smf/sendmail.sh               | 131 ++++++++++++
 sendmail/files/smf/sendmail_include.sh       | 103 ++++++++++
 sendmail/files/smf/smmsp.sh                  |  82 ++++++++
 sendmail/files/smmsp.sh                      |  30 +++
 sendmail/options.mk                          |  58 ++++++
 sendmail/patches/patch-aa                    |  22 +++
 sendmail/patches/patch-af                    |  43 ++++
 sendmail/patches/patch-ag                    |  26 +++
 sendmail/patches/patch-ah                    |  38 ++++
 sendmail/patches/patch-ai                    |  25 +++
 sendmail/patches/patch-aj                    |  18 ++
 sendmail/patches/patch-an                    |  49 +++++
 sendmail/patches/patch-ao                    |  50 +++++
 sendmail/patches/patch-ap                    |  28 +++
 sendmail/patches/patch-aq                    |  15 ++
 sendmail/patches/patch-ar                    | 110 +++++++++++
 sendmail/patches/patch-as                    |  60 ++++++
 sendmail/patches/patch-at                    | 148 ++++++++++++++
 sendmail/patches/patch-au                    |  87 ++++++++
 sendmail/patches/patch-av                    |  33 ++++
 sendmail/patches/patch-aw                    |  32 +++
 sendmail/patches/patch-ax                    |  18 ++
 sendmail/patches/patch-ay                    |  96 +++++++++
 sendmail/patches/patch-az                    |  26 +++
 sendmail/patches/patch-ba                    |  13 ++
 sendmail/patches/patch-bb                    |  13 ++
 sendmail/patches/patch-bc                    |  17 ++
 sendmail/patches/patch-bd                    |  13 ++
 sendmail/patches/patch-be                    |  13 ++
 sendmail/patches/patch-bf                    |  15 ++
 sendmail/patches/patch-bg                    |  24 +++
 sendmail/patches/patch-libsm_notify.c        |  17 ++
 58 files changed, 2558 insertions(+)

diffs:
diff --git a/sendmail/DESCR b/sendmail/DESCR
new file mode 100644
index 0000000000..460d04ee70
--- /dev/null
+++ b/sendmail/DESCR
@@ -0,0 +1,8 @@
+Sendmail acts as a unified "post office" to which all mail can be
+submitted.  Address interpretation is controlled by a production
+system, which can parse both domain-based addressing and old-style
+"ad hoc" addresses.  The production system is powerful enough to
+rewrite addresses in the message header to conform to the standards
+of a number of common target networks, including old (NCP/RFC733)
+Arpanet, new (TCP/RFC822) Arpanet, UUCP, and Phonenet. Sendmail
+also implements an SMTP server, message queueing, and aliasing.
diff --git a/sendmail/MESSAGE b/sendmail/MESSAGE
new file mode 100644
index 0000000000..f9ce82c70a
--- /dev/null
+++ b/sendmail/MESSAGE
@@ -0,0 +1,67 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.8 2014/12/06 23:22:20 jnemeth Exp $
+
+INCOMPATIBLE CONFIG CHANGE
+
+If you are updating from a previous version to 8.15.1 or later,
+note that there has been an incompatible config change for IPv6
+addresses:
+
+        Incompatible Change: Use uncompressed IPv6 addresses by default,
+                i.e., they will not contain "::".  For example,
+                instead of ::1 it will be 0:0:0:0:0:0:0:1.  This
+                permits a zero subnet to have a more specific match,
+                such as different map entries for IPv6:0:0 vs IPv6:0.
+                This change requires that configuration data
+                (including maps, files, classes, custom ruleset,
+                etc) must use the same format, so make certain such
+                configuration data is updated before using 8.15.
+                As a very simple check search for patterns like
+                'IPv6:[0-9a-fA-F:]*::' and 'IPv6::'. If necessary,
+                the prior format can be retained by compiling with:
+                APPENDDEF(`conf_sendmail_ENVDEF', `-DIPV6_FULL=0')
+                in your devtools/Site/site.config.m4 file.
+
+===========================================================================
+
+To use "${PKGNAME}" as the system's mail transport agent you have
+to install "${PREFIX}/share/examples/sendmail/mailer.conf" as global
+mailwrapper configuration file.  The command below will do that for you:
+
+ln -fs ${PREFIX}/share/examples/sendmail/mailer.conf /etc/mailer.conf
+
+You should also add a line to /etc/mtree/special.local so you won't
+get a complaint in the daily insecurity e-mail like this:
+
+./etc/mailer.conf			type=link mode=0444
+
+
+If you are changing the database format used by sendmail you must run
+"newaliases" and "makemap" in order to re-create the databases.
+
+You may also need to install (and/or customize) the configuration files
+for Sendmail before it will be operational.  "cd" to the directory
+
+    ${PREFIX}/share/sendmail/cf
+
+and read the file README for instructions on creating and installing
+configuration files.
+
+
+NOTE: If your system doesn't have mailwrapper and/or it won't
+install on your system, then you will need to move aside system
+supplied binaries and replace them with symlinks to the binaries
+supplied with sendmail.  The most important of these is the sendmail
+binary itself.  This is typically located at /usr/sbin/sendmail or
+/usr/lib/sendmail.  These will need to be moved aside, and you will
+need to create a symlink from /usr/sbin/sendmail to
+${PREFIX}/libexec/sendmail/sendmail.  This is required because most
+third party apps (or, even system supplied apps) will look for
+sendmail at one of the above locations.  There are a variety of
+other apps such as:  editmap, hoststat, mailq, mailstats, makemap,
+newaliases, praliases, purgestat, and vacation.  You can deal with
+these either by having ${PREFIX}/bin and ${PREFIX}/sbin at the
+beginning of your PATH, or creating symlinks.  hoststat, mailq,
+mailstats, newaliases, and purgestat are just links to sendmail.
+
+===========================================================================
diff --git a/sendmail/Makefile b/sendmail/Makefile
new file mode 100644
index 0000000000..8ba1af6f91
--- /dev/null
+++ b/sendmail/Makefile
@@ -0,0 +1,142 @@
+# $NetBSD: Makefile,v 1.129 2016/12/16 16:07:29 hans Exp $
+
+PKGNAME=	sendmail-${DIST_VERS}
+COMMENT=	The well known Mail Transport Agent
+
+CONFLICTS+=	courier-mta-[0-9]* fastforward>=0.51nb2 postfix-[0-9]*
+CONFLICTS+=	esmtp>=1.2
+
+.include "options.mk"
+.include "../../wip/sendmail/Makefile.common"
+
+USE_TOOLS+=	pax
+
+MESSAGE_SRC=	${WRKDIR}/.MESSAGE_SRC
+PLIST_SRC=	${WRKDIR}/.PLIST_SRC
+
+SMRSH_CMDDIR?=	${PREFIX}/libexec/sm.bin
+PLIST_SUBST+=	SMRSH_CMDDIR=${SMRSH_CMDDIR}
+RCD_SCRIPTS=	sendmail smmsp
+SMF_METHODS=	sendmail sendmail_include smmsp
+
+BUILD_DEFS+=	VARBASE
+
+# Not OWN_DIRS, so that the admin doesn't get a suggestion to delete the
+# queue dirs if they are nonempty at deinstall (probably undesirable).
+#
+MAKE_DIRS_PERMS+=	/${VARBASE}/spool/clientmqueue smmsp smmsp 0770
+MAKE_DIRS_PERMS+=	/${VARBASE}/spool/mqueue ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
+
+SPECIAL_PERMS+=		libexec/sendmail/sendmail ${REAL_ROOT_USER} smmsp 2555
+
+PKG_GROUPS=		smmsp
+PKG_USERS=		smmsp:smmsp
+PKG_GECOS.smmsp=	Sendmail Message Submission Program
+
+SUBST_CLASSES+=		paths cf-paths
+
+SUBST_STAGE.paths=	pre-configure
+SUBST_FILES.paths=	../mailer.conf smrsh/smrsh.8 cf/cf/Makefile
+SUBST_SED.paths+=	-e "s|@@BINGRP@@|${BINGRP}|g"
+SUBST_SED.paths+=	-e "s|@@BINOWN@@|${BINOWN}|g"
+SUBST_SED.paths+=	-e "s|@@INSTALL@@|${INSTALL}|g"
+SUBST_SED.paths+=	-e "s|@@PREFIX@@|${PREFIX}|g"
+SUBST_SED.paths+=	-e "s|@@SMRSH_CMDDIR@@|${SMRSH_CMDDIR}|g"
+SUBST_MESSAGE.paths=	Fixing paths.
+
+SUBST_STAGE.cf-paths=	pre-build
+.for f in cf/README cf/cf/generic-bsd4.4.cf cf/cf/generic-hpux10.cf	\
+	cf/cf/generic-hpux9.cf cf/cf/generic-linux.cf			\
+	cf/cf/generic-mpeix.cf cf/cf/generic-nextstep3.3.cf		\
+	cf/cf/generic-osf1.cf cf/cf/generic-solaris.cf			\
+	cf/cf/generic-sunos4.1.cf cf/cf/generic-ultrix4.cf		\
+	cf/cf/knecht.mc cf/cf/submit.cf cf/feature/local_lmtp.m4	\
+	cf/feature/msp.m4 cf/feature/smrsh.m4 cf/m4/proto.m4		\
+	cf/mailer/pop.m4 cf/mailer/usenet.m4 cf/ostype/a-ux.m4		\
+	cf/ostype/aix3.m4 cf/ostype/aix4.m4 cf/ostype/aix5.m4		\
+	cf/ostype/amdahl-uts.m4 cf/ostype/darwin.m4 cf/ostype/dgux.m4	\
+	cf/ostype/domainos.m4 cf/ostype/dragonfly.m4			\
+	cf/ostype/dynix3.2.m4 cf/ostype/freebsd4.m4			\
+	cf/ostype/freebsd5.m4 cf/ostype/freebsd6.m4 cf/ostype/hpux10.m4	\
+	cf/ostype/irix4.m4 cf/ostype/irix5.m4 cf/ostype/irix6.m4	\
+	cf/ostype/isc4.1.m4 cf/ostype/maxion.m4 cf/ostype/nextstep.m4	\
+	cf/ostype/openbsd.m4 cf/ostype/ptx2.m4 cf/ostype/riscos4.5.m4	\
+	cf/ostype/sco-uw-2.1.m4 cf/ostype/sco3.2.m4 cf/ostype/sinix.m4	\
+	cf/ostype/solaris11.m4 cf/ostype/solaris2.m4			\
+	cf/ostype/solaris2.ml.m4 cf/ostype/solaris2.pre5.m4		\
+	cf/ostype/solaris8.m4 cf/ostype/sunos3.5.m4			\
+	cf/ostype/sunos4.1.m4 cf/ostype/ultrix4.m4 cf/ostype/unicos.m4	\
+	cf/ostype/unicosmk.m4 cf/ostype/unicosmp.m4			\
+	cf/ostype/unixware7.m4
+SUBST_FILES.cf-paths+=	${f}
+.endfor
+SUBST_SED.cf-paths+=	-e "s|/var/spool|${VARBASE}/spool|g"
+SUBST_SED.cf-paths+=	-e "s|/var/run|${VARBASE}/run|g"
+SUBST_SED.cf-paths+=	-e "s|/usr/libexec|${PREFIX}/libexec/sendmail|g"
+SUBST_SED.cf-paths+=	-e "s|/usr/lib|${PREFIX}/libexec/sendmail|g"
+SUBST_SED.cf-paths+=	-e "s|/system/volatile|${VARBASE}/run|g"
+
+REPLACE_PERL=		contrib/socketmapClient.pl contrib/socketmapServer.pl
+
+AUTO_MKDIRS=	yes
+
+post-patch: make-sendmail-siteconfig
+.if !empty(PKG_OPTIONS:Mtcpwrappers)
+	cat ${FILESDIR}/site.config.m4-tcpwrappers >>${SITECONFIG}
+.endif
+.if !empty(PKG_OPTIONS:Mldap)
+	cat ${FILESDIR}/site.config.m4-ldap >>${SITECONFIG}
+.endif
+.if !empty(PKG_OPTIONS:Mdb2)
+	cat ${FILESDIR}/site.config.m4-db2 >>${SITECONFIG}
+.endif
+.if !empty(PKG_OPTIONS:Mdb4)
+	cat ${FILESDIR}/site.config.m4-db4 >>${SITECONFIG}
+.endif
+.if !empty(PKG_OPTIONS:Mtls)
+	cat ${FILESDIR}/site.config.m4-starttls >>${SITECONFIG}
+.endif
+.if !empty(PKG_OPTIONS:Msendmail-ffr-tls)
+	cat ${FILESDIR}/site.config.m4-ffr_tls >>${SITECONFIG}
+.endif
+.if !empty(PKG_OPTIONS:Msasl)
+	cat ${FILESDIR}/site.config.m4-sasl2 >>${SITECONFIG}
+.endif
+
+post-extract:
+	cp ${FILESDIR}/mailer.conf ${WRKDIR}/mailer.conf
+
+do-build:
+	(cd ${WRKSRC} && env ${MAKE_ENV} ./Build)
+	(cd ${WRKSRC}/cf/cf && env ${MAKE_ENV} ./Build)
+
+post-build:
+	cp ${PKGDIR}/MESSAGE ${MESSAGE_SRC}
+	cp ${PKGDIR}/PLIST ${WRKDIR}/.PLIST_SRC
+
+post-install:
+	(cd ${WRKSRC}/mail.local && env ${INSTALL_ENV} ${MAKE_ENV} ./Build force-install)
+
+	${INSTALL_DATA} ${WRKDIR}/mailer.conf \
+		${DESTDIR}${PREFIX}/share/examples/sendmail/
+	cd ${WRKSRC}/cf && pax -rw -pp -pm -s',^.*\.orig$$,,' . ${DESTDIR}${PREFIX}/share/sendmail
+	cp ${FILESDIR}/netbsd-proto.mc ${DESTDIR}${PREFIX}/share/sendmail/cf
+
+	${INSTALL_DATA} ${WRKSRC}/obj.`${UNAME} -srm | tr \  . | tr \/ - | sed s/sun4./sun4/`/libsm/libsm.a \
+		${DESTDIR}${PREFIX}/lib
+
+	${INSTALL_DATA} \
+		${WRKSRC}/obj.`${UNAME} -srm | tr \  . | tr \/ - | sed s/sun4./sun4/`/libsmutil/libsmutil.a \
+		${DESTDIR}${PREFIX}/lib
+	${INSTALL_SCRIPT} ${WRKSRC}/contrib/socketmap*.pl \
+		${DESTDIR}${PREFIX}/share/examples/sendmail/
+	${INSTALL_DATA} ${WRKSRC}/RELEASE_NOTES ${DESTDIR}${PREFIX}/share/doc/sendmail
+	${INSTALL_DATA} ${WRKSRC}/cf/README ${DESTDIR}${PREFIX}/share/doc/sendmail
+	${INSTALL_DATA} ${WRKSRC}/sendmail/SECURITY ${DESTDIR}${PREFIX}/share/doc/sendmail
+	${INSTALL_DATA} ${WRKSRC}/doc/op/op.me ${DESTDIR}${PREFIX}/share/doc/sendmail
+	${INSTALL_DATA} ${WRKSRC}/doc/op/op.ps ${DESTDIR}${PREFIX}/share/doc/sendmail
+
+.include "../../mk/bsd.pkg.mk"
+
+# has to be below include for bsd.pkg.mk, else substition fails
+OBJDIR!=	${ECHO} obj.`${UNAME} -srm | tr \  . | tr \/ -`
diff --git a/sendmail/Makefile.common b/sendmail/Makefile.common
new file mode 100644
index 0000000000..c51c34b0bf
--- /dev/null
+++ b/sendmail/Makefile.common
@@ -0,0 +1,71 @@
+# $NetBSD: Makefile.common,v 1.65 2017/01/19 18:52:17 agc Exp $
+#
+# used by mail/libmilter/Makefile
+# used by mail/sendmail/Makefile
+# used by mail/sendmail-qtool/Makefile
+# used by mail/sendmail-cidrexpand/Makefile
+#
+
+DISTNAME=	sendmail.${DIST_VERS}
+CATEGORIES=	mail
+MASTER_SITES=	ftp://ftp.sendmail.org/pub/sendmail/snapshots/
+MASTER_SITES+=	ftp://ftp.sendmail.org/pub/sendmail/
+MASTER_SITES+=	ftp://ftp.sendmail.org/pub/sendmail/past-releases/
+MASTER_SITES+=	ftp://ftp.fu-berlin.de/pub/unix/mail/sendmail/
+
+OWNER?=		jnemeth%NetBSD.org@localhost
+HOMEPAGE=	http://www.sendmail.org/
+LICENSE=	sendmail-license
+
+DISTINFO_FILE=	${.CURDIR}/../../wip/sendmail/distinfo
+FILESDIR=	${.CURDIR}/../../wip/sendmail/files
+PATCHDIR=	${.CURDIR}/../../wip/sendmail/patches
+
+USE_LANGUAGES=	c99
+
+DIST_VERS=	8.16.0.21
+
+MAKE_ENV+=	BSD_BINOWN=${BINOWN} BSD_BINGRP=${BINGRP} \
+		BSD_MANOWN=${MANOWN} BSD_MANGRP=${MANGRP} \
+		BUILDLINK_DIR=${BUILDLINK_DIR} \
+		SMRSH_CMDDIR=${SMRSH_CMDDIR}
+SITECONFIG=	${WRKSRC}/devtools/Site/site.config.m4
+
+BUILD_DEFS+=	SMRSH_CMDDIR
+
+WRKSRC=		${WRKDIR}/sendmail-${DIST_VERS}
+USE_TOOLS+=	gm4
+MAKE_ENV+=	M4=${TOOLS_M4}
+
+.include "../../mk/bsd.prefs.mk"
+
+CFLAGS+=	-I../include -I../
+
+.if ${OPSYS} == "SunOS" && exists(/usr/include/paths.h)
+CFLAGS+=	-DSOLARIS_HAS_PATHS_H
+.endif
+
+pre-configure:
+	cp ${FILESDIR}/sm_os_netbsd.h ${WRKSRC}/include/sm/os/sm_os_netbsd.h
+
+.PHONY: make-sendmail-siteconfig
+make-sendmail-siteconfig:
+	${CP} ${FILESDIR}/site.config.m4 ${SITECONFIG}
+	${CHMOD} +w ${SITECONFIG}
+
+.if !empty(PKG_OPTIONS:Minet6)
+	${CAT} ${FILESDIR}/site.config.m4-v6 >>${SITECONFIG}
+.  if (${OPSYS} != "SunOS") && (${OPSYS} != "BSDOS") && \
+      (${OPSYS} != "DragonFly") && (${OPSYS} != "FreeBSD")
+	${CAT} ${FILESDIR}/site.config.m4-v6-not-solaris >>${SITECONFIG}
+.  endif
+.endif
+
+	${CAT} ${FILESDIR}/site.config.m4-milter >>${SITECONFIG}
+.if ${OPSYS} == "SunOS"
+	${CAT} ${FILESDIR}/site.config.m4-fpic >>${SITECONFIG}
+	${CAT} ${FILESDIR}/site.config.m4-libresolv >>${SITECONFIG}
+.  if exists(/usr/include/stdbool.h)
+	${CAT} ${FILESDIR}/site.config.m4-stdbool >>${SITECONFIG}
+.  endif
+.endif
diff --git a/sendmail/PLIST b/sendmail/PLIST
new file mode 100644
index 0000000000..2c0badb139
--- /dev/null
+++ b/sendmail/PLIST
@@ -0,0 +1,234 @@
+@comment $NetBSD: PLIST,v 1.24 2015/07/11 10:08:32 jnemeth Exp $
+bin/hoststat
+bin/mailq
+bin/newaliases
+bin/purgestat
+bin/vacation
+lib/libsm.a
+lib/libsmutil.a
+libexec/sendmail/mail.local
+libexec/sendmail/sendmail
+libexec/sendmail/smrsh
+man/man1/mailq.1
+man/man1/newaliases.1
+man/man1/vacation.1
+man/man5/aliases.5
+man/man8/editmap.8
+man/man8/mail.local.8
+man/man8/mailstats.8
+man/man8/makemap.8
+man/man8/praliases.8
+man/man8/sendmail.8
+man/man8/smrsh.8
+sbin/editmap
+sbin/mailstats
+sbin/makemap
+sbin/praliases
+share/doc/sendmail/README
+share/doc/sendmail/RELEASE_NOTES
+share/doc/sendmail/SECURITY
+share/doc/sendmail/op.me
+share/doc/sendmail/op.ps
+share/examples/sendmail/mailer.conf
+share/examples/sendmail/socketmapClient.pl
+share/examples/sendmail/socketmapServer.pl
+share/misc/helpfile
+share/sendmail/README
+share/sendmail/cf/Build
+share/sendmail/cf/Makefile
+share/sendmail/cf/README
+share/sendmail/cf/chez.cs.mc
+share/sendmail/cf/clientproto.mc
+share/sendmail/cf/cs-hpux10.mc
+share/sendmail/cf/cs-hpux9.mc
+share/sendmail/cf/cs-osf1.mc
+share/sendmail/cf/cs-solaris2.mc
+share/sendmail/cf/cs-sunos4.1.mc
+share/sendmail/cf/cs-ultrix4.mc
+share/sendmail/cf/cyrusproto.mc
+share/sendmail/cf/generic-bsd4.4.cf
+share/sendmail/cf/generic-bsd4.4.mc
+share/sendmail/cf/generic-hpux10.cf
+share/sendmail/cf/generic-hpux10.mc
+share/sendmail/cf/generic-hpux9.cf
+share/sendmail/cf/generic-hpux9.mc
+share/sendmail/cf/generic-linux.cf
+share/sendmail/cf/generic-linux.mc
+share/sendmail/cf/generic-mpeix.cf
+share/sendmail/cf/generic-mpeix.mc
+share/sendmail/cf/generic-nextstep3.3.cf
+share/sendmail/cf/generic-nextstep3.3.mc
+share/sendmail/cf/generic-osf1.cf
+share/sendmail/cf/generic-osf1.mc
+share/sendmail/cf/generic-solaris.cf
+share/sendmail/cf/generic-solaris.mc
+share/sendmail/cf/generic-sunos4.1.cf
+share/sendmail/cf/generic-sunos4.1.mc
+share/sendmail/cf/generic-ultrix4.cf
+share/sendmail/cf/generic-ultrix4.mc
+share/sendmail/cf/huginn.cs.mc
+share/sendmail/cf/knecht.cf
+share/sendmail/cf/knecht.mc
+share/sendmail/cf/mail.cs.mc
+share/sendmail/cf/mail.eecs.mc
+share/sendmail/cf/mailspool.cs.mc
+share/sendmail/cf/netbsd-proto.mc
+share/sendmail/cf/python.cs.mc
+share/sendmail/cf/s2k-osf1.mc
+share/sendmail/cf/s2k-ultrix4.mc
+share/sendmail/cf/submit.cf
+share/sendmail/cf/submit.mc
+share/sendmail/cf/tcpproto.mc
+share/sendmail/cf/ucbarpa.mc
+share/sendmail/cf/ucbvax.mc
+share/sendmail/cf/uucpproto.mc
+share/sendmail/cf/vangogh.cs.mc
+share/sendmail/domain/Berkeley.EDU.m4
+share/sendmail/domain/CS.Berkeley.EDU.m4
+share/sendmail/domain/EECS.Berkeley.EDU.m4
+share/sendmail/domain/S2K.Berkeley.EDU.m4
+share/sendmail/domain/berkeley-only.m4
+share/sendmail/domain/generic.m4
+share/sendmail/feature/accept_unqualified_senders.m4
+share/sendmail/feature/accept_unresolvable_domains.m4
+share/sendmail/feature/access_db.m4
+share/sendmail/feature/allmasquerade.m4
+share/sendmail/feature/always_add_domain.m4
+share/sendmail/feature/authinfo.m4
+share/sendmail/feature/badmx.m4
+share/sendmail/feature/bcc.m4
+share/sendmail/feature/bestmx_is_local.m4
+share/sendmail/feature/bitdomain.m4
+share/sendmail/feature/blacklist_recipients.m4
+share/sendmail/feature/block_bad_helo.m4
+share/sendmail/feature/compat_check.m4
+share/sendmail/feature/conncontrol.m4
+share/sendmail/feature/delay_checks.m4
+share/sendmail/feature/dnsbl.m4
+share/sendmail/feature/domaintable.m4
+share/sendmail/feature/enhdnsbl.m4
+share/sendmail/feature/generics_entire_domain.m4
+share/sendmail/feature/genericstable.m4
+share/sendmail/feature/greet_pause.m4
+share/sendmail/feature/ldap_routing.m4
+share/sendmail/feature/limited_masquerade.m4
+share/sendmail/feature/local_lmtp.m4
+share/sendmail/feature/local_no_masquerade.m4
+share/sendmail/feature/local_procmail.m4
+share/sendmail/feature/lookupdotdomain.m4
+share/sendmail/feature/loose_relay_check.m4
+share/sendmail/feature/mailertable.m4
+share/sendmail/feature/masquerade_entire_domain.m4
+share/sendmail/feature/masquerade_envelope.m4
+share/sendmail/feature/msp.m4
+share/sendmail/feature/mtamark.m4
+share/sendmail/feature/no_default_msa.m4
+share/sendmail/feature/nocanonify.m4
+share/sendmail/feature/nopercenthack.m4
+share/sendmail/feature/notsticky.m4
+share/sendmail/feature/nouucp.m4
+share/sendmail/feature/nullclient.m4
+share/sendmail/feature/prefixmod.m4
+share/sendmail/feature/preserve_local_plus_detail.m4
+share/sendmail/feature/preserve_luser_host.m4
+share/sendmail/feature/promiscuous_relay.m4
+share/sendmail/feature/queuegroup.m4
+share/sendmail/feature/ratecontrol.m4
+share/sendmail/feature/redirect.m4
+share/sendmail/feature/relay_based_on_MX.m4
+share/sendmail/feature/relay_entire_domain.m4
+share/sendmail/feature/relay_hosts_only.m4
+share/sendmail/feature/relay_local_from.m4
+share/sendmail/feature/relay_mail_from.m4
+share/sendmail/feature/require_rdns.m4
+share/sendmail/feature/smrsh.m4
+share/sendmail/feature/stickyhost.m4
+share/sendmail/feature/tls_failures.m4
+share/sendmail/feature/tls_session_features.m4
+share/sendmail/feature/use_client_ptr.m4
+share/sendmail/feature/use_ct_file.m4
+share/sendmail/feature/use_cw_file.m4
+share/sendmail/feature/uucpdomain.m4
+share/sendmail/feature/virtuser_entire_domain.m4
+share/sendmail/feature/virtusertable.m4
+share/sendmail/hack/cssubdomain.m4
+share/sendmail/hack/xconnect.m4
+share/sendmail/m4/cf.m4
+share/sendmail/m4/cfhead.m4
+share/sendmail/m4/proto.m4
+share/sendmail/m4/version.m4
+share/sendmail/mailer/cyrus.m4
+share/sendmail/mailer/cyrusv2.m4
+share/sendmail/mailer/fax.m4
+share/sendmail/mailer/local.m4
+share/sendmail/mailer/mail11.m4
+share/sendmail/mailer/phquery.m4
+share/sendmail/mailer/pop.m4
+share/sendmail/mailer/procmail.m4
+share/sendmail/mailer/qpage.m4
+share/sendmail/mailer/smtp.m4
+share/sendmail/mailer/usenet.m4
+share/sendmail/mailer/uucp.m4
+share/sendmail/ostype/a-ux.m4
+share/sendmail/ostype/aix3.m4
+share/sendmail/ostype/aix4.m4
+share/sendmail/ostype/aix5.m4
+share/sendmail/ostype/altos.m4
+share/sendmail/ostype/amdahl-uts.m4
+share/sendmail/ostype/bsd4.3.m4
+share/sendmail/ostype/bsd4.4.m4
+share/sendmail/ostype/bsdi.m4
+share/sendmail/ostype/bsdi1.0.m4
+share/sendmail/ostype/bsdi2.0.m4
+share/sendmail/ostype/darwin.m4
+share/sendmail/ostype/dgux.m4
+share/sendmail/ostype/domainos.m4
+share/sendmail/ostype/dragonfly.m4
+share/sendmail/ostype/dynix3.2.m4
+share/sendmail/ostype/freebsd4.m4
+share/sendmail/ostype/freebsd5.m4
+share/sendmail/ostype/freebsd6.m4
+share/sendmail/ostype/gnu.m4
+share/sendmail/ostype/hpux10.m4
+share/sendmail/ostype/hpux11.m4
+share/sendmail/ostype/hpux9.m4
+share/sendmail/ostype/irix4.m4
+share/sendmail/ostype/irix5.m4
+share/sendmail/ostype/irix6.m4
+share/sendmail/ostype/isc4.1.m4
+share/sendmail/ostype/linux.m4
+share/sendmail/ostype/maxion.m4
+share/sendmail/ostype/mklinux.m4
+share/sendmail/ostype/mpeix.m4
+share/sendmail/ostype/nextstep.m4
+share/sendmail/ostype/openbsd.m4
+share/sendmail/ostype/osf1.m4
+share/sendmail/ostype/powerux.m4
+share/sendmail/ostype/ptx2.m4
+share/sendmail/ostype/qnx.m4
+share/sendmail/ostype/riscos4.5.m4
+share/sendmail/ostype/sco-uw-2.1.m4
+share/sendmail/ostype/sco3.2.m4
+share/sendmail/ostype/sinix.m4
+share/sendmail/ostype/solaris11.m4
+share/sendmail/ostype/solaris2.m4
+share/sendmail/ostype/solaris2.ml.m4
+share/sendmail/ostype/solaris2.pre5.m4
+share/sendmail/ostype/solaris8.m4
+share/sendmail/ostype/sunos3.5.m4
+share/sendmail/ostype/sunos4.1.m4
+share/sendmail/ostype/svr4.m4
+share/sendmail/ostype/ultrix4.m4
+share/sendmail/ostype/unicos.m4
+share/sendmail/ostype/unicosmk.m4
+share/sendmail/ostype/unicosmp.m4
+share/sendmail/ostype/unixware7.m4
+share/sendmail/ostype/unknown.m4
+share/sendmail/ostype/uxpds.m4
+share/sendmail/sendmail.schema
+share/sendmail/sh/makeinfo.sh
+share/sendmail/siteconfig/uucp.cogsci.m4
+share/sendmail/siteconfig/uucp.old.arpa.m4
+share/sendmail/siteconfig/uucp.ucbarpa.m4
+share/sendmail/siteconfig/uucp.ucbvax.m4
+@pkgdir libexec/sm.bin
diff --git a/sendmail/TODO b/sendmail/TODO
new file mode 100644
index 0000000000..b83fcbb7f5
--- /dev/null
+++ b/sendmail/TODO
@@ -0,0 +1,7 @@
+$NetBSD: TODO,v 1.2 2014/06/20 16:26:55 jnemeth Exp $
+
+- investigate why the combination of SASL, NAMED_RESN, and MILTER fails
+- get helpfile installed somewhere useful
+  - alternatively, adjust default "O HelpFile"
+- install sample aliases somewhere
+- look into using ${LOCALBASE}/etc/mail instead of /etc/mail
diff --git a/sendmail/distinfo b/sendmail/distinfo
new file mode 100644
index 0000000000..0143543a74
--- /dev/null
+++ b/sendmail/distinfo
@@ -0,0 +1,33 @@
+$NetBSD: distinfo,v 1.57 2015/11/03 23:27:20 agc Exp $
+
+SHA1 (sendmail.8.16.0.21.tar.gz) = cc58262708f1daed2365ee761ec9aa11b4bd07fe
+RMD160 (sendmail.8.16.0.21.tar.gz) = 0dc9db2a5f1e355578aa5434af778f7e59ff9a91
+SHA512 (sendmail.8.16.0.21.tar.gz) = faf6477255dea310cf5f8598f7ded9a3596abca92b538d9b4b09f757cbf8498855fb25ba8452994fb9ecea7928da4992da97a0456444f769cd05c304861ceddb
+Size (sendmail.8.16.0.21.tar.gz) = 2222770 bytes
+SHA1 (patch-aa) = bd1ab754f7146d002eaf8c0347e114b4049a7776
+SHA1 (patch-af) = d1a85e0004d55e203395ecbc55e8c98040626e08
+SHA1 (patch-ag) = f76de45c7e8d16207670e151265b7edbca4c045c
+SHA1 (patch-ah) = e6be09008b9230ffdd1560aaacbdbb2ee4fb8028
+SHA1 (patch-ai) = b8251931369bfc9c1ea534e7981bddf2e458fd11
+SHA1 (patch-aj) = e65e6fe44380de2f9c397c1a97677eb4ad285433
+SHA1 (patch-an) = 588dd34235b3fd0555bb4c645a441db721fc7c3e
+SHA1 (patch-ao) = 88dd76b71ad57a8d0efdb6e8518ff01689ecf634
+SHA1 (patch-ap) = 9c83d9ed1b4d8c851c106597638763515923a4ab
+SHA1 (patch-aq) = 4f6eea288f5ce146df67464d7ad8aa395eef3e3e
+SHA1 (patch-ar) = c519f1a9d0064de64343cbd5e369307263f33892
+SHA1 (patch-as) = 2aff1d452ef6fcc9e42a1c0175eac833f60f11d3
+SHA1 (patch-at) = 9b39751e19309928501ca9ad67d54f270708acaa
+SHA1 (patch-au) = ff5c2c274db49be75e532d7db3dbedde86948a1e
+SHA1 (patch-av) = 1b6bd4547930507ab67427bcf8a390c0afce0fb0
+SHA1 (patch-aw) = 9077b9fc4063bd1a66500b203d246bcddae8eb0f
+SHA1 (patch-ax) = adba9177404e10d5f461e1e8f0c4dd5840d78dd1
+SHA1 (patch-ay) = e6ba6b0fdb4c1d1df5dd7175d4d581ad9a76faae
+SHA1 (patch-az) = 592ec93f700723485a5969ae1f1836c64975d1d0
+SHA1 (patch-ba) = c190b11b9874f00a18b9c75b6e734f4a9dd3f68f
+SHA1 (patch-bb) = 6c86a60af25b02fc0389f1d40f59c5031d9679f1
+SHA1 (patch-bc) = 9e7346342dfe1ca5d84053b913df4be41a979683
+SHA1 (patch-bd) = 1a6d035c585838e771a1a677892b95bb82000a7b
+SHA1 (patch-be) = d2f3397b7880f23f8cbd5d3c4eb5ccfe6a6ca75b
+SHA1 (patch-bf) = 9c5faf5b38c18623e5ce4ffafc00a4430965e41a
+SHA1 (patch-bg) = 17b750d84333eacd39a23aa313d5ba24dc7d2156
+SHA1 (patch-libsm_notify.c) = 68f51ee752e5f1e948853053e6d72624ca73b475
diff --git a/sendmail/files/mailer.conf b/sendmail/files/mailer.conf
new file mode 100644
index 0000000000..a263f9b279
--- /dev/null
+++ b/sendmail/files/mailer.conf
@@ -0,0 +1,10 @@
+#	$NetBSD: mailer.conf,v 1.2 2000/07/24 04:22:32 itojun Exp $
+#
+# Execute the "real" sendmail program, named @@PREFIX@@/libexec/sendmail/sendmail
+#
+sendmail	@@PREFIX@@/libexec/sendmail/sendmail
+send-mail	@@PREFIX@@/libexec/sendmail/sendmail
+mailq		@@PREFIX@@/libexec/sendmail/sendmail
+newaliases	@@PREFIX@@/libexec/sendmail/sendmail
+hoststat	@@PREFIX@@/libexec/sendmail/sendmail
+purgestat	@@PREFIX@@/libexec/sendmail/sendmail
diff --git a/sendmail/files/netbsd-proto.mc b/sendmail/files/netbsd-proto.mc
new file mode 100644
index 0000000000..8b9d049298
--- /dev/null
+++ b/sendmail/files/netbsd-proto.mc
@@ -0,0 +1,66 @@
+# $NetBSD: netbsd-proto.mc,v 1.2 2014/06/20 05:24:32 jnemeth Exp $
+
+divert(-1)
+#
+# Copyright (c) 1994 Adam Glass
+# Copyright (c) 1983 Eric P. Allman
+# Copyright (c) 1988, 1993
+#	The Regents of the University of California.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#	This product includes software developed by the University of
+#	California, Berkeley and its contributors.
+# 4. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+#
+#  This is the prototype file for a configuration that supports SMTP
+#  connections via TCP and some commonly required features.
+#
+
+include(`../m4/cf.m4')
+VERSIONID(`@(#)netbsd-proto.mc	$Revision: 1.2 $')
+OSTYPE(bsd4.4)dnl
+DOMAIN(generic)dnl
+FEATURE(genericstable,DATABASE_MAP_TYPE` -o 'MAIL_SETTINGS_DIR`genericstable')
+FEATURE(mailertable,  DATABASE_MAP_TYPE` -o 'MAIL_SETTINGS_DIR`mailertable')
+FEATURE(virtusertable,DATABASE_MAP_TYPE` -o 'MAIL_SETTINGS_DIR`virtusertable')
+FEATURE(domaintable,  DATABASE_MAP_TYPE` -o 'MAIL_SETTINGS_DIR`domaintable')
+FEATURE(access_db,    DATABASE_MAP_TYPE` -T<TMPF>; -o 'MAIL_SETTINGS_DIR`access')
+FEATURE(`redirect')
+FEATURE(`no_default_msa')
+MAILER(local)dnl
+MAILER(smtp)dnl
+
+# Enable port 587 also to serve as local submission server
+DAEMON_OPTIONS(`Family=inet, address=127.0.0.1, Name=MTA, Modifiers=O, Port=smtp')dnl
+DAEMON_OPTIONS(`Family=inet, address=127.0.0.1, Name=MSA, Modifiers=O, Port=submission')dnl
+# Enable IPv6.  IPv6 is marked as optional so the configuration file
+# can be used on IPV4-only kernel as well.
+DAEMON_OPTIONS(`Family=inet6, address=::1, Name=MTA6, Modifiers=O, Port=smtp')dnl
+DAEMON_OPTIONS(`Family=inet6, address=::1, Name=MSA6, Modifiers=O, Port=submission')dnl
+# Above setup is outgoing service only, replace
+# 127.0.0.1 by 0.0.0.0  and  ::1 by :: to accept incoming mails.
diff --git a/sendmail/files/sendmail.sh b/sendmail/files/sendmail.sh
new file mode 100755
index 0000000000..0c50468570
--- /dev/null
+++ b/sendmail/files/sendmail.sh
@@ -0,0 +1,60 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: sendmail.sh,v 1.3 2014/06/15 20:48:49 jnemeth Exp $
+#
+
+# PROVIDE: mail
+# REQUIRE: LOGIN
+#	we make mail start late, so that things like .forward's are not
+#	processed until the system is fully operational
+
+
+. /etc/rc.subr
+
+name="sendmail"
+rcvar=$name
+pidfile="@VARBASE@/run/${name}.pid"
+required_files="/etc/mail/sendmail.cf"
+start_precmd="sendmail_precmd"
+extra_commands="reload"
+
+makemap="@PREFIX@/sbin/makemap"
+newaliases="@PREFIX@/bin/newaliases"
+smbin="@PREFIX@/libexec/sendmail/sendmail"
+check_files="aliases access genericstable virtusertable domaintable mailertable"
+sendmail_flags="-Lsm-mta -bd -q30m"
+command=$smbin
+
+sendmail_precmd()
+{
+	# check modifications on /etc/mail/ databases
+	for f in ${check_files}; do
+		if [ -r "/etc/mail/$f.db" ] && [ -r "/etc/mail/$f" ]; then
+			if [ ! "/etc/mail/$f" -ot "/etc/mail/$f.db" ]; then
+				echo \
+	    "${name}: /etc/mail/$f newer than /etc/mail/$f.db, regenerating"
+				if [ "x$f" = "xaliases" ]; then
+					${newaliases}
+				else
+					${makemap} hash \
+						/etc/mail/$f < /etc/mail/$f	
+				fi
+			fi
+		fi
+	done
+
+	# check existence on /etc/mail/ databases
+	for f in ${check_files}; do
+		if [ ! -r "/etc/mail/$f.db" ] && [ -r "/etc/mail/$f" ]; then
+			echo "${name}: /etc/mail/$f.db not present, generating"
+			if [ "x$f" = "xaliases" ]; then
+				${newaliases}
+			else
+				${makemap} hash /etc/mail/$f < /etc/mail/$f
+			fi
+		fi
+	done
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sendmail/files/site.config.m4 b/sendmail/files/site.config.m4
new file mode 100644
index 0000000000..c1f8ab1471
--- /dev/null
+++ b/sendmail/files/site.config.m4
@@ -0,0 +1,31 @@
+# $NetBSD: site.config.m4,v 1.11 2014/06/15 20:48:49 jnemeth Exp $
+
+# pathnames specific to pkgsrc
+#
+define(`confEBINDIR', `${PREFIX}/libexec/sendmail')
+define(`confMBINDIR', `${PREFIX}/libexec/sendmail')
+define(`confSBINDIR', `${PREFIX}/sbin')
+define(`confUBINDIR', `${PREFIX}/bin')
+define(`confHFDIR', `${PREFIX}/share/misc')
+define(`confINSTALL_RAWMAN', 'yes')
+define(`confDONT_INSTALL_CATMAN', 'yes')
+define(`confMANROOT', `${PREFIX}/${PKGMANDIR}/man')
+define(`confMANROOTMAN', `${PREFIX}/${PKGMANDIR}/man')
+define(`confMAN1EXT', `1')
+define(`confMAN3EXT', `3')
+define(`confMAN4EXT', `4')
+define(`confMAN5EXT', `5')
+define(`confMAN8EXT', `8')
+APPENDDEF(`confENVDEF', `-I${PREFIX}/include -DSMRSH_CMDDIR=\"${SMRSH_CMDDIR}\"')
+define(`confLDOPTS', `${LDFLAGS}')
+APPENDDEF(`confMAPDEF', `-DSOCKETMAP')
+
+# the following are handled by pkgsrc
+define(`confINST_DEP',`')
+define(`confNO_STATISTICS_INSTALL')
+
+# have libmilter use poll(2) instead of select(2)
+# XXX all supported systems should support poll(2), if one is discovered
+# that doesn't, we can revisit this
+APPENDDEF(`conf_libmilter_ENVDEF', `-DSM_CONF_POLL=1')
+
diff --git a/sendmail/files/site.config.m4-db2 b/sendmail/files/site.config.m4-db2
new file mode 100644
index 0000000000..e732aee1b7
--- /dev/null
+++ b/sendmail/files/site.config.m4-db2
@@ -0,0 +1,5 @@
+# $NetBSD: site.config.m4-db2,v 1.5 2004/08/30 20:16:28 adrianp Exp $
+
+# enable db2
+APPENDDEF(`confENVDEF', `-DNEWDB -I${BUILDLINK_DIR}/include/db2')
+APPENDDEF(`confLIBS', `-ldb2')
diff --git a/sendmail/files/site.config.m4-db4 b/sendmail/files/site.config.m4-db4
new file mode 100644
index 0000000000..b54caf8988
--- /dev/null
+++ b/sendmail/files/site.config.m4-db4
@@ -0,0 +1,5 @@
+# $NetBSD: site.config.m4-db4,v 1.2 2004/08/30 20:16:28 adrianp Exp $
+
+# enable db4
+APPENDDEF(`confENVDEF', `-DNEWDB -I${BUILDLINK_DIR}/include/db4')
+APPENDDEF(`confLIBS', `-ldb4')
diff --git a/sendmail/files/site.config.m4-ffr_tls b/sendmail/files/site.config.m4-ffr_tls
new file mode 100644
index 0000000000..9baf7c13d9
--- /dev/null
+++ b/sendmail/files/site.config.m4-ffr_tls
@@ -0,0 +1,5 @@
+# $NetBSD: site.config.m4-ffr_tls,v 1.1 2014/06/15 20:48:49 jnemeth Exp $
+
+# enable _FFR_TLS_1
+APPENDDEF(`conf_sendmail_ENVDEF', `-D_FFR_TLS_1')
+APPENDDEF(`conf_sendmail_ENVDEF', `-D_FFR_TLS_EC')
diff --git a/sendmail/files/site.config.m4-fpic b/sendmail/files/site.config.m4-fpic
new file mode 100644
index 0000000000..ca85047cb7
--- /dev/null
+++ b/sendmail/files/site.config.m4-fpic
@@ -0,0 +1,4 @@
+# $NetBSD: site.config.m4-fpic,v 1.1 2016/05/20 12:11:39 jperkin Exp $
+
+# Build with -fPIC on SunOS to ensure third parties can pull in libmilter.a
+APPENDDEF(`confCCOPTS', `-fPIC')
diff --git a/sendmail/files/site.config.m4-ldap b/sendmail/files/site.config.m4-ldap
new file mode 100644
index 0000000000..684af75d2b
--- /dev/null
+++ b/sendmail/files/site.config.m4-ldap
@@ -0,0 +1,6 @@
+# $NetBSD: site.config.m4-ldap,v 1.6 2008/08/13 15:41:29 manu Exp $
+
+# enable ldap
+APPENDDEF(`confMAPDEF', `-DLDAPMAP')
+APPENDDEF(`confMAPDEF', `-D_FFR_LDAP_NETWORK_TIMEOUT')
+APPENDDEF(`confLIBS', `-lldap -llber')
diff --git a/sendmail/files/site.config.m4-libresolv b/sendmail/files/site.config.m4-libresolv
new file mode 100644
index 0000000000..a3d35f6373
--- /dev/null
+++ b/sendmail/files/site.config.m4-libresolv
@@ -0,0 +1,4 @@
+# $NetBSD: site.config.m4-libresolv,v 1.1 2014/05/10 14:38:26 richard Exp $
+
+# add -lresolv to prevent linker unresolved symbols
+APPENDDEF(`confLIBS', `-lresolv')
diff --git a/sendmail/files/site.config.m4-milter b/sendmail/files/site.config.m4-milter
new file mode 100644
index 0000000000..086af75d2b
--- /dev/null
+++ b/sendmail/files/site.config.m4-milter
@@ -0,0 +1,4 @@
+# $NetBSD: site.config.m4-milter,v 1.2 2004/08/30 20:16:28 adrianp Exp $
+
+# enable milter
+APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')
diff --git a/sendmail/files/site.config.m4-sasl2 b/sendmail/files/site.config.m4-sasl2
new file mode 100644
index 0000000000..1d5a47c550
--- /dev/null
+++ b/sendmail/files/site.config.m4-sasl2
@@ -0,0 +1,8 @@
+# $NetBSD: site.config.m4-sasl2,v 1.3 2014/06/20 16:26:55 jnemeth Exp $
+
+# enable SASL 2
+APPENDDEF(`confENVDEF', `-DSASL=2')
+APPENDDEF(`conf_sendmail_LIBS', `-lsasl2')
+
+# for some strange reason SASL, and NAMED_RESN and MILTER are incompatible
+APPENDDEF(`confENVDEF', `-DNAMED_RESN=0')
diff --git a/sendmail/files/site.config.m4-starttls b/sendmail/files/site.config.m4-starttls
new file mode 100644
index 0000000000..8718173f6b
--- /dev/null
+++ b/sendmail/files/site.config.m4-starttls
@@ -0,0 +1,5 @@
+# $NetBSD: site.config.m4-starttls,v 1.6 2004/08/30 20:16:28 adrianp Exp $
+
+# enable STARTTLS
+APPENDDEF(`conf_sendmail_ENVDEF', `-DSTARTTLS')
+APPENDDEF(`conf_sendmail_LIBS', `-lssl -lcrypto')
diff --git a/sendmail/files/site.config.m4-stdbool b/sendmail/files/site.config.m4-stdbool
new file mode 100644
index 0000000000..acda05c3d6
--- /dev/null
+++ b/sendmail/files/site.config.m4-stdbool
@@ -0,0 +1,4 @@
+# $NetBSD: site.config.m4-stdbool,v 1.1 2014/06/15 20:48:49 jnemeth Exp $
+
+# PM: stdbool.h on SunOS needs -std=c99
+APPENDDEF(`confENVDEF', `-DSM_CONF_STDBOOL_H=1')
diff --git a/sendmail/files/site.config.m4-tcpwrappers b/sendmail/files/site.config.m4-tcpwrappers
new file mode 100644
index 0000000000..5c3e175f67
--- /dev/null
+++ b/sendmail/files/site.config.m4-tcpwrappers
@@ -0,0 +1,5 @@
+# $NetBSD: site.config.m4-tcpwrappers,v 1.4 2004/08/30 20:21:51 adrianp Exp $
+
+# enable tcpwrappers
+APPENDDEF(`confENVDEF', `-DTCPWRAPPERS')
+APPENDDEF(`conf_sendmail_LIBS', `-lwrap')
diff --git a/sendmail/files/site.config.m4-v6 b/sendmail/files/site.config.m4-v6
new file mode 100644
index 0000000000..6541cdbe64
--- /dev/null
+++ b/sendmail/files/site.config.m4-v6
@@ -0,0 +1,4 @@
+# $NetBSD: site.config.m4-v6,v 1.3 2004/08/30 20:16:28 adrianp Exp $
+
+# enable IPv6 
+APPENDDEF(`confENVDEF', `-DNETINET6')
diff --git a/sendmail/files/site.config.m4-v6-not-solaris b/sendmail/files/site.config.m4-v6-not-solaris
new file mode 100644
index 0000000000..233493713d
--- /dev/null
+++ b/sendmail/files/site.config.m4-v6-not-solaris
@@ -0,0 +1,4 @@
+# $NetBSD: site.config.m4-v6-not-solaris,v 1.2 2004/08/30 20:16:28 adrianp Exp $
+
+# enable IPv6 - not Solaris
+APPENDDEF(`confENVDEF', `-DNEEDSGETIPNODE')
diff --git a/sendmail/files/sm_os_netbsd.h b/sendmail/files/sm_os_netbsd.h
new file mode 100644
index 0000000000..aa1c5ee01c
--- /dev/null
+++ b/sendmail/files/sm_os_netbsd.h
@@ -0,0 +1,29 @@
+/*
+ *	$NetBSD: sm_os_netbsd.h,v 1.1 2014/06/15 20:48:49 jnemeth Exp $
+ */
+
+/*
+**  Platform definitions for NetBSD
+*/
+
+#define SM_OS_NAME	"netbsd"
+
+#define SM_CONF_SYS_CDEFS_H	1
+
+#include <sys/param.h> /* defines __NetBSD_version__ */
+#if __NetBSD_version__ >= 104000300
+   /* 1.4.3 and later have strlcpy()/strlcat() */
+#  ifndef SM_CONF_STRL
+#     define SM_CONF_STRL		1
+#  endif
+#endif
+
+#ifndef SM_CONF_SHM
+# define SM_CONF_SHM	1
+#endif /* SM_CONF_SHM */
+#ifndef SM_CONF_SEM
+# define SM_CONF_SEM	0
+#endif /* SM_CONF_SEM */
+#ifndef SM_CONF_MSG
+# define SM_CONF_MSG	1
+#endif /* SM_CONF_MSG */
diff --git a/sendmail/files/smf/manifest.xml b/sendmail/files/smf/manifest.xml
new file mode 100644
index 0000000000..e52b7bd3c3
--- /dev/null
+++ b/sendmail/files/smf/manifest.xml
@@ -0,0 +1,284 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+    CDDL HEADER START
+   
+    The contents of this file are subject to the terms of the
+    Common Development and Distribution License (the "License").
+    You may not use this file except in compliance with the License.
+   
+    You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+    or http://www.opensolaris.org/os/licensing.
+    See the License for the specific language governing permissions
+    and limitations under the License.
+   
+    When distributing Covered Code, include this CDDL HEADER in each
+    file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+    If applicable, add the following below this CDDL HEADER, with the
+    fields enclosed by brackets "[]" replaced with your own identifying
+    information: Portions Copyright [yyyy] [name of copyright owner]
+   
+    CDDL HEADER END
+   
+    Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+    Use is subject to license terms.
+
+    Copyright 2016 Hans Rosenfeld <rosenfeld%grumpf.hope-2000.org@localhost>
+
+    NOTE:  This service manifest is not editable; its contents will
+    be overwritten by package or patch operations, including
+    operating system upgrade.  Make customizations in a different
+    file.
+-->
+
+<service_bundle type='manifest' name='@SMF_NAME@'>
+
+<service
+	name='@SMF_PREFIX@/@SMF_NAME@'
+	type='service'
+	version='1'>
+
+	<dependency
+	    name='fs-local'
+	    grouping='require_all'
+	    restart_on='none'
+	    type='service'>
+		<service_fmri value='svc:/system/filesystem/local' />
+	</dependency>
+
+	<dependency
+	    name='network-service'
+	    grouping='require_all'
+	    restart_on='none'
+	    type='service'>
+		<service_fmri value='svc:/network/service' />
+	</dependency>
+
+	<dependency
+	    name='name-services'
+	    grouping='require_all'
+	    restart_on='refresh'
+	    type='service'>
+		<service_fmri value='svc:/milestone/name-services' />
+	</dependency>
+
+	<dependency
+	    name='identity'
+	    grouping='optional_all'
+	    restart_on='refresh'
+	    type='service'>
+		<service_fmri value='svc:/system/identity:domain' />
+	</dependency>
+
+	<dependency
+	    name='system-log'
+	    grouping='optional_all'
+	    restart_on='none'
+	    type='service'>
+		<service_fmri value='svc:/system/system-log' />
+	</dependency>
+
+	<property_group name='firewall_context' type='com.sun,fw_definition'>
+		<propval name='name' type='astring' value='smtp' />
+	</property_group>
+
+
+	<instance name='mta' enabled='false'>
+
+		<dependency
+		    name='config-file'
+		    grouping='require_all'
+		    restart_on='refresh'
+		    type='path'>
+			<service_fmri
+			    value='file://localhost/etc/mail/sendmail.cf' />
+		</dependency>
+
+		<dependency
+		    name='nsswitch'
+		    grouping='require_all'
+		    restart_on='refresh'
+		    type='path'>
+			<service_fmri
+			    value='file://localhost/etc/nsswitch.conf' />
+		</dependency>
+
+		<!-- If spamassassin is enabled, wait for it. -->
+		<dependency
+		    name='spamassassin'
+		    grouping='optional_all'
+		    restart_on='none'
+		    type='service'>
+			<service_fmri value='svc:/@SMF_PREFIX@/spamassassin' />
+		</dependency>
+
+		<dependency
+		    name='spamass-milter'
+		    grouping='optional_all'
+		    restart_on='none'
+		    type='service'>
+			<service_fmri value='svc:/@SMF_PREFIX@/spamass-milter' />
+		</dependency>
+                
+		<!--
+		If autofs is enabled, wait for it to get users' home
+		directories.
+		-->
+		<dependency
+		    name='autofs'
+		    grouping='optional_all'
+		    restart_on='none'
+		    type='service'>
+			<service_fmri value='svc:/system/filesystem/autofs' />
+		</dependency>
+
+		<dependent
+			name='smtp-sendmail_multi-user'
+			grouping='optional_all'
+			restart_on='none'>
+				<service_fmri
+				    value='svc:/milestone/multi-user' />
+		</dependent>
+
+		<!--
+		Sendmail is hard-coded to sleep for 60 seconds if it cannot
+		determine the FQHN, so the timeout for start must be longer
+		than that.  For details, see
+		http://www.sendmail.org/vendor/sun/differences.html#3.2
+		-->
+
+		<exec_method
+			type='method'
+			name='start'
+			exec='@PREFIX@/@SMF_METHOD_FILE.sendmail@ start'
+			timeout_seconds='120' />
+
+		<exec_method
+			type='method'
+			name='stop'
+			exec='@PREFIX@/@SMF_METHOD_FILE.sendmail@ stop %{restarter/contract}'
+			timeout_seconds='60' />
+
+		<exec_method
+			type='method'
+			name='refresh'
+			exec='@PREFIX@/@SMF_METHOD_FILE.sendmail@ refresh'
+			timeout_seconds='60' />
+
+		<property_group name='firewall_config' type='com.sun,fw_configuration'>
+			<propval name='policy' type='astring' value='use_global' />
+			<propval name='block_policy' type='astring'
+				value='use_global' />
+			<propval name='apply_to' type='astring' value='' />
+			<propval name='apply_to_6' type='astring' value='' />
+			<propval name='exceptions' type='astring' value='' />
+			<propval name='exceptions_6' type='astring' value='' />
+			<propval name='target' type='astring' value='' />
+			<propval name='target_6' type='astring' value='' />
+			<propval name='value_authorization' type='astring'
+				value='solaris.smf.value.firewall.config' />
+		</property_group>
+
+		<property_group name='startd' type='framework'>
+			<propval name='ignore_error' type='astring'
+			    value='core,signal' />
+		</property_group>
+
+		<property_group name='general' type='framework'>
+			<propval name='action_authorization' type='astring'
+				value='solaris.smf.manage.sendmail' />
+		</property_group>
+
+		<property_group name='config' type='application'>
+			<propval name='include_info'
+				type='boolean' value='false' />
+			<propval name='local_only'
+				type='boolean' value='true' />
+			<propval name='path_to_sendmail_mc'
+				type='astring'
+                                value='@PREFIX@/share/sendmail/cf/sendmail.mc' />
+			<propval name='value_authorization' type='astring'
+				value='solaris.smf.value.sendmail' />
+		</property_group>
+			
+		<template>
+			<common_name>
+				<loctext xml:lang='C'>
+				sendmail SMTP mail transfer agent
+				</loctext>
+			</common_name>
+			<documentation>
+				<manpage title='sendmail' section='8'
+				    manpath='@PREFIX@/@PKGMANDIR@' />
+			</documentation>
+		</template>
+
+	</instance>
+
+	<instance name='msp' enabled='false'>
+
+		<dependency
+		    name='config-file'
+		    grouping='require_all'
+		    restart_on='refresh'
+		    type='path'>
+			<service_fmri
+			    value='file://localhost/etc/mail/submit.cf' />
+		</dependency>
+
+		<!--
+		Sendmail is hard-coded to sleep for 60 seconds if it cannot
+		determine the FQHN, so the timeout for start must be longer
+		than that.  For details, see
+		http://www.sendmail.org/vendor/sun/differences.html#3.2
+		-->
+
+		<exec_method
+			type='method'
+			name='start'
+			exec='@PREFIX@/@SMF_METHOD_FILE.smmsp@ start'
+			timeout_seconds='120' />
+
+		<exec_method
+			type='method'
+			name='stop'
+			exec='@PREFIX@/@SMF_METHOD_FILE.smmsp@ stop %{restarter/contract}'
+			timeout_seconds='60' />
+
+		<exec_method
+			type='method'
+			name='refresh'
+			exec='@PREFIX@/@SMF_METHOD_FILE.smmsp@ refresh'
+			timeout_seconds='60' />
+
+		<property_group name='general' type='framework'>
+			<propval name='action_authorization' type='astring'
+				value='solaris.smf.manage.sendmail' />
+		</property_group>
+
+		<property_group name='config' type='application'>
+			<propval name='value_authorization' type='astring'
+				value='solaris.smf.value.sendmail' />
+			<propval name='path_to_submit_mc'
+				type='astring'
+                                value='@PREFIX@/share/sendmail/cf/submit.mc' />
+		</property_group>
+			
+		<template>
+			<common_name>
+				<loctext xml:lang='C'>
+				sendmail SMTP client queue runner
+				</loctext>
+			</common_name>
+			<documentation>
+				<manpage title='sendmail' section='8'
+				    manpath='@PREFIX@/@PKGMANDIR@' />
+			</documentation>
+		</template>
+
+	</instance>
+	<stability value='Unstable' />
+
+</service>
+
+</service_bundle>
diff --git a/sendmail/files/smf/sendmail.sh b/sendmail/files/smf/sendmail.sh
new file mode 100644
index 0000000000..7a2be3f131
--- /dev/null
+++ b/sendmail/files/smf/sendmail.sh
@@ -0,0 +1,131 @@
+#!/sbin/sh
+#
+# $NetBSD: sendmail.sh,v 1.1 2016/12/16 16:07:29 hans Exp $
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+. /lib/svc/share/smf_include.sh
+. @PREFIX@/lib/svc/method/sendmail_include
+
+ERRMSG1='WARNING: /var/mail is NFS-mounted without setting actimeo=0,'
+ERRMSG2='this can cause mailbox locking and access problems.'
+SERVER_PID_FILE="@VARBASE@/run/sendmail.pid"
+ALIASES_FILE="/etc/mail/aliases"
+SENDMAIL_CF="/etc/mail/sendmail.cf"
+
+case "$1" in 
+'refresh')
+        [ -f $SERVER_PID_FILE ] && kill -1 `head -1 $SERVER_PID_FILE`
+        ;;
+
+'start')
+	exist_or_exit $SENDMAIL
+	if [ ! -d @VARBASE@/spool/mqueue ]; then
+		/usr/bin/mkdir -m 0750 @VARBASE@/spool/mqueue
+		/usr/bin/chown root:bin @VARBASE@/spool/mqueue
+	fi
+	if [ ! -f $ALIASES_FILE.db ] && [ ! -f $ALIASES_FILE.dir ] \
+	    && [ ! -f $ALIASES_FILE.pag ]; then
+		@PREFIX@/bin/newaliases
+	fi
+	MODE="-bd"
+	[ -f $DEFAULT_FILE ] && . $DEFAULT_FILE
+	#
+	# * MODE should be "-bd" or null (MODE= or MODE="") or
+	#   left alone.  Anything else and you're on your own.
+	# * QUEUEOPTION should be "p" or null (as above).
+	# * QUEUEINTERVAL should be set to some legal value;
+	#   sanity checks are done below.
+	# * OPTIONS are catch-alls; set with care.
+	#
+	if [ -n "$QUEUEOPTION" -a "$QUEUEOPTION" != "p" ]; then
+		QUEUEOPTION=""
+	fi
+	if [ -z "$QUEUEOPTION" -o -n "$QUEUEINTERVAL" ]; then
+		check_queue_interval_syntax $QUEUEINTERVAL
+		QUEUEINTERVAL=$answer
+	fi
+
+	local=`/usr/bin/svcprop -p config/local_only $SMF_FMRI 2>/dev/null`
+	if [ $? -eq 0 -a "$local" = "true" ]; then
+		MODE="-bl"
+	fi
+	sendmail_path=`svcprop -p config/path_to_sendmail_mc $SMF_FMRI \
+	    2>/dev/null`
+	if [ $? -eq 0 -a -n "$sendmail_path" ]; then
+		turn_m4_crank "$SENDMAIL_CF" "$sendmail_path"
+	fi
+	exist_or_exit "$SENDMAIL_CF"
+
+	$SENDMAIL $MODE -q$QUEUEOPTION$QUEUEINTERVAL $OPTIONS &
+
+	#
+	# ETRN_HOSTS should be of the form
+	# "s1:c1.1,c1.2        s2:c2.1 s3:c3.1,c3.2,c3.3"
+	# i.e., white-space separated groups of server:client where
+	# client can be one or more comma-separated names; N.B. that
+	# the :client part is optional; see etrn(1M) for details.
+	# server is the name of the server to prod; a mail queue run
+	# is requested for each client name.  This is comparable to
+	# running "/usr/lib/sendmail -qRclient" on the host server.
+	#
+	# See RFC 1985 for more information.
+	#
+	for i in $ETRN_HOSTS; do
+		SERVER=`echo $i | /usr/bin/sed -e 's/:.*$//'`
+		CLIENTS=`echo $i | /usr/bin/sed -n -e 's/,/ /g' \
+		    -e '/:/s/^.*://p'`
+		/usr/sbin/etrn -b $SERVER $CLIENTS >/dev/null 2>&1 &
+	done
+
+	if /usr/bin/nawk 'BEGIN{s = 1}
+	    $2 == "/var/mail" && $3 == "nfs" && $4 !~ /actimeo=0/ &&
+	    $4 !~ /noac/{s = 0} END{exit s}' /etc/mnttab; then
+
+		/usr/bin/logger -p mail.crit "$ERRMSG1"
+		/usr/bin/logger -p mail.crit "$ERRMSG2"
+	fi
+	;;
+
+'stop')
+	[ -f $SERVER_PID_FILE ] && check_and_kill $SERVER_PID_FILE
+	# Need to kill the entire service contract to kill all sendmail related
+	# processes
+	smf_kill_contract $2 TERM 1 30
+	ret=$?
+	[ $ret -eq 1 ] && exit 1
+
+	# Since sendmail spawns user processes out of .forward files, it is
+	# possible that some of these are not responding to TERM.  If the
+	# contract did not empty after TERM, move on to KILL.
+	if [ $ret -eq 2 ] ; then
+		smf_kill_contract $2 KILL 1
+	fi
+	;;
+
+*)
+	echo "Usage: $0 { start | stop | refresh }"
+	exit 1
+	;;
+esac
+exit 0
diff --git a/sendmail/files/smf/sendmail_include.sh b/sendmail/files/smf/sendmail_include.sh
new file mode 100644
index 0000000000..e705cc3210
--- /dev/null
+++ b/sendmail/files/smf/sendmail_include.sh
@@ -0,0 +1,103 @@
+#!/sbin/sh
+#
+# $NetBSD: sendmail_include.sh,v 1.1 2016/12/16 16:07:29 hans Exp $
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+DEFAULT_FILE="/etc/default/sendmail"
+SENDMAIL="@PREFIX@/libexec/sendmail/sendmail"
+PATH="/usr/bin:/usr/sbin:/usr/ccs/bin"
+export PATH
+
+check_queue_interval_syntax()
+{
+	default="15m"
+	if [ $# -lt 1 ]; then
+		answer=$default
+		return
+	fi
+	if echo $1 | egrep '^([0-9]*[1-9][0-9]*[smhdw])+$' >/dev/null 2>&1; then
+		answer=$1
+	else
+		answer=$default
+	fi
+}
+
+check_and_kill()
+{
+	PID=`head -1 $1`
+	kill -0 $PID > /dev/null 2>&1
+	[ $? -eq 0 ] && kill $PID
+}
+
+exist_or_exit()
+{
+	if [ ! -f $1 ]; then
+		echo "$1 does not exist" >&2
+		exit $SMF_EXIT_ERR_CONFIG
+	fi
+}
+
+turn_m4_crank()
+{
+	# expected to be called with two arguments: .cf path & path to m4 file
+	[ $# -lt 2 ] && return
+	cf_path=$1
+	m4_path=$2
+	if [ "$m4_path" = "_DONT_TOUCH_THIS" ]; then
+		if [ -f "${cf_path}.old" ]; then
+			mv "$cf_path" "${cf_path}.new"
+			[ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+			mv "${cf_path}.old" "$cf_path"
+			[ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+		fi
+		#
+		# If ${cf_path}.old does not exist, assume it was taken care
+		# of on a previous run.
+		#
+	else
+		case "$m4_path" in
+		/*)	;;	# absolute path
+		*)	return;;
+		esac
+		exist_or_exit "$m4_path"
+		cd `dirname "$m4_path"`
+		base=`basename "$m4_path"`
+		name=`basename "$m4_path" .mc`
+		info=`svcprop -p config/include_info $SMF_FMRI 2>/dev/null`
+		if [ "$info" = "true" ]; then
+			m4flags=""
+		else
+			m4flags="-DSUN_HIDE_INTERNAL_DETAILS"
+		fi
+		m4 $m4flags @PREFIX@/share/sendmail/m4/cf.m4 "$base" > "${name}.cf"
+		[ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+		cmp -s "${name}.cf" "$cf_path" || (
+			cp "${name}.cf" "${cf_path}.tmp" &&
+			chown root:bin "${cf_path}.tmp" &&
+			chmod 444 "${cf_path}.tmp" &&
+			mv "${cf_path}.tmp" "$cf_path"
+		)
+		[ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+	fi
+}
diff --git a/sendmail/files/smf/smmsp.sh b/sendmail/files/smf/smmsp.sh
new file mode 100644
index 0000000000..f172023317
--- /dev/null
+++ b/sendmail/files/smf/smmsp.sh
@@ -0,0 +1,82 @@
+#!/sbin/sh
+#
+# $NetBSD: smmsp.sh,v 1.1 2016/12/16 16:07:29 hans Exp $
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+. /lib/svc/share/smf_include.sh
+. @PREFIX@/lib/svc/method/sendmail_include
+
+CLIENT_PID_FILE="@VARBASE@/spool/clientmqueue/sm-client.pid"
+SUBMIT_CF="/etc/mail/submit.cf"
+
+case "$1" in 
+'refresh')
+        [ -f $CLIENT_PID_FILE ] && kill -1 `head -1 $CLIENT_PID_FILE`
+        ;;
+
+'start')
+	exist_or_exit $SENDMAIL
+	[ -f $DEFAULT_FILE ] && . $DEFAULT_FILE
+	#
+	# * CLIENTQUEUEINTERVAL should be set to some legal value;
+	#   sanity checks are done below.
+	# * CLIENTOPTIONS are catch-alls; set with care.
+	#
+	check_queue_interval_syntax $CLIENTQUEUEINTERVAL
+	CLIENTQUEUEINTERVAL=$answer
+
+	submit_path=`svcprop -p config/path_to_submit_mc $SMF_FMRI 2>/dev/null`
+	if [ $? -eq 0 -a -n "$submit_path" ]; then
+		turn_m4_crank "$SUBMIT_CF" "$submit_path"
+	fi
+	exist_or_exit "$SUBMIT_CF"
+
+	$SENDMAIL -Ac -q$CLIENTQUEUEINTERVAL $CLIENTOPTIONS &
+	;;
+
+'stop')
+	if [ -f $CLIENT_PID_FILE ]; then
+		check_and_kill $CLIENT_PID_FILE
+		rm -f $CLIENT_PID_FILE
+	fi
+	# Need to kill the entire service contract to kill all sendmail related
+	# processes
+	smf_kill_contract $2 TERM 1 30
+	ret=$?
+	[ $ret -eq 1 ] && exit 1
+
+	# Sendmail can take its time responding to SIGTERM, as it waits for
+	# things like child processes and SMTP connections to clean up.  If
+	# the contract did not empty after TERM, move on to KILL.
+	if [ $ret -eq 2 ] ; then
+		smf_kill_contract $2 KILL 1
+	fi
+	;;
+
+*)
+	echo "Usage: $0 { start | stop | refresh }"
+	exit 1
+	;;
+esac
+exit 0
diff --git a/sendmail/files/smmsp.sh b/sendmail/files/smmsp.sh
new file mode 100755
index 0000000000..4a561c97f5
--- /dev/null
+++ b/sendmail/files/smmsp.sh
@@ -0,0 +1,30 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: smmsp.sh,v 1.3 2014/06/15 20:48:49 jnemeth Exp $
+#
+
+# REQUIRE: mail
+
+#	The only function of the smmsp process is to push locally
+#	collected mail (which got stuck in the local client queue)
+#	to a more fully functional smtp relay.  It is not a fully
+#	functional smtp daemon.
+#
+#	It can, however, be used as a completely unprivileged
+#	replacement for hosts that were previously using a "null
+#	client" configuration and a smart relay.
+
+. /etc/rc.subr
+
+name="smmsp"
+rcvar=$name
+pidfile="@VARBASE@/spool/clientmqueue/sm-client.pid"
+required_files="/etc/mail/submit.cf"
+extra_commands="reload"
+
+smbin="@PREFIX@/libexec/sendmail/sendmail"
+smmsp_flags="-Lsm-msp-queue -Ac -q30m"
+command=$smbin
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sendmail/options.mk b/sendmail/options.mk
new file mode 100644
index 0000000000..f9bf831aca
--- /dev/null
+++ b/sendmail/options.mk
@@ -0,0 +1,58 @@
+# $NetBSD: options.mk,v 1.23 2015/07/11 10:08:32 jnemeth Exp $
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.sendmail
+PKG_SUPPORTED_OPTIONS=	inet6 db2 db4 ldap sasl tls tcpwrappers
+PKG_SUPPORTED_OPTIONS+=	sendmail-ffr-tls
+PKG_SUGGESTED_OPTIONS=	inet6 tcpwrappers tls
+
+PKG_OPTIONS_LEGACY_OPTS+=	starttls:tls ffr_tls_1:sendmail-ffr-tls
+
+.include "../../mk/bsd.options.mk"
+
+###
+### Berkeley DB version 2/4 format for on disk databases e.g. aliases
+###
+.if !empty(PKG_OPTIONS:Mdb2)
+.  include "../../databases/db/buildlink3.mk"
+.elif !empty(PKG_OPTIONS:Mdb4)
+.  include "../../databases/db4/buildlink3.mk"
+.endif
+
+###
+### Use OpenLDAP for remote database access
+###
+.if !empty(PKG_OPTIONS:Mldap)
+.  include "../../databases/openldap-client/buildlink3.mk"
+.endif
+
+###
+### Use SASL/v2 for SMTP AUTH
+###
+.if !empty(PKG_OPTIONS:Msasl)
+.  include "../../security/cyrus-sasl/buildlink3.mk"
+.endif
+
+###
+### Use OpenSSL libraries for SMTP STARTTLS support
+###
+.if !empty(PKG_OPTIONS:Mtls)
+.  include "../../security/openssl/buildlink3.mk"
+.endif
+
+###
+### 'For Future Release' FFR_TLS_* options: CipherList, multiple certs
+###
+# Nothing to do here, activation is done in Makefile
+
+###
+### Use tcpwrappers for network access control to sendmail
+###
+.if !empty(PKG_OPTIONS:Mtcpwrappers)
+.  include "../../security/tcp_wrappers/buildlink3.mk"
+.endif
+
+###
+### IPv6 support.
+###
+.if !empty(PKG_OPTIONS:Minet6)
+.endif
diff --git a/sendmail/patches/patch-aa b/sendmail/patches/patch-aa
new file mode 100644
index 0000000000..9a97251b55
--- /dev/null
+++ b/sendmail/patches/patch-aa
@@ -0,0 +1,22 @@
+$NetBSD: patch-aa,v 1.21 2014/06/15 20:48:50 jnemeth Exp $
+
+--- devtools/OS/NetBSD.orig	2014-03-06 17:31:29.000000000 +0000
++++ devtools/OS/NetBSD
+@@ -5,15 +5,11 @@ dnl	Place personal settings in devtools/
+ 
+ define(`confMAPDEF', `-DNEWDB -DNIS -DMAP_REGEX')
+ define(`confLIBS', `-lutil')
+-define(`confENVDEF', ` -DNETISO')
++define(`confSM_OS_HEADER', `sm_os_netbsd')
+ define(`confDEPEND_TYPE', `CC-M')
+-define(`confSBINGRP', `wheel')
+-define(`confUBINOWN', `root')
+-define(`confUBINGRP', `wheel')
+-define(`confMANOWN', `root')
+-define(`confMANGRP', `wheel')
+ define(`confMAN1EXT', `0')
+ define(`confMAN3EXT', `0')
+ define(`confMAN4EXT', `0')
+ define(`confMAN5EXT', `0')
+ define(`confMAN8EXT', `0')
++define(`conf_sendmail_ENVDEF', `-D_FFR_USE_GETPWNAM_ERRNO=1')
diff --git a/sendmail/patches/patch-af b/sendmail/patches/patch-af
new file mode 100644
index 0000000000..04562cb370
--- /dev/null
+++ b/sendmail/patches/patch-af
@@ -0,0 +1,43 @@
+$NetBSD: patch-af,v 1.12 2014/06/15 20:48:50 jnemeth Exp $
+
+--- sendmail/conf.c.orig	2017-02-17 03:44:29.000000000 +0900
++++ sendmail/conf.c	2018-04-01 06:41:02.126385724 +0900
+@@ -43,6 +43,11 @@ SM_RCSID("@(#)$Id: conf.c,v 8.1192 2014-
+ #if HASULIMIT && defined(HPUX11)
+ # include <ulimit.h>
+ #endif /* HASULIMIT && defined(HPUX11) */
++
++#if !HAS_GETHOSTBYNAME2
++extern struct __res_state sm_res;
++#endif
++
+ #if STARTTLS
+ # include "tls.h"
+ #endif
+@@ -4267,13 +4272,13 @@ sm_getipnodebyname(name, family, flags, 
+ 	if (family == AF_INET6)
+ 	{
+ 		/* From RFC2133, section 6.1 */
+-		resv6 = bitset(RES_USE_INET6, _res.options);
+-		_res.options |= RES_USE_INET6;
++		resv6 = bitset(RES_USE_INET6, sm_res.options);
++		sm_res.options |= RES_USE_INET6;
+ 	}
+ 	SM_SET_H_ERRNO(0);
+ 	h = gethostbyname(name);
+ 	if (!resv6)
+-		_res.options &= ~RES_USE_INET6;
++		sm_res.options &= ~RES_USE_INET6;
+ 
+ 	/* the function is supposed to return only the requested family */
+ 	if (h != NULL && h->h_addrtype != family)
+@@ -4488,7 +4493,8 @@ sm_gethostbyaddr(addr, len, type)
+ 
+ #if NETINET6
+ 	if (type == AF_INET6 &&
+-	    IN6_IS_ADDR_UNSPECIFIED((struct in6_addr *) addr))
++	    (IN6_IS_ADDR_UNSPECIFIED((struct in6_addr *) addr) ||
++	    IN6_IS_ADDR_LINKLOCAL((struct in6_addr *) addr)))
+ 	{
+ 		/* Avoid reverse lookup for IPv6 unspecified address */
+ 		SM_SET_H_ERRNO(HOST_NOT_FOUND);
diff --git a/sendmail/patches/patch-ag b/sendmail/patches/patch-ag
new file mode 100644
index 0000000000..89bd83ec07
--- /dev/null
+++ b/sendmail/patches/patch-ag
@@ -0,0 +1,26 @@
+$NetBSD: patch-ag,v 1.14 2012/03/12 12:53:13 fhajny Exp $
+
+--- include/sm/conf.h.orig	2011-05-03 16:24:00.000000000 +0000
++++ include/sm/conf.h
+@@ -381,7 +381,7 @@ typedef int		pid_t;
+ #   ifndef __svr4__
+ #    define __svr4__		/* use all System V Release 4 defines below */
+ #   endif /* ! __svr4__ */
+-#   if SOLARIS >= 21100
++#   if SOLARIS >= 21100 && defined(SOLARIS_HAS_PATHS_H)
+ #    include <paths.h>
+ #   endif /* SOLARIS >= 21100 */
+ #   ifndef _PATH_VARRUN
+@@ -818,7 +818,11 @@ extern unsigned int sleepX __P((unsigned
+ #  ifndef LA_TYPE
+ #   define LA_TYPE	LA_SUBR
+ #  endif /* ! LA_TYPE */
+-#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
++#  if defined(__NetBSD__) && (__NetBSD_Version__ > 299000900)
++#   define SFS_TYPE	SFS_STATVFS     /* use <sys/statvfs.h> statfs() impl */
++#  else
++#   define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
++#  endif
+ #  define SPT_TYPE	SPT_PSSTRINGS	/* use PS_STRINGS pointer */
+ # endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)*/
+ 
diff --git a/sendmail/patches/patch-ah b/sendmail/patches/patch-ah
new file mode 100644
index 0000000000..e26eccd812
--- /dev/null
+++ b/sendmail/patches/patch-ah
@@ -0,0 +1,38 @@
+$NetBSD: patch-ah,v 1.2 2005/02/10 22:17:24 adrianp Exp $
+
+--- smrsh/smrsh.8.orig	2004-08-06 04:55:35.000000000 +0100
++++ smrsh/smrsh.8
+@@ -39,7 +39,7 @@ Briefly,
+ .I smrsh
+ limits programs to be in a single directory,
+ by default
+-/usr/adm/sm.bin,
++@@SMRSH_CMDDIR@@,
+ allowing the system administrator to choose the set of acceptable commands,
+ and to the shell builtin commands ``exec'', ``exit'', and ``echo''.
+ It also rejects any commands with the characters
+@@ -56,7 +56,7 @@ so forwarding to ``/usr/ucb/vacation'',
+ and
+ ``vacation''
+ all actually forward to
+-``/usr/adm/sm.bin/vacation''.
++``@@SMRSH_CMDDIR@@/vacation''.
+ .PP
+ System administrators should be conservative about populating
+ the sm.bin directory.
+@@ -86,13 +86,9 @@ to adjust the default search path
+ (defaults to ``/bin:/usr/bin:/usr/ucb'')
+ and/or \-DSMRSH_CMDDIR=\e"\fIdir\fP\e"
+ to change the default program directory
+-(defaults to ``/usr/adm/sm.bin'').
++(defaults to ``@@SMRSH_CMDDIR@@'').
+ .SH FILES
+-/usr/adm/sm.bin \- default directory for restricted programs on most OSs
+-.PP
+-/var/adm/sm.bin \- directory for restricted programs on HP UX and Solaris
+-.PP
+-/usr/libexec/sm.bin \- directory for restricted programs on FreeBSD (>= 3.3) and DragonFly BSD
++@@SMRSH_CMDDIR@@ \- default directory for restricted programs
+ 
+ .SH SEE ALSO
+ sendmail(8)
diff --git a/sendmail/patches/patch-ai b/sendmail/patches/patch-ai
new file mode 100644
index 0000000000..a3b2f716b2
--- /dev/null
+++ b/sendmail/patches/patch-ai
@@ -0,0 +1,25 @@
+$NetBSD: patch-ai,v 1.9 2014/06/15 20:48:50 jnemeth Exp $
+
+--- sendmail/mci.c.orig	2017-02-17 03:44:29.000000000 +0900
++++ sendmail/mci.c	2018-04-01 06:42:03.039662553 +0900
+@@ -20,6 +20,8 @@ SM_RCSID("@(#)$Id: mci.c,v 8.225 2013-11
+ #endif /* NETINET || NETINET6 */
+ 
+ #include <dirent.h>
++#include <limits.h>
++
+ #if STARTTLS
+ # include <tls.h>
+ #endif
+@@ -788,7 +790,11 @@ mci_lock_host_statfile(mci)
+ {
+ 	int save_errno = errno;
+ 	int retVal = EX_OK;
++#if defined(PATH_MAX)
++	char fname[PATH_MAX];
++#else
+ 	char fname[MAXPATHLEN];
++#endif
+ 
+ 	if (HostStatDir == NULL || mci->mci_host == NULL)
+ 		return EX_OK;
diff --git a/sendmail/patches/patch-aj b/sendmail/patches/patch-aj
new file mode 100644
index 0000000000..cda1a0591a
--- /dev/null
+++ b/sendmail/patches/patch-aj
@@ -0,0 +1,18 @@
+$NetBSD: patch-aj,v 1.4 2006/07/07 18:06:28 tv Exp $
+
+--- cf/cf/Makefile.orig	2005-06-13 22:16:34.000000000 -0400
++++ cf/cf/Makefile
+@@ -25,10 +25,10 @@ CHMOD=	chmod
+ ROMODE=	444
+ RM=	rm -f
+ # use our own install program; should be really confINSTALL
+-INSTALL=../../devtools/bin/install.sh
++INSTALL=@@INSTALL@@
+ # CF file ownership/permissions
+-CFOWN=root
+-CFGRP=bin
++CFOWN=@@BINOWN@@
++CFGRP=@@BINGRP@@
+ CFMODE=0444
+ 
+ 
diff --git a/sendmail/patches/patch-an b/sendmail/patches/patch-an
new file mode 100644
index 0000000000..96fe266d80
--- /dev/null
+++ b/sendmail/patches/patch-an
@@ -0,0 +1,49 @@
+$NetBSD: patch-an,v 1.2 2014/06/20 05:24:32 jnemeth Exp $
+
+--- sendmail/Makefile.m4.orig	2017-02-17 03:44:29.000000000 +0900
++++ sendmail/Makefile.m4	2018-04-01 06:43:48.827414666 +0900
+@@ -4,7 +4,7 @@ include(confBUILDTOOLSDIR`/M4/switch.m4'
+ define(`confREQUIRE_LIBSM', `true')
+ define(`confREQUIRE_SM_OS_H', `true')
+ bldPRODUCT_START(`executable', `sendmail')
+-define(`bldBIN_TYPE', `G')
++dnl define(`bldBIN_TYPE', `G')
+ define(`bldINSTALL_DIR', `')
+ define(`bldSOURCES', `main.c alias.c arpadate.c bf.c collect.c conf.c control.c convtime.c daemon.c deliver.c domain.c envelope.c err.c headers.c macro.c map.c mci.c milter.c mime.c parseaddr.c queue.c ratectrl.c readcf.c recipient.c sasl.c savemail.c sfsasl.c shmticklib.c sm_resolve.c srvrsmtp.c stab.c stats.c sysexits.c timers.c tlsh.c tls.c trace.c udb.c usersmtp.c util.c version.c ')
+ PREPENDDEF(`confENVDEF', `confMAPDEF')
+@@ -68,7 +68,7 @@ ifdef(`confNO_STATISTICS_INSTALL',, `bld
+ divert(bldTARGETS_SECTION)
+ 
+ install-set-user-id: bldCURRENT_PRODUCT ifdef(`confNO_HELPFILE_INSTALL',, `install-hf') ifdef(`confNO_STATISTICS_INSTALL',, `install-st') ifdef(`confNO_MAN_BUILD',, `install-docs')
+-	${INSTALL} -c -o ${S`'BINOWN} -g ${S`'BINGRP} -m ${S`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}
++	${INSTALL} -c -m ${S`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}
+ 	for i in ${sendmailTARGET_LINKS}; do \
+ 		rm -f $$i; \
+ 		${LN} ${LNOPTS} ${M`'BINDIR}/sendmail $$i; \
+@@ -76,7 +76,7 @@ install-set-user-id: bldCURRENT_PRODUCT 
+ 
+ define(`confMTA_LINKS', `${DESTDIR}${UBINDIR}/newaliases ${DESTDIR}${UBINDIR}/mailq ${DESTDIR}${UBINDIR}/hoststat ${DESTDIR}${UBINDIR}/purgestat')
+ install-sm-mta: bldCURRENT_PRODUCT
+-	${INSTALL} -c -o ${M`'BINOWN} -g ${M`'BINGRP} -m ${M`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}/sm-mta
++	${INSTALL} -c -m ${M`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}/sm-mta
+ 	for i in confMTA_LINKS; do \
+ 		rm -f $$i; \
+ 		${LN} ${LNOPTS} ${M`'BINDIR}/sm-mta $$i; \
+@@ -84,14 +84,14 @@ install-sm-mta: bldCURRENT_PRODUCT
+ 
+ install-hf:
+ 	if [ ! -d ${DESTDIR}${HFDIR} ]; then mkdir -p ${DESTDIR}${HFDIR}; else :; fi
+-	${INSTALL} -c -o ${UBINOWN} -g ${UBINGRP} -m 444 helpfile ${DESTDIR}${HFFILE}
++	${INSTALL} -c -m 444 helpfile ${DESTDIR}${HFFILE}
+ 
+ install-st: statistics
+ 	if [ ! -d ${DESTDIR}${STDIR} ]; then mkdir -p ${DESTDIR}${STDIR}; else :; fi
+-	${INSTALL} -c -o ${SBINOWN} -g ${UBINGRP} -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${STPATH}
++	${INSTALL} -c -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${STPATH}
+ 
+ install-submit-st: statistics ${DESTDIR}${MSPQ}
+-	${INSTALL} -c -o ${MSPQOWN} -g ${GBINGRP} -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${MSPQ}/${MSPSTFILE}
++	${INSTALL} -c -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${MSPQ}/${MSPSTFILE}
+ 
+ divert(0)
+ bldPRODUCT_END
diff --git a/sendmail/patches/patch-ao b/sendmail/patches/patch-ao
new file mode 100644
index 0000000000..38ed2c7e7e
--- /dev/null
+++ b/sendmail/patches/patch-ao
@@ -0,0 +1,50 @@
+$NetBSD: patch-ao,v 1.3 2014/06/15 20:48:50 jnemeth Exp $
+
+--- devtools/bin/install.sh.orig	2014-03-06 17:31:29.000000000 +0000
++++ devtools/bin/install.sh
+@@ -101,25 +101,26 @@ then
+ 	$strip $dst
+ fi
+ 
+-# Change owner if requested
+-if [ ! -z "$owner" ]
+-then
+-	$chown $owner $dst
+-	if [ $? != 0 ]
+-	then
+-		exit 1
+-	fi
+-fi
+-
+-# Change group if requested
+-if [ ! -z "$group" ]
+-then
+-	chgrp $group $dst
+-	if [ $? != 0 ]
+-	then
+-		exit 1
+-	fi
+-fi
++# XXX Don't try to change owner or group, let pkgsrc infrastructure handle it.
++## Change owner if requested
++#if [ ! -z "$owner" ]
++#then
++#	$chown $owner $dst
++#	if [ $? != 0 ]
++#	then
++#		exit 1
++#	fi
++#fi
++#
++## Change group if requested
++#if [ ! -z "$group" ]
++#then
++#	chgrp $group $dst
++#	if [ $? != 0 ]
++#	then
++#		exit 1
++#	fi
++#fi
+ 
+ # Change mode if requested
+ if [ ! -z "$mode" ]
diff --git a/sendmail/patches/patch-ap b/sendmail/patches/patch-ap
new file mode 100644
index 0000000000..63939671f5
--- /dev/null
+++ b/sendmail/patches/patch-ap
@@ -0,0 +1,28 @@
+$NetBSD: patch-ap,v 1.1 2014/06/15 20:48:50 jnemeth Exp $
+
+--- libmilter/sm_gethost.c.orig	2014-03-06 17:31:30.000000000 +0000
++++ libmilter/sm_gethost.c
+@@ -49,19 +49,14 @@ sm_getipnodebyname(name, family, flags, 
+ 	int flags;
+ 	int *err;
+ {
+-	bool resv6 = true;
+ 	struct hostent *h;
+ 
+-	if (family == AF_INET6)
+-	{
+-		/* From RFC2133, section 6.1 */
+-		resv6 = bitset(RES_USE_INET6, _res.options);
+-		_res.options |= RES_USE_INET6;
+-	}
+ 	SM_SET_H_ERRNO(0);
++# if NETINET6
++	h = gethostbyname2(name, family);
++# else
+ 	h = gethostbyname(name);
+-	if (family == AF_INET6 && !resv6)
+-		_res.options &= ~RES_USE_INET6;
++# endif
+ 
+ 	/* the function is supposed to return only the requested family */
+ 	if (h != NULL && h->h_addrtype != family)
diff --git a/sendmail/patches/patch-aq b/sendmail/patches/patch-aq
new file mode 100644
index 0000000000..fb94cc7794
--- /dev/null
+++ b/sendmail/patches/patch-aq
@@ -0,0 +1,15 @@
+$NetBSD: patch-aq,v 1.1 2014/06/15 20:48:50 jnemeth Exp $
+
+--- sendmail/conf.h.orig	2017-02-17 03:44:29.000000000 +0900
++++ sendmail/conf.h	2018-04-01 06:44:43.018139478 +0900
+@@ -235,6 +235,10 @@ struct rusage;	/* forward declaration to
+ # define PIPELINING	1	/* SMTP PIPELINING */
+ #endif
+ 
++#ifndef NAMED_RESN
++# define NAMED_RESN    1       /* res_n* functions are available */
++#endif
++
+ /**********************************************************************
+ **  End of site-specific configuration.
+ **********************************************************************/
diff --git a/sendmail/patches/patch-ar b/sendmail/patches/patch-ar
new file mode 100644
index 0000000000..e177c24da8
--- /dev/null
+++ b/sendmail/patches/patch-ar
@@ -0,0 +1,110 @@
+$NetBSD: patch-ar,v 1.1 2014/06/15 20:48:50 jnemeth Exp $
+
+--- sendmail/daemon.c.orig	2017-02-17 03:44:29.000000000 +0900
++++ sendmail/daemon.c	2018-04-01 06:45:50.803848979 +0900
+@@ -71,6 +71,10 @@ SM_RCSID("@(#)$Id: daemon.c,v 8.698 2013
+ # endif /* HAS_IN_H */
+ #endif /* IP_SRCROUTE && NETINET */
+ 
++#if NAMED_BIND
++extern struct __res_state sm_res;
++#endif
++
+ #include <sm/fdset.h>
+ 
+ #include <ratectrl.h>
+@@ -2310,16 +2314,16 @@ makeconnection(host, port, mci, e, enoug
+ 				if (hp == NULL && p[-1] == '.')
+ 				{
+ #if NAMED_BIND
+-					int oldopts = _res.options;
++					int oldopts = sm_res.options;
+ 
+-					_res.options &= ~(RES_DEFNAMES|RES_DNSRCH);
++					sm_res.options &= ~(RES_DEFNAMES|RES_DNSRCH);
+ #endif /* NAMED_BIND */
+ 					p[-1] = '\0';
+ 					hp = sm_gethostbyname(&host[1],
+ 							      family);
+ 					p[-1] = '.';
+ #if NAMED_BIND
+-					_res.options = oldopts;
++					sm_res.options = oldopts;
+ #endif /* NAMED_BIND */
+ 				}
+ 				*p = ']';
+@@ -2348,15 +2352,15 @@ makeconnection(host, port, mci, e, enoug
+ 			if (hp == NULL && *p == '.')
+ 			{
+ #if NAMED_BIND
+-				int oldopts = _res.options;
++				int oldopts = sm_res.options;
+ 
+-				_res.options &= ~(RES_DEFNAMES|RES_DNSRCH);
++				sm_res.options &= ~(RES_DEFNAMES|RES_DNSRCH);
+ #endif /* NAMED_BIND */
+ 				*p = '\0';
+ 				hp = sm_gethostbyname(host, family);
+ 				*p = '.';
+ #if NAMED_BIND
+-				_res.options = oldopts;
++				sm_res.options = oldopts;
+ #endif /* NAMED_BIND */
+ 			}
+ 		}
+@@ -4023,13 +4027,13 @@ host_map_lookup(map, name, av, statp)
+ #if NAMED_BIND
+ 	if (map->map_timeout > 0)
+ 	{
+-		retrans = _res.retrans;
+-		_res.retrans = map->map_timeout;
++		retrans = sm_res.retrans;
++		sm_res.retrans = map->map_timeout;
+ 	}
+ 	if (map->map_retry > 0)
+ 	{
+-		retry = _res.retry;
+-		_res.retry = map->map_retry;
++		retry = sm_res.retry;
++		sm_res.retry = map->map_retry;
+ 	}
+ #endif /* NAMED_BIND */
+ 
+@@ -4107,9 +4111,9 @@ host_map_lookup(map, name, av, statp)
+ 	}
+ #if NAMED_BIND
+ 	if (map->map_timeout > 0)
+-		_res.retrans = retrans;
++		sm_res.retrans = retrans;
+ 	if (map->map_retry > 0)
+-		_res.retry = retry;
++		sm_res.retry = retry;
+ #endif /* NAMED_BIND */
+ 
+ 	s->s_namecanon.nc_flags |= NCF_VALID;	/* will be soon */
+@@ -4438,11 +4442,11 @@ hostnamebyanyaddr(sap)
+ 
+ # if NAMED_BIND
+ 	/* shorten name server timeout to avoid higher level timeouts */
+-	saveretry = _res.retry;
+-	if (_res.retry * _res.retrans > 20)
+-		_res.retry = 20 / _res.retrans;
+-	if (_res.retry == 0)
+-		_res.retry = 1;
++	saveretry = sm_res.retry;
++	if (sm_res.retry * sm_res.retrans > 20)
++		sm_res.retry = 20 / sm_res.retrans;
++	if (sm_res.retry == 0)
++		sm_res.retry = 1;
+ # endif /* NAMED_BIND */
+ 
+ 	switch (sap->sa.sa_family)
+@@ -4481,7 +4485,7 @@ hostnamebyanyaddr(sap)
+ 	}
+ 
+ # if NAMED_BIND
+-	_res.retry = saveretry;
++	sm_res.retry = saveretry;
+ # endif /* NAMED_BIND */
+ 
+ # if NETINET || NETINET6
diff --git a/sendmail/patches/patch-as b/sendmail/patches/patch-as
new file mode 100644
index 0000000000..3dc5fc7e21
--- /dev/null
+++ b/sendmail/patches/patch-as
@@ -0,0 +1,60 @@
+$NetBSD: patch-as,v 1.1 2014/06/15 20:48:50 jnemeth Exp $
+
+--- sendmail/deliver.c.orig	2017-02-17 03:44:29.000000000 +0900
++++ sendmail/deliver.c	2018-04-01 06:46:32.962098677 +0900
+@@ -29,6 +29,10 @@ SM_RCSID("@(#)$Id: deliver.c,v 8.1030 20
+ # include "tls.h"
+ #endif /* STARTTLS || SASL */
+ 
++#if NAMED_BIND
++extern struct __res_state sm_res;
++#endif
++
+ static int	deliver __P((ENVELOPE *, ADDRESS *));
+ static void	dup_queue_file __P((ENVELOPE *, ENVELOPE *, int));
+ static void	mailfiletimeout __P((int));
+@@ -1875,7 +1879,7 @@ deliver(e, firstto)
+ 
+ #if NAMED_BIND
+ 	if (ConfigLevel < 2)
+-		_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
++		sm_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
+ #endif /* NAMED_BIND */
+ 
+ 	if (tTd(11, 1))
+@@ -3536,7 +3540,7 @@ do_transfer:
+ 	}
+ #if NAMED_BIND
+ 	if (ConfigLevel < 2)
+-		_res.options |= RES_DEFNAMES | RES_DNSRCH;	/* XXX */
++		sm_res.options |= RES_DEFNAMES | RES_DNSRCH;	/* XXX */
+ #endif /* NAMED_BIND */
+ 
+ 	if (tTd(62, 1))
+@@ -5875,7 +5879,7 @@ hostsignature(m, host, ad)
+ 	int hl;
+ 	char *hp;
+ 	char *endp;
+-	int oldoptions = _res.options;
++	int oldoptions = sm_res.options;
+ 	char *mxhosts[MAXMXHOSTS + 1];
+ 	unsigned short mxprefs[MAXMXHOSTS + 1];
+ #endif /* NAMED_BIND */
+@@ -5945,7 +5949,7 @@ hostsignature(m, host, ad)
+ 
+ #if NAMED_BIND
+ 	if (ConfigLevel < 2)
+-		_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
++		sm_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
+ 
+ 	for (hp = host; hp != NULL; hp = endp)
+ 	{
+@@ -6074,7 +6078,7 @@ hostsignature(m, host, ad)
+ 	}
+ 	makelower(s->s_hostsig.hs_sig);
+ 	if (ConfigLevel < 2)
+-		_res.options = oldoptions;
++		sm_res.options = oldoptions;
+ #else /* NAMED_BIND */
+ 	/* not using BIND -- the signature is just the host name */
+ 	/*
diff --git a/sendmail/patches/patch-at b/sendmail/patches/patch-at
new file mode 100644
index 0000000000..bdc743dc7e
--- /dev/null
+++ b/sendmail/patches/patch-at
@@ -0,0 +1,148 @@
+$NetBSD$
+
+
+--- sendmail/domain.c.orig	2017-02-17 03:44:29.000000000 +0900
++++ sendmail/domain.c	2018-04-01 22:31:20.121274241 +0900
+@@ -43,7 +43,7 @@ static char	MXHostBuf[MXHOSTBUFSIZE];
+ # endif /* ! MAXDNSRCH */
+ 
+ # ifndef RES_DNSRCH_VARIABLE
+-#  define RES_DNSRCH_VARIABLE	_res.dnsrch
++#  define RES_DNSRCH_VARIABLE	sm_res.dnsrch
+ # endif /* ! RES_DNSRCH_VARIABLE */
+ 
+ # ifndef NO_DATA
+@@ -62,6 +62,8 @@ static char	MXHostBuf[MXHOSTBUFSIZE];
+ #  define RES_UNC_T	unsigned char *
+ # endif /* defined(__RES) && (__RES >= 19940415) */
+ 
++extern struct __res_state sm_res;
++
+ static int	mxrand __P((char *));
+ static int	fallbackmxrr __P((int, unsigned short *, char **));
+ 
+@@ -436,12 +438,10 @@ getmxrr(host, mxhosts, mxprefs, flags, r
+ 	char *fallbackMX = FallbackMX;
+ 	bool trycanon = false;
+ 	unsigned short *prefs;
+-	int (*resfunc) __P((const char *, int, int, u_char *, int));
+ 	unsigned short prefer[MAXMXHOSTS];
+ 	int weight[MAXMXHOSTS];
+ 	int ttl = 0;
+ 	bool ad;
+-	extern int res_query(), res_search();
+ 
+ 	if (tTd(8, 2))
+ 		sm_dprintf("getmxrr(%s, droplocalhost=%d)\n",
+@@ -479,15 +479,24 @@ getmxrr(host, mxhosts, mxprefs, flags, r
+ 
+ 	if (!UseNameServer)
+ 		goto punt;
+-	if (HasWildcardMX && ConfigLevel >= 6)
+-		resfunc = res_query;
+-	else
+-		resfunc = res_search;
+ 
+ 	errno = 0;
+-	hp = (HEADER *)&answer;
+-	n = (*resfunc)(host, C_IN, T_MX, (unsigned char *) &answer,
++	 if (HasWildcardMX && ConfigLevel >= 6)
++#if NAMED_RESN
++	n = res_nquery(&sm_res, host, C_IN, T_MX,
++	       (unsigned char *) &answer, sizeof(answer));
++#else
++	n = res_query(host, C_IN, T_MX, (unsigned char *) &answer,
++		sizeof(answer));
++#endif
++       else
++#if NAMED_RESN
++	     n = res_nsearch(&sm_res, host, C_IN, T_MX,
++		      (unsigned char *) &answer, sizeof(answer));
++#else
++             n = res_search(host, C_IN, T_MX, (unsigned char *) &answer,
+ 		       sizeof(answer));
++#endif
+ 	if (n < 0)
+ 	{
+ 		if (tTd(8, 1))
+@@ -575,7 +584,7 @@ getmxrr(host, mxhosts, mxprefs, flags, r
+ 		GETSHORT(n, cp);	/* rdlength */
+ 		if (type != T_MX)
+ 		{
+-			if ((tTd(8, 8) || _res.options & RES_DEBUG)
++			if ((tTd(8, 8) || sm_res.options & RES_DEBUG)
+ # if _FFR_TLSA_DANE
+ 			    && type != T_RRSIG
+ # endif
+@@ -891,7 +900,7 @@ bestmx_map_lookup(map, name, av, statp)
+ 	int *statp;
+ {
+ 	int nmx;
+-	int saveopts = _res.options;
++	int saveopts = sm_res.options;
+ 	int i;
+ 	ssize_t len = 0;
+ 	char *result;
+@@ -903,9 +912,9 @@ bestmx_map_lookup(map, name, av, statp)
+ 	char buf[PSBUFSIZE / 2];
+ #endif /* _FFR_BESTMX_BETTER_TRUNCATION */
+ 
+-	_res.options &= ~(RES_DNSRCH|RES_DEFNAMES);
++	sm_res.options &= ~(RES_DNSRCH|RES_DEFNAMES);
+ 	nmx = getmxrr(name, mxhosts, NULL, 0, statp, NULL);
+-	_res.options = saveopts;
++	sm_res.options = saveopts;
+ 	if (nmx <= 0)
+ 		return NULL;
+ 	if (bitset(MF_MATCHONLY, map->map_mflags))
+@@ -1045,8 +1054,13 @@ dns_getcanonname(host, hbsize, trymx, st
+ 	if (tTd(8, 2))
+ 		sm_dprintf("dns_getcanonname(%s, trymx=%d)\n", host, trymx);
+ 
+-	if ((_res.options & RES_INIT) == 0 && res_init() == -1)
+-	{
++	if ((sm_res.options & RES_INIT) == 0 )
++# if NAMED_RESN
++	       memset(&sm_res, 0, sizeof(sm_res));
++	       if (res_ninit(&sm_res) == -1) {
++# else
++	       if (res_init() == -1) {
++# endif
+ 		*statp = EX_UNAVAILABLE;
+ 		return HOST_NOTFOUND;
+ 	}
+@@ -1086,7 +1100,7 @@ cnameloop:
+ 	dp = searchlist;
+ 	if (n > 0)
+ 		*dp++ = "";
+-	if (n >= 0 && *--cp != '.' && bitset(RES_DNSRCH, _res.options))
++	if (n >= 0 && *--cp != '.' && bitset(RES_DNSRCH, sm_res.options))
+ 	{
+ 		/* make sure there are less than MAXDNSRCH domains */
+ 		for (domain = RES_DNSRCH_VARIABLE, ret = 0;
+@@ -1094,9 +1108,9 @@ cnameloop:
+ 		     ret++)
+ 			*dp++ = *domain++;
+ 	}
+-	else if (n == 0 && bitset(RES_DEFNAMES, _res.options))
++	else if (n == 0 && bitset(RES_DEFNAMES, sm_res.options))
+ 	{
+-		*dp++ = _res.defdname;
++		*dp++ = sm_res.defdname;
+ 	}
+ 	else if (*cp == '.')
+ 	{
+@@ -1132,8 +1146,13 @@ cnameloop:
+ 				"???");
+ 		errno = 0;
+ 		hp = (HEADER *) &answer;
++# if NAMED_RESN
++		ret = res_nquerydomain(&sm_res, host, *dp, C_IN, qtype,
++				      answer.qb2, sizeof(answer.qb2));
++# else
+ 		ret = res_querydomain(host, *dp, C_IN, qtype,
+ 				      answer.qb2, sizeof(answer.qb2));
++#endif
+ 		if (ret <= 0)
+ 		{
+ 			int save_errno = errno;
diff --git a/sendmail/patches/patch-au b/sendmail/patches/patch-au
new file mode 100644
index 0000000000..e86884cca6
--- /dev/null
+++ b/sendmail/patches/patch-au
@@ -0,0 +1,87 @@
+$NetBSD: patch-au,v 1.2 2014/06/20 05:24:32 jnemeth Exp $
+
+--- sendmail/main.c.orig	2017-02-17 03:44:29.000000000 +0900
++++ sendmail/main.c	2018-04-01 06:57:00.542982374 +0900
+@@ -150,6 +150,10 @@ int		SyslogPrefixLen; /* estimated lengt
+ 	}								\
+ }
+ 
++#if NAMED_BIND
++struct __res_state sm_res;
++#endif
++
+ int
+ main(argc, argv, envp)
+ 	int argc;
+@@ -211,6 +215,14 @@ main(argc, argv, envp)
+ #if USE_ENVIRON
+ 	envp = environ;
+ #endif
++#if NAMED_BIND
++# if NAMED_RESN
++	sm_res = *(struct __res_state *)sm_malloc(sizeof(struct __res_state));
++	memset(&sm_res, 0, sizeof(struct __res_state));
++# else
++	sm_res = _res;
++# endif
++#endif
+ 
+ 	/* turn off profiling */
+ 	SM_PROF(0);
+@@ -694,21 +706,26 @@ main(argc, argv, envp)
+ 	*/
+ 
+ #if NAMED_BIND
+-	if (!bitset(RES_INIT, _res.options))
++	if (!bitset(RES_INIT, sm_res.options))
++
++# if NAMED_RESN
++		(void) res_ninit(&sm_res);
++# else
+ 		(void) res_init();
++# endif
+ 	if (tTd(8, 8))
+-		_res.options |= RES_DEBUG;
++		sm_res.options |= RES_DEBUG;
+ 	else
+-		_res.options &= ~RES_DEBUG;
++		sm_res.options &= ~RES_DEBUG;
+ # ifdef RES_NOALIASES
+ 	_res.options |= RES_NOALIASES;
+ # endif
+-	TimeOuts.res_retry[RES_TO_DEFAULT] = _res.retry;
++	TimeOuts.res_retry[RES_TO_DEFAULT] = sm_res.retry;
+ 	TimeOuts.res_retry[RES_TO_FIRST] = _res.retry;
+-	TimeOuts.res_retry[RES_TO_NORMAL] = _res.retry;
+-	TimeOuts.res_retrans[RES_TO_DEFAULT] = _res.retrans;
+-	TimeOuts.res_retrans[RES_TO_FIRST] = _res.retrans;
+-	TimeOuts.res_retrans[RES_TO_NORMAL] = _res.retrans;
++	TimeOuts.res_retry[RES_TO_NORMAL] = sm_res.retry;
++	TimeOuts.res_retrans[RES_TO_DEFAULT] = sm_res.retrans;
++	TimeOuts.res_retrans[RES_TO_FIRST] = sm_res.retrans;
++	TimeOuts.res_retrans[RES_TO_NORMAL] = sm_res.retrans;
+ #endif /* NAMED_BIND */
+ 
+ 	errno = 0;
+@@ -1397,8 +1414,8 @@ main(argc, argv, envp)
+ 	}
+ 
+ #if NAMED_BIND
+-	_res.retry = TimeOuts.res_retry[RES_TO_DEFAULT];
+-	_res.retrans = TimeOuts.res_retrans[RES_TO_DEFAULT];
++	sm_res.retry = TimeOuts.res_retry[RES_TO_DEFAULT];
++	sm_res.retrans = TimeOuts.res_retrans[RES_TO_DEFAULT];
+ #endif
+ 
+ 	/*
+@@ -2933,8 +2950,8 @@ main(argc, argv, envp)
+ 		sm_getla();
+ 		GrabTo = false;
+ #if NAMED_BIND
+-		_res.retry = TimeOuts.res_retry[RES_TO_FIRST];
+-		_res.retrans = TimeOuts.res_retrans[RES_TO_FIRST];
++		sm_res.retry = TimeOuts.res_retry[RES_TO_FIRST];
++		sm_res.retrans = TimeOuts.res_retrans[RES_TO_FIRST];
+ #endif
+ 		next = e->e_sibling;
+ 		e->e_sibling = NULL;
diff --git a/sendmail/patches/patch-av b/sendmail/patches/patch-av
new file mode 100644
index 0000000000..ea288cdda2
--- /dev/null
+++ b/sendmail/patches/patch-av
@@ -0,0 +1,33 @@
+$NetBSD: patch-av,v 1.1 2014/06/15 20:48:50 jnemeth Exp $
+
+--- sendmail/queue.c.orig	2014-05-16 20:40:15.000000000 +0000
++++ sendmail/queue.c
+@@ -34,6 +34,10 @@ SM_RCSID("@(#)$Id: queue.c,v 8.1000 2013
+ # define SM_OPEN_EXLOCK 0
+ #endif /* ! SM_OPEN_EXLOCK */
+ 
++#if NAMED_BIND
++extern struct __res_state sm_res;
++#endif
++
+ /*
+ **  Historical notes:
+ **	QF_VERSION == 4 was sendmail 8.10/8.11 without _FFR_QUEUEDELAY
+@@ -4360,13 +4364,13 @@ readqf(e, openonly)
+ 			/* adjust BIND parameters immediately */
+ 			if (e->e_ntries == 0)
+ 			{
+-				_res.retry = TimeOuts.res_retry[RES_TO_FIRST];
+-				_res.retrans = TimeOuts.res_retrans[RES_TO_FIRST];
++				sm_res.retry = TimeOuts.res_retry[RES_TO_FIRST];
++				sm_res.retrans = TimeOuts.res_retrans[RES_TO_FIRST];
+ 			}
+ 			else
+ 			{
+-				_res.retry = TimeOuts.res_retry[RES_TO_NORMAL];
+-				_res.retrans = TimeOuts.res_retrans[RES_TO_NORMAL];
++				sm_res.retry = TimeOuts.res_retry[RES_TO_NORMAL];
++				sm_res.retrans = TimeOuts.res_retrans[RES_TO_NORMAL];
+ 			}
+ #endif /* NAMED_BIND */
+ 			break;
diff --git a/sendmail/patches/patch-aw b/sendmail/patches/patch-aw
new file mode 100644
index 0000000000..94e3f6a347
--- /dev/null
+++ b/sendmail/patches/patch-aw
@@ -0,0 +1,32 @@
+$NetBSD: patch-aw,v 1.4 2014/12/06 23:22:20 jnemeth Exp $
+
+--- sendmail/readcf.c.orig	2014-10-22 16:33:53.000000000 +0000
++++ sendmail/readcf.c
+@@ -20,6 +20,10 @@ SM_RCSID("@(#)$Id: readcf.c,v 8.692 2013
+ # include <arpa/inet.h>
+ #endif /* NETINET || NETINET6 */
+ 
++#if NAMED_BIND
++extern struct __res_state sm_res;
++#endif
++
+ 
+ #define SECONDS
+ #define MINUTES	* 60
+@@ -2999,13 +3003,13 @@ setoption(opt, val, safe, sticky, e)
+ 			if (rfp->rf_name == NULL)
+ 				syserr("readcf: I option value %s unrecognized", q);
+ 			else if (clearmode)
+-				_res.options &= ~rfp->rf_bits;
++				sm_res.options &= ~rfp->rf_bits;
+ 			else
+-				_res.options |= rfp->rf_bits;
++				sm_res.options |= rfp->rf_bits;
+ 		}
+ 		if (tTd(8, 2))
+ 			sm_dprintf("_res.options = %x, HasWildcardMX = %d\n",
+-				   (unsigned int) _res.options, HasWildcardMX);
++				   (unsigned int) sm_res.options, HasWildcardMX);
+ #else /* NAMED_BIND */
+ 		usrerr("name server (I option) specified but BIND not compiled in");
+ #endif /* NAMED_BIND */
diff --git a/sendmail/patches/patch-ax b/sendmail/patches/patch-ax
new file mode 100644
index 0000000000..f0ea62fbe6
--- /dev/null
+++ b/sendmail/patches/patch-ax
@@ -0,0 +1,18 @@
+$NetBSD: patch-ax,v 1.1 2014/06/15 20:48:50 jnemeth Exp $
+
+--- sendmail/savemail.c.orig	2014-05-16 20:40:15.000000000 +0000
++++ sendmail/savemail.c
+@@ -17,2 +17,6 @@ SM_RCSID("@(#)$Id: savemail.c,v 8.319 20
+ 
++#if NAMED_BIND
++extern struct __res_state sm_res;
++#endif
++
+ static bool	errbody __P((MCI *, ENVELOPE *, char *));
+@@ -594,4 +598,4 @@ returntosender(msg, returnq, flags, e)
+ #if NAMED_BIND
+-	_res.retry = TimeOuts.res_retry[RES_TO_FIRST];
+-	_res.retrans = TimeOuts.res_retrans[RES_TO_FIRST];
++	sm_res.retry = TimeOuts.res_retry[RES_TO_FIRST];
++	sm_res.retrans = TimeOuts.res_retrans[RES_TO_FIRST];
+ #endif /* NAMED_BIND */
diff --git a/sendmail/patches/patch-ay b/sendmail/patches/patch-ay
new file mode 100644
index 0000000000..84caf054c2
--- /dev/null
+++ b/sendmail/patches/patch-ay
@@ -0,0 +1,96 @@
+$NetBSD: patch-ay,v 1.2 2014/06/20 05:24:32 jnemeth Exp $
+
+--- sendmail/sm_resolve.c.orig	2017-02-17 03:44:29.000000000 +0900
++++ sendmail/sm_resolve.c	2018-04-01 06:58:33.405373076 +0900
+@@ -54,6 +54,10 @@
+ 
+ SM_RCSID("$Id: sm_resolve.c,v 8.40 2013-11-22 20:51:56 ca Exp $")
+ 
++#if NAMED_BIND
++extern struct __res_state sm_res;
++#endif
++
+ static struct stot
+ {
+ 	const char	*st_name;
+@@ -458,7 +462,7 @@ nsportip(p)
+ 	r = inet_pton(AF_INET, p, &nsip);
+ 	if (r > 0)
+ 	{
+-		if ((_res.options & RES_INIT) == 0)
++		if ((sm_res.options & RES_INIT) == 0)
+ 			(void) res_init();
+ 		dns_setns(&nsip, port);
+ 	}
+@@ -533,11 +537,11 @@ dns_lookup_int(domain, rr_class, rr_type
+ # define IP_MAXPACKET	65535
+ #endif
+ 
+-	old_options = _res.options;
+-	_res.options |= options;
++	old_options = sm_res.options;
++	sm_res.options |= options;
+ 	if (tTd(8, 16))
+ 	{
+-		_res.options |= RES_DEBUG;
++		sm_res.options |= RES_DEBUG;
+ 		sm_dprintf("dns_lookup(%s, %d, %s, %x)\n", domain,
+ 			   rr_class, dns_type_to_string(rr_type), options);
+ 	}
+@@ -550,18 +554,22 @@ dns_lookup_int(domain, rr_class, rr_type
+ 
+ 	if (retrans > 0)
+ 	{
+-		save_retrans = _res.retrans;
+-		_res.retrans = retrans;
++		save_retrans = sm_res.retrans;
++		sm_res.retrans = retrans;
+ 	}
+ 	if (retry > 0)
+ 	{
+-		save_retry = _res.retry;
+-		_res.retry = retry;
++		save_retry = sm_res.retry;
++		sm_res.retry = retry;
+ 	}
+ 	errno = 0;
+ 	SM_SET_H_ERRNO(0);
+ 	reply = (unsigned char *)&reply_buf;
++#if NAMED_RESN
++	len = res_nsearch(&sm_res, domain, rr_class, rr_type, reply, SMRBSIZE);
++#else
+ 	len = res_search(domain, rr_class, rr_type, reply, SMRBSIZE);
++#endif
+ 	if (len >= SMRBSIZE)
+ 	{
+ 		if (len >= IP_MAXPACKET)
+@@ -579,11 +587,16 @@ dns_lookup_int(domain, rr_class, rr_type
+ 			if (reply == NULL)
+ 				SM_SET_H_ERRNO(TRY_AGAIN);
+ 			else
++#if NAMED_RESN
++				len = res_nsearch(&sm_res, domain, rr_class,
++						 rr_type, reply, IP_MAXPACKET);
++#else
+ 				len = res_search(domain, rr_class, rr_type,
+ 						 reply, IP_MAXPACKET);
++#endif
+ 		}
+ 	}
+-	_res.options = old_options;
++	sm_res.options = old_options;
+ 	if (tTd(8, 16))
+ 	{
+ 		sm_dprintf("dns_lookup(%s, %d, %s, %x) --> %d\n",
+@@ -597,9 +610,9 @@ dns_lookup_int(domain, rr_class, rr_type
+ 		reply = NULL;
+ 	}
+ 	if (retrans > 0)
+-		_res.retrans = save_retrans;
++		sm_res.retrans = save_retrans;
+ 	if (retry > 0)
+-		_res.retry = save_retry;
++		sm_res.retry = save_retry;
+ 	return r;
+ }
+ 
diff --git a/sendmail/patches/patch-az b/sendmail/patches/patch-az
new file mode 100644
index 0000000000..cb22ee58a8
--- /dev/null
+++ b/sendmail/patches/patch-az
@@ -0,0 +1,26 @@
+$NetBSD: patch-az,v 1.2 2014/12/06 23:22:20 jnemeth Exp $
+
+--- sendmail/srvrsmtp.c.orig	2014-11-12 03:02:04.000000000 +0000
++++ sendmail/srvrsmtp.c
+@@ -46,6 +46,10 @@ static bool	tls_ok_srv = false;
+ static bool	NotFirstDelivery = false;
+ #endif /* _FFR_DM_ONE */
+ 
++#if NAMED_BIND
++extern struct __res_state sm_res;
++#endif
++
+ /* server features */
+ #define SRV_NONE	0x0000	/* none... */
+ #define SRV_OFFER_TLS	0x0001	/* offer STARTTLS */
+@@ -3983,8 +3987,8 @@ smtp_data(smtp, e)
+ 	id = e->e_id;
+ 
+ #if NAMED_BIND
+-	_res.retry = TimeOuts.res_retry[RES_TO_FIRST];
+-	_res.retrans = TimeOuts.res_retrans[RES_TO_FIRST];
++	sm_res.retry = TimeOuts.res_retry[RES_TO_FIRST];
++	sm_res.retrans = TimeOuts.res_retrans[RES_TO_FIRST];
+ #endif /* NAMED_BIND */
+ 
+ #if _FFR_PROXY
diff --git a/sendmail/patches/patch-ba b/sendmail/patches/patch-ba
new file mode 100644
index 0000000000..cf6343030c
--- /dev/null
+++ b/sendmail/patches/patch-ba
@@ -0,0 +1,13 @@
+$NetBSD: patch-ba,v 1.3 2014/06/20 05:24:32 jnemeth Exp $
+
+--- devtools/M4/UNIX/executable.m4.orig	2014-03-06 17:31:29.000000000 +0000
++++ devtools/M4/UNIX/executable.m4
+@@ -31,7 +31,7 @@ ifdef(`bldLINK_SOURCES', `bldMAKE_SOURCE
+ ifdef(`bldNO_INSTALL', ,
+ `install-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT ifdef(`bldTARGET_INST_DEP', `bldTARGET_INST_DEP')
+ 	ifdef(`confMKDIR', `if [ ! -d ${DESTDIR}${bldINSTALL_DIR`'BINDIR} ]; then confMKDIR -p ${DESTDIR}${bldINSTALL_DIR`'BINDIR}; else :; fi ')
+-	${INSTALL} -c -o ${bldBIN_TYPE`'BINOWN} -g ${bldBIN_TYPE`'BINGRP} -m ${bldBIN_TYPE`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${bldINSTALL_DIR`'BINDIR}
++	${INSTALL} -c -m ${bldBIN_TYPE`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${bldINSTALL_DIR`'BINDIR}
+ ifdef(`bldTARGET_LINKS', `bldMAKE_TARGET_LINKS(${bldINSTALL_DIR`'BINDIR}/bldCURRENT_PRODUCT, ${bldCURRENT_PRODUCT`'TARGET_LINKS})')')
+ 
+ strip-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT
diff --git a/sendmail/patches/patch-bb b/sendmail/patches/patch-bb
new file mode 100644
index 0000000000..cf732f4acc
--- /dev/null
+++ b/sendmail/patches/patch-bb
@@ -0,0 +1,13 @@
+$NetBSD: patch-bb,v 1.1 2014/06/20 05:24:32 jnemeth Exp $
+
+--- devtools/M4/UNIX/library.m4.orig	2014-03-06 17:31:29.000000000 +0000
++++ devtools/M4/UNIX/library.m4
+@@ -28,7 +28,7 @@ ifdef(`bldLINK_SOURCES', `bldMAKE_SOURCE
+ 
+ install-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT.a
+ ifdef(`bldINSTALLABLE', `	ifdef(`confMKDIR', `if [ ! -d ${DESTDIR}${bldINSTALL_DIR`'LIBDIR} ]; then confMKDIR -p ${DESTDIR}${bldINSTALL_DIR`'LIBDIR}; else :; fi ')
+-	${INSTALL} -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} bldCURRENT_PRODUCT.a ${DESTDIR}${LIBDIR}')
++	${INSTALL} -c -m ${LIBMODE} bldCURRENT_PRODUCT.a ${DESTDIR}${LIBDIR}')
+ 
+ bldCURRENT_PRODUCT-clean:
+ 	rm -f ${OBJS} bldCURRENT_PRODUCT.a ${MANPAGES}
diff --git a/sendmail/patches/patch-bc b/sendmail/patches/patch-bc
new file mode 100644
index 0000000000..ecb4902a9d
--- /dev/null
+++ b/sendmail/patches/patch-bc
@@ -0,0 +1,17 @@
+$NetBSD: patch-bc,v 1.1 2014/06/20 05:24:32 jnemeth Exp $
+
+--- devtools/M4/UNIX/manpage.m4.orig	2014-03-06 17:31:29.000000000 +0000
++++ devtools/M4/UNIX/manpage.m4
+@@ -69,10 +69,10 @@ ifdef(`confNO_MAN_INSTALL', `divert(-1)'
+ define(`bldMAN_INSTALL_CMD',
+ `ifdef(`confDONT_INSTALL_CATMAN', `dnl',
+ `	ifdef(`confMKDIR', `if [ ! -d ${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)`SRC} ]; then confMKDIR -p ${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)`SRC}; else :; fi ')
+-	${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} bldGET_MAN_BASE_NAME($1).`${MAN'bldGET_MAN_SOURCE_NUM($1)`SRC}' `${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)}/bldGET_MAN_BASE_NAME($1)`.${MAN'bldGET_MAN_SOURCE_NUM($1)`EXT}'')
++	${INSTALL} -c -m ${MANMODE} bldGET_MAN_BASE_NAME($1).`${MAN'bldGET_MAN_SOURCE_NUM($1)`SRC}' `${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)}/bldGET_MAN_BASE_NAME($1)`.${MAN'bldGET_MAN_SOURCE_NUM($1)`EXT}'')
+ ifdef(`confINSTALL_RAWMAN',
+ `	ifdef(`confMKDIR', `if [ ! -d ${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)`MAN} ]; then confMKDIR -p ${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)`MAN}; else :; fi ')
+-	${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} bldGET_MAN_BASE_NAME($1).bldGET_MAN_SOURCE_NUM($1) `${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)`MAN}'/bldGET_MAN_BASE_NAME($1)`.${MAN'bldGET_MAN_SOURCE_NUM($1)`EXT}'', `dnl')'
++	${INSTALL} -c -m ${MANMODE} bldGET_MAN_BASE_NAME($1).bldGET_MAN_SOURCE_NUM($1) `${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)`MAN}'/bldGET_MAN_BASE_NAME($1)`.${MAN'bldGET_MAN_SOURCE_NUM($1)`EXT}'', `dnl')'
+ )dnl
+ bldFOREACH(`bldMAN_INSTALL_CMD(', `bldMAN_PAGES')
+ ifdef(`confNO_MAN_INSTALL', `divert(0)', `dnl')
diff --git a/sendmail/patches/patch-bd b/sendmail/patches/patch-bd
new file mode 100644
index 0000000000..84e98236ad
--- /dev/null
+++ b/sendmail/patches/patch-bd
@@ -0,0 +1,13 @@
+$NetBSD: patch-bd,v 1.1 2014/06/20 05:24:32 jnemeth Exp $
+
+--- mail.local/Makefile.m4.orig	2014-03-06 17:31:30.000000000 +0000
++++ mail.local/Makefile.m4
+@@ -30,7 +30,7 @@ install:
+ force-install: install-mail.local ifdef(`confNO_MAN_BUILD',, `install-docs')
+ 
+ install-mail.local: mail.local
+-	${INSTALL} -c -o ${UBINOWN} -g ${UBINGRP} -m ${UBINMODE} mail.local ${DESTDIR}${EBINDIR}
++	${INSTALL} -c -m ${UBINMODE} mail.local ${DESTDIR}${EBINDIR}
+ divert
+ 
+ bldFINISH
diff --git a/sendmail/patches/patch-be b/sendmail/patches/patch-be
new file mode 100644
index 0000000000..5fe8a1ebf6
--- /dev/null
+++ b/sendmail/patches/patch-be
@@ -0,0 +1,13 @@
+$NetBSD: patch-be,v 1.1 2014/06/20 05:24:32 jnemeth Exp $
+
+--- rmail/Makefile.m4.orig	2014-03-06 17:31:31.000000000 +0000
++++ rmail/Makefile.m4
+@@ -31,7 +31,7 @@ defeat-install:
+ force-install: install-rmail ifdef(`confNO_MAN_BUILD',, `install-docs')
+ 
+ install-rmail: rmail
+-	${INSTALL} -c -o ${UBINOWN} -g ${UBINGRP} -m ${UBINMODE} rmail ${DESTDIR}${UBINDIR}
++	${INSTALL} -c -m ${UBINMODE} rmail ${DESTDIR}${UBINDIR}
+ divert
+ 
+ bldFINISH
diff --git a/sendmail/patches/patch-bf b/sendmail/patches/patch-bf
new file mode 100644
index 0000000000..aa1d2e1334
--- /dev/null
+++ b/sendmail/patches/patch-bf
@@ -0,0 +1,15 @@
+$NetBSD: patch-bf,v 1.1 2014/06/20 16:26:55 jnemeth Exp $
+
+--- libmilter/Makefile.m4.orig	2014-05-16 20:40:15.000000000 +0000
++++ libmilter/Makefile.m4
+@@ -33,8 +33,8 @@ MFAPI=	${SRCDIR}/inc`'lude/libmilter/mfa
+ MFDEF=	${SRCDIR}/inc`'lude/libmilter/mfdef.h
+ install-mfapi: ${MFAPI}
+ 	if [ ! -d ${DESTDIR}${INCLUDEDIR}/libmilter ]; then mkdir -p ${DESTDIR}${INCLUDEDIR}/libmilter; else :; fi
+-	${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFAPI} ${DESTDIR}${INCLUDEDIR}/libmilter/mfapi.h
+-	${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFDEF} ${DESTDIR}${INCLUDEDIR}/libmilter/mfdef.h
++	${INSTALL} -c -m ${INCMODE} ${MFAPI} ${DESTDIR}${INCLUDEDIR}/libmilter/mfapi.h
++	${INSTALL} -c -m ${INCMODE} ${MFDEF} ${DESTDIR}${INCLUDEDIR}/libmilter/mfdef.h
+ divert(0)
+ 
+ bldFINISH
diff --git a/sendmail/patches/patch-bg b/sendmail/patches/patch-bg
new file mode 100644
index 0000000000..d79a900f33
--- /dev/null
+++ b/sendmail/patches/patch-bg
@@ -0,0 +1,24 @@
+$NetBSD: patch-bg,v 1.1 2014/09/19 21:24:05 jnemeth Exp $
+
+--- include/sm/config.h.orig	2014-03-06 17:31:29.000000000 +0000
++++ include/sm/config.h
+@@ -24,16 +24,14 @@
+ 
+ /*
+ **  SM_CONF_STDBOOL_H is 1 if <stdbool.h> exists
+-**
+-**  Note, unlike gcc, clang doesn't apply full prototypes to K&R definitions.
+ */
+ 
+ # ifndef SM_CONF_STDBOOL_H
+-#  if !defined(__clang__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
++#  if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #   define SM_CONF_STDBOOL_H		1
+-#  else /* !defined(__clang__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
++#  else /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
+ #   define SM_CONF_STDBOOL_H		0
+-#  endif /* !defined(__clang__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
++#  endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
+ # endif /* ! SM_CONF_STDBOOL_H */
+ 
+ /*
diff --git a/sendmail/patches/patch-libsm_notify.c b/sendmail/patches/patch-libsm_notify.c
new file mode 100644
index 0000000000..54462f4def
--- /dev/null
+++ b/sendmail/patches/patch-libsm_notify.c
@@ -0,0 +1,17 @@
+$NetBSD$
+
+notify.c: In function 'sm_notify_rcv':
+notify.c:170:17: error: storage size of 'timeout' isn't known
+  struct timeval timeout;
+                 ^~~~~~~
+--- libsm/notify.c.orig	2017-02-17 03:44:29.000000000 +0900
++++ libsm/notify.c	2018-04-01 12:34:31.616373358 +0900
+@@ -25,6 +25,8 @@
+ #include <fcntl.h>
+ #include <string.h>	/* for memset() */
+ 
++#include <sys/time.h>
++
+ #if SM_NOTIFY_DEBUG
+ #define SM_DBG(p)	fprintf p
+ #else


Home | Main Index | Thread Index | Old Index