summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /mail-mta
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'mail-mta')
-rw-r--r--mail-mta/courier/Manifest4
-rw-r--r--mail-mta/courier/courier-0.71.ebuild302
-rw-r--r--mail-mta/courier/courier-0.74.0.ebuild305
-rw-r--r--mail-mta/courier/courier-0.74.1-r1.ebuild309
-rw-r--r--mail-mta/courier/courier-0.74.1.ebuild304
-rw-r--r--mail-mta/courier/courier-0.75.0.ebuild311
-rw-r--r--mail-mta/courier/files/apache-sqwebmail.inc14
-rw-r--r--mail-mta/courier/files/courier-0.74.0-fix-linking.diff24
-rw-r--r--mail-mta/courier/files/courier-0.74.1-fix-implicit-declaration-warning.diff12
-rw-r--r--mail-mta/courier/files/courier-0.74.1-fix-testsuite.diff12
-rw-r--r--mail-mta/courier/files/courier-init-r4190
-rw-r--r--mail-mta/courier/files/norewrite.patch21
-rw-r--r--mail-mta/courier/files/password.dist6
-rw-r--r--mail-mta/courier/metadata.xml22
-rw-r--r--mail-mta/esmtp/Manifest1
-rw-r--r--mail-mta/esmtp/esmtp-1.2.ebuild38
-rw-r--r--mail-mta/esmtp/files/mailer.conf8
-rw-r--r--mail-mta/esmtp/metadata.xml8
-rw-r--r--mail-mta/exim/Manifest7
-rw-r--r--mail-mta/exim/exim-4.84.ebuild508
-rw-r--r--mail-mta/exim/exim-4.85.ebuild508
-rw-r--r--mail-mta/exim/exim-4.86.ebuild508
-rw-r--r--mail-mta/exim/files/auth_conf.sub25
-rw-r--r--mail-mta/exim/files/exim-4.14-tail.patch11
-rw-r--r--mail-mta/exim/files/exim-4.20-maildir.patch14
-rw-r--r--mail-mta/exim/files/exim-4.69-r1.27021.patch48
-rw-r--r--mail-mta/exim/files/exim-4.74-localscan_dlopen.patch262
-rw-r--r--mail-mta/exim/files/exim-4.74-radius-db-ENV-clash.patch22
-rw-r--r--mail-mta/exim/files/exim-4.76-crosscompile.patch15
-rw-r--r--mail-mta/exim/files/exim-4.76-dsn.patch18
-rw-r--r--mail-mta/exim/files/exim-4.77-as-needed-ldflags.patch144
-rw-r--r--mail-mta/exim/files/exim-4.77-makefile-freebsd.patch48
-rw-r--r--mail-mta/exim/files/exim-4.80-spool-mail-group.patch27
-rw-r--r--mail-mta/exim/files/exim-4.82-makefile-freebsd.patch45
-rw-r--r--mail-mta/exim/files/exim-submission.socket10
-rw-r--r--mail-mta/exim/files/exim-submission_at.service11
-rw-r--r--mail-mta/exim/files/exim.confd5
-rw-r--r--mail-mta/exim/files/exim.logrotate9
-rw-r--r--mail-mta/exim/files/exim.rc830
-rw-r--r--mail-mta/exim/files/exim.rc946
-rw-r--r--mail-mta/exim/files/exim.service12
-rw-r--r--mail-mta/exim/files/exim.socket10
-rw-r--r--mail-mta/exim/files/exim_482_dsn_1_3.patch1212
-rw-r--r--mail-mta/exim/files/exim_at.service7
-rw-r--r--mail-mta/exim/metadata.xml50
-rw-r--r--mail-mta/metadata.xml38
-rw-r--r--mail-mta/mini-qmail/Manifest4
-rw-r--r--mail-mta/mini-qmail/files/1.05-config-mini-help.patch16
-rw-r--r--mail-mta/mini-qmail/files/1.06-exit.patch18
-rw-r--r--mail-mta/mini-qmail/files/1.06-headers.patch37
-rw-r--r--mail-mta/mini-qmail/files/99qmail3
-rw-r--r--mail-mta/mini-qmail/files/config-mini38
-rw-r--r--mail-mta/mini-qmail/metadata.xml8
-rw-r--r--mail-mta/mini-qmail/mini-qmail-1.05-r1.ebuild98
-rw-r--r--mail-mta/mini-qmail/mini-qmail-1.05.ebuild106
-rw-r--r--mail-mta/mini-qmail/mini-qmail-1.06.ebuild70
-rw-r--r--mail-mta/msmtp/Manifest5
-rw-r--r--mail-mta/msmtp/metadata.xml12
-rw-r--r--mail-mta/msmtp/msmtp-1.4.31-r1.ebuild134
-rw-r--r--mail-mta/msmtp/msmtp-1.4.32.ebuild137
-rw-r--r--mail-mta/msmtp/msmtp-1.6.0.ebuild130
-rw-r--r--mail-mta/msmtp/msmtp-1.6.1.ebuild130
-rw-r--r--mail-mta/msmtp/msmtp-1.6.2.ebuild130
-rw-r--r--mail-mta/netqmail/Manifest7
-rw-r--r--mail-mta/netqmail/files/1.06-exit.patch18
-rw-r--r--mail-mta/netqmail/files/1.06-fbsd-utmpx.patch64
-rw-r--r--mail-mta/netqmail/files/1.06-readwrite.patch13
-rw-r--r--mail-mta/netqmail/files/genqmail-20080406-ldflags.patch13
-rw-r--r--mail-mta/netqmail/metadata.xml14
-rw-r--r--mail-mta/netqmail/netqmail-1.06-r1.ebuild162
-rw-r--r--mail-mta/netqmail/netqmail-1.06-r2.ebuild170
-rw-r--r--mail-mta/netqmail/netqmail-1.06.ebuild149
-rw-r--r--mail-mta/nullmailer/Manifest2
-rw-r--r--mail-mta/nullmailer/files/init.d-nullmailer-r451
-rw-r--r--mail-mta/nullmailer/files/nullmailer-1.13-unistd.h.patch28
-rw-r--r--mail-mta/nullmailer/files/nullmailer.service17
-rw-r--r--mail-mta/nullmailer/files/remotes.sample-1.1329
-rw-r--r--mail-mta/nullmailer/metadata.xml13
-rw-r--r--mail-mta/nullmailer/nullmailer-1.13-r5.ebuild168
-rw-r--r--mail-mta/opensmtpd/Manifest2
-rw-r--r--mail-mta/opensmtpd/files/smtpd.initd17
-rw-r--r--mail-mta/opensmtpd/files/smtpd.pam4
-rw-r--r--mail-mta/opensmtpd/files/smtpd.service10
-rw-r--r--mail-mta/opensmtpd/files/smtpd.socket8
-rw-r--r--mail-mta/opensmtpd/metadata.xml15
-rw-r--r--mail-mta/opensmtpd/opensmtpd-5.4.6.201506112227_p1.ebuild89
-rw-r--r--mail-mta/opensmtpd/opensmtpd-5.7.1_p1-r1.ebuild93
-rw-r--r--mail-mta/opensmtpd/opensmtpd-5.7.1_p1.ebuild89
-rw-r--r--mail-mta/postfix/Manifest7
-rw-r--r--mail-mta/postfix/files/postfix-2.11.1-db6.patch12
-rw-r--r--mail-mta/postfix/files/postfix-linux4.patch27
-rw-r--r--mail-mta/postfix/files/postfix.rc6.2.786
-rw-r--r--mail-mta/postfix/files/postfix.service13
-rw-r--r--mail-mta/postfix/files/smtp.pass3
-rw-r--r--mail-mta/postfix/files/smtp.sasl3
-rw-r--r--mail-mta/postfix/metadata.xml18
-rw-r--r--mail-mta/postfix/postfix-2.10.8.ebuild315
-rw-r--r--mail-mta/postfix/postfix-2.11.6.ebuild324
-rw-r--r--mail-mta/postfix/postfix-3.0.0.ebuild313
-rw-r--r--mail-mta/postfix/postfix-3.0.1-r1.ebuild313
-rw-r--r--mail-mta/postfix/postfix-3.0.2.ebuild317
-rw-r--r--mail-mta/postfix/postfix-3.1_pre20150721.ebuild312
-rw-r--r--mail-mta/qmail-ldap/Manifest7
-rw-r--r--mail-mta/qmail-ldap/files/1.03-warnings.patch55
-rw-r--r--mail-mta/qmail-ldap/files/samples.ldif32
-rw-r--r--mail-mta/qmail-ldap/metadata.xml19
-rw-r--r--mail-mta/qmail-ldap/qmail-ldap-1.03-r8.ebuild226
-rw-r--r--mail-mta/qpsmtpd/Manifest2
-rw-r--r--mail-mta/qpsmtpd/files/qpsmtpd-0.40-badrcptto_allowrelay.patch10
-rw-r--r--mail-mta/qpsmtpd/files/qpsmtpd-0.83-accept-empty-email.patch44
-rw-r--r--mail-mta/qpsmtpd/files/qpsmtpd-0.83-clamd_conf.patch12
-rw-r--r--mail-mta/qpsmtpd/files/qpsmtpd-0.84-Net-DNS-id.patch28
-rw-r--r--mail-mta/qpsmtpd/files/qpsmtpd.confd25
-rw-r--r--mail-mta/qpsmtpd/files/qpsmtpd.envd2
-rw-r--r--mail-mta/qpsmtpd/files/qpsmtpd.initd62
-rw-r--r--mail-mta/qpsmtpd/files/qpsmtpd.initd-r162
-rw-r--r--mail-mta/qpsmtpd/files/qpsmtpd.xinetd20
-rw-r--r--mail-mta/qpsmtpd/metadata.xml8
-rw-r--r--mail-mta/qpsmtpd/qpsmtpd-0.84-r2.ebuild81
-rw-r--r--mail-mta/qpsmtpd/qpsmtpd-0.95.ebuild93
-rw-r--r--mail-mta/qpsmtpd/qpsmtpd-9999.ebuild76
-rw-r--r--mail-mta/sendmail/Manifest1
-rw-r--r--mail-mta/sendmail/files/libmilter-sharedlib.patch55
-rw-r--r--mail-mta/sendmail/files/sendmail26
-rw-r--r--mail-mta/sendmail/files/sendmail-8.14.5+db-5.0.patch13
-rw-r--r--mail-mta/sendmail/files/sendmail-8.14.6-build-system.patch211
-rw-r--r--mail-mta/sendmail/files/sendmail-delivered_hdr.patch10
-rw-r--r--mail-mta/sendmail/files/sendmail-procmail.mc12
-rw-r--r--mail-mta/sendmail/files/sendmail-starttls-multi-crl.patch20
-rw-r--r--mail-mta/sendmail/files/sendmail.mc-r111
-rw-r--r--mail-mta/sendmail/files/sendmail.service15
-rw-r--r--mail-mta/sendmail/files/site.config.m416
-rw-r--r--mail-mta/sendmail/files/sm-client.service14
-rw-r--r--mail-mta/sendmail/metadata.xml5
-rw-r--r--mail-mta/sendmail/sendmail-8.14.9.ebuild203
-rw-r--r--mail-mta/ssmtp/Manifest2
-rw-r--r--mail-mta/ssmtp/metadata.xml8
-rw-r--r--mail-mta/ssmtp/ssmtp-2.64-r2.ebuild117
138 files changed, 11528 insertions, 0 deletions
diff --git a/mail-mta/courier/Manifest b/mail-mta/courier/Manifest
new file mode 100644
index 00000000000..8dddcd143f0
--- /dev/null
+++ b/mail-mta/courier/Manifest
@@ -0,0 +1,4 @@
+DIST courier-0.71.tar.bz2 7117940 SHA256 e06058ed6163bd7e706517ad183fb26faba00ff0ad649557123e5f33f265ebcd SHA512 08b02b006c978c4e1d12241d3f687a201e65afbd6a7ca49f10c77c4ddad0b1d89bb43169b1eb7cd90af30117ffa13911794da3f7dec3429c36b4bc3a9cf3cac8 WHIRLPOOL 47b1d5c4adbd1b387a2a2d412f7d55cc661b517e72bc7a29bec07c098dd5efffe91fa85c9ecae701049e0c08a7d4b1d1b777d24befe1103ad079eb9e8dd1e61c
+DIST courier-0.74.0.tar.bz2 6952034 SHA256 13865f9e21ed8b6786323aa228892a32593918b55379fbdb4f3fbc65425b6859 SHA512 df96ca0d47d0d3f118944e865eff880b2f42959ef5f62fa48c9c9a0948c431cc6911dac2f93ed0a7a22602de123676ad6076b01055ad773966134b3b6840a847 WHIRLPOOL ef0940506341f2f709ba61698ad2d34b47e28f7d9232d8e7c1de395380e43524dc03263efcd304b690aca14b125c7249c915d062e410560421a0572978786903
+DIST courier-0.74.1.tar.bz2 6951633 SHA256 b373c2b189affa01e8c2cfe9f60e6262bbcd98afa4e927b7fbbd68f478661ae6 SHA512 bcbb2a5b80c5e240587a75c7bb61c5620c7b43dc0bf707c8be5403856a125dfd18094b244d475f7d373f035df09c5b537e440815b5cca37afe6553e23117513a WHIRLPOOL c9e83048f920744babd1268a6804a5fcda834f4c6cf6cdc456402467567b93c7e773e57c1239a72662dd1eeab4494596b309a60071a06b2779a074981f913c3b
+DIST courier-0.75.0.tar.bz2 6970339 SHA256 2571a5b938649681ee98a2dc137f088aae0fd584cca3adf2dde1d826185406cc SHA512 37e66329f157e18176d4ac8c5e814be78e80ff7dec234886bec8dce2ae5c58ac68bc18e07c739295c25fae8ec778b162bab505d85ea0998db7192d52c47e7bc6 WHIRLPOOL 8cfd184beddb48e7e6efab4917372ec331d3e08f608abc6257ed408df96e100cf28226665fe1018b24e00e4336d705417484a6d890f11a6feb84045d9f969e17
diff --git a/mail-mta/courier/courier-0.71.ebuild b/mail-mta/courier/courier-0.71.ebuild
new file mode 100644
index 00000000000..c7252417266
--- /dev/null
+++ b/mail-mta/courier/courier-0.71.ebuild
@@ -0,0 +1,302 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic multilib
+
+DESCRIPTION="An MTA designed specifically for maildirs"
+SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
+HOMEPAGE="http://www.courier-mta.org/"
+SLOT="0"
+LICENSE="GPL-2"
+# not in keywords due to missing dependencies: ~arm ~s390 ~ppc64
+KEYWORDS="alpha amd64 hppa ia64 ppc sparc x86"
+IUSE="postgres ldap mysql pam nls ipv6 spell fax crypt norewrite \
+ fam web webmail gnutls"
+
+DEPEND="
+ >=net-libs/courier-authlib-0.61.0
+ !gnutls? ( >=dev-libs/openssl-0.9.6 )
+ gnutls? ( net-libs/gnutls )
+ >=sys-libs/gdbm-1.8.0
+ dev-libs/libpcre
+ app-misc/mime-types
+ fax? ( >=media-libs/netpbm-9.12 app-text/ghostscript-gpl >=net-dialup/mgetty-1.1.28 )
+ pam? ( virtual/pam )
+ mysql? ( virtual/mysql )
+ ldap? ( >=net-nds/openldap-1.2.11 )
+ postgres? ( dev-db/postgresql )
+ spell? ( app-text/aspell )
+ fam? ( virtual/fam )
+ !mail-filter/maildrop
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ !mail-mta/opensmtpd
+ !net-mail/dot-forward
+ !sys-apps/ucspi-tcp
+ "
+
+RDEPEND="${DEPEND}
+ dev-lang/perl
+ sys-process/procps"
+
+# get rid of old style virtual/imapd - bug 350792
+# all blockers really needed?
+RDEPEND="${RDEPEND}
+ !net-mail/bincimap
+ !net-mail/courier-imap
+ !net-mail/cyrus-imapd
+ !net-mail/uw-imap"
+
+PDEPEND="pam? ( net-mail/mailbase )
+ crypt? ( >=app-crypt/gnupg-1.0.4 )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ use norewrite && epatch "${FILESDIR}/norewrite.patch"
+}
+
+src_compile() {
+ filter-flags '-fomit-frame-pointer'
+
+ local myconf
+ myconf=""
+
+ use ldap && myconf="${myconf} --with-ldapconfig=/etc/courier/maildropldap.conf"
+
+ econf ${myconf} \
+ $(use_with fam) \
+ $(use_with ipv6) \
+ $(use_with spell ispell) \
+ $(use_with ldap ldapaliasd) \
+ $(use_enable ldap maildroldap) \
+ $(use_with gnutls) \
+ --enable-mimetypes=/etc/mime.types \
+ --prefix=/usr \
+ --disable-root-check \
+ --mandir=/usr/share/man \
+ --sysconfdir=/etc/courier \
+ --libexecdir=/usr/$(get_libdir)/courier \
+ --datadir=/usr/share/courier \
+ --sharedstatedir=/var/lib/courier/com \
+ --localstatedir=/var/lib/courier \
+ --with-piddir=/var/run/courier \
+ --with-authdaemonvar=/var/lib/courier/authdaemon \
+ --with-mailuser=mail \
+ --with-mailgroup=mail \
+ --with-paranoid-smtpext \
+ --with-db=gdbm \
+ --disable-autorenamesent \
+ --cache-file="${S}/configuring.cache" \
+ --host="${CHOST}" debug=true || die "./configure"
+ sed -e'/^install-perms-local:/a\ sed -e\"s|^|'"${D}"'|g\" -i permissions.dat' -i Makefile
+ emake || die "Compile problem"
+}
+
+etc_courier() {
+ # Import existing /etc/courier/file if it exists.
+ # Add option only if it was not already set or even commented out
+ file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"
+ [ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \
+ cp "/etc/courier/${file}" "${D}/etc/courier/${file}"
+ grep -q "${word}" "${D}/etc/courier/${file}" || \
+ echo "${2}" >> "${D}/etc/courier/${file}"
+}
+
+etc_courier_chg() {
+ file="${1}" ; key="${2}" ; value="${3}" ; section="${4}"
+ [ -z "${section}" ] && section="${2}"
+ grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}"
+ sed -i -e"/\#\#NAME: ${section}/,+30 s|${key}=.*|${key}=\"${value}\"|g" ${file}
+}
+
+src_install() {
+ local f
+ diropts -o mail -g mail
+ keepdir /var/lib/courier/tmp
+ keepdir /var/lib/courier/msgs
+ make install DESTDIR="${D}" || die "install"
+ make install-configure || die "install-configure"
+
+ # Get rid of files we dont want
+ if ! use webmail ; then
+ rm -rf "${D}/usr/$(get_libdir)/courier/courier/webmail" \
+ "${D}/usr/$(get_libdir)/courier/courier/sqwebmaild" \
+ "${D}/usr/share/courier/sqwebmail/" \
+ "${D}/usr/sbin/webmaild" \
+ "${D}/usr/sbin/webgpg" \
+ "${D}/etc/courier/webmail.authpam" \
+ "${D}/var/lib/courier/webmail-logincache" \
+ "${D}"/etc/courier/sqwebmaild*
+ fi
+
+ if ! use web ; then
+ rm -rf "${D}/usr/share/courier/courierwebadmin/" \
+ "${D}/etc/courier/webadmin"
+ fi
+
+ for dir2keep in $(cd "${D}" && find ./var/lib/courier -type d) ; do
+ keepdir "$dir2keep" || die "failed running keepdir: $dir2keep"
+ done
+
+ newinitd "${FILESDIR}/courier-init-r4" "courier"
+ use fam || sed -i -e's|^.*use famd$||g' "${D}/etc/init.d/courier"
+
+ cd "${D}/etc/courier"
+ if use webmail ; then
+ insinto /etc/courier
+ newins "${FILESDIR}/apache-sqwebmail.inc" apache-sqwebmail.inc
+ fi
+
+ for f in *.dist ; do cp "${f}" "${f%%.dist}" ; done
+ if use ldap ; then
+ [ -e ldapaliasrc ] && ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc )
+ else
+ rm -f ldapaliasrc
+ fi
+
+ ( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \
+ > "${D}/etc/courier/sizelimit"
+ etc_courier maildroprc ""
+ etc_courier esmtproutes ""
+ etc_courier backuprelay ""
+ etc_courier locallowercase ""
+ etc_courier bofh "opt BOFHBADMIME=accept"
+ etc_courier bofh "opt BOFHSPFTRUSTME=1"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none"
+ etc_courier bofh "opt BOFHSPFFROM=all"
+ etc_courier bofh "opt BOFHSPFMAILFROM=all"
+ etc_courier bofh "#opt BOFHSPFHARDERROR=fail"
+ etc_courier esmtpd "BOFHBADMIME=accept"
+ etc_courier esmtpd-ssl "BOFHBADMIME=accept"
+ etc_courier esmtpd-msa "BOFHBADMIME=accept"
+
+ use fam && etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
+ use fam || etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256"
+
+ # Fix for a sandbox violation on subsequential merges
+ # - ticho@gentoo.org, 2005-07-10
+ dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d
+ dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl
+ dosym /usr/share/courier/imapd /usr/sbin/courier-imapd
+ dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl
+
+ cd "${S}"
+ cp imap/README README.imap
+ use nls && cp unicode/README README.unicode
+ dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt
+ dodoc tcpd/README.couriertls
+ mv "${D}/usr/share/courier/htmldoc" "${D}/usr/share/doc/${PF}/html"
+
+ if use webmail ; then
+ insinto /usr/$(get_libdir)/courier/courier
+ insopts -m 755 -o mail -g mail
+ doins "${S}/courier/webmaild"
+ fi
+
+ if use web ; then
+ insinto /etc/courier/webadmin
+ insopts -m 400 -o mail -g mail
+ doins "${FILESDIR}/password.dist"
+ fi
+
+ # avoid name collisions in /usr/sbin, make webadmin match
+ cd "${D}/usr/sbin"
+ for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv "${f}" "courier-${f}" ; done
+ if use web ; then
+ sed -i -e 's:\$sbindir\/imapd:\$sbindir\/courier-imapd:g' \
+ -e 's:\$sbindir\/imapd-ssl:\$sbindir\/courier-imapd-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-40imap.pl" \
+ || ewarn "failed to fix webadmin"
+ sed -i -e 's:\$sbindir\/pop3d:\$sbindir\/courier-pop3d:g' \
+ -e 's:\$sbindir\/pop3d-ssl:\$sbindir\/courier-pop3d-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-45pop3.pl" \
+ || ewarn "failed to fix webadmin"
+ fi
+
+ # users should be able to send mail. Could be restricted with suictl.
+ chmod u+s "${D}/usr/bin/sendmail"
+
+ dosym /usr/bin/sendmail /usr/sbin/sendmail
+}
+
+src_test() {
+ if [ `whoami` != 'root' ]; then
+ emake -j1 check || die "Make check failed."
+ else
+ einfo "make check skipped, can't run as root."
+ einfo "You can enable it with FEATURES=\"userpriv\""
+ fi
+}
+
+pkg_postinst() {
+ use fam && elog "fam daemon is needed for courier-imapd" \
+ || ewarn "courier was built without fam support"
+}
+
+pkg_config() {
+ mailhost="$(hostname)"
+ export mailhost
+
+ domainname="$(domainname)"
+ if [ "x$domainname" = "x(none)" ] ; then
+ domainname="$(echo ${mailhost} | sed -e "s/[^\.]*\.\(.*\)/\1/")"
+ fi
+ export domainname
+
+ if [ "${ROOT}" = "/" ] ; then
+ file="${ROOT}/etc/courier/locals"
+ if [ ! -f "${file}" ] ; then
+ echo "localhost" > "${file}";
+ echo "${domainname}" >> "${file}";
+ fi
+ file="${ROOT}/etc/courier/esmtpacceptmailfor.dir/${domainname}"
+ if [ ! -f "${file}" ] ; then
+ echo "${domainname}" > "${file}"
+ /usr/sbin/makeacceptmailfor
+ fi
+
+ file="${ROOT}/etc/courier/smtpaccess/${domainname}"
+ if [ ! -f "${file}" ]
+ then
+ netstat -nr | grep "^[1-9]" | while read network gateway netmask rest
+ do
+ i=1
+ net=""
+ TIFS="${IFS}"
+ IFS="."
+ for o in "${netmask}"
+ do
+ if [ "${o}" == "255" ]
+ then
+ [ "_${net}" == "_" ] || net="${net}."
+ t="$(echo "${network}" | cut -d " " -f ${i})"
+ net="${net}${t}"
+ fi
+ i="$((${i} + 1))"
+ done
+ IFS="${TIFS}"
+ echo "doing configuration - relay control for the network ${net} !"
+ echo "${net} allow,RELAYCLIENT" >> ${file}
+ done
+ /usr/sbin/makesmtpaccess
+ fi
+ fi
+
+ echo "creating cert for esmtpd-ssl:"
+ /usr/sbin/mkesmtpdcert
+ echo "creating cert for imapd-ssl:"
+ /usr/sbin/mkpop3dcert
+ echo "creating cert for pop3d-ssl:"
+ /usr/sbin/mkimapdcert
+}
diff --git a/mail-mta/courier/courier-0.74.0.ebuild b/mail-mta/courier/courier-0.74.0.ebuild
new file mode 100644
index 00000000000..b02cb8fd85a
--- /dev/null
+++ b/mail-mta/courier/courier-0.74.0.ebuild
@@ -0,0 +1,305 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic multilib
+
+DESCRIPTION="An MTA designed specifically for maildirs"
+SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
+HOMEPAGE="http://www.courier-mta.org/"
+SLOT="0"
+LICENSE="GPL-2"
+# not in keywords due to missing dependencies:
+# ~arm ~s390 ~ppc64 ~alpha ~hppa ~ia64 ~ppc ~sparc ~x86
+KEYWORDS="~amd64 ~hppa ~x86"
+IUSE="postgres ldap mysql pam nls ipv6 spell fax crypt norewrite \
+ fam web webmail gnutls"
+
+DEPEND="
+ >=net-libs/courier-authlib-0.66.1
+ net-libs/courier-unicode
+ !gnutls? ( >=dev-libs/openssl-0.9.6 )
+ gnutls? ( net-libs/gnutls )
+ >=sys-libs/gdbm-1.8.0
+ dev-libs/libpcre
+ app-misc/mime-types
+ fax? ( >=media-libs/netpbm-9.12 app-text/ghostscript-gpl >=net-dialup/mgetty-1.1.28 )
+ pam? ( virtual/pam )
+ mysql? ( virtual/mysql )
+ ldap? ( >=net-nds/openldap-1.2.11 )
+ postgres? ( dev-db/postgresql )
+ spell? ( app-text/aspell )
+ fam? ( virtual/fam )
+ !mail-filter/maildrop
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ !mail-mta/opensmtpd
+ !net-mail/dot-forward
+ !sys-apps/ucspi-tcp
+ "
+
+RDEPEND="${DEPEND}
+ dev-lang/perl
+ sys-process/procps"
+
+# get rid of old style virtual/imapd - bug 350792
+# all blockers really needed?
+RDEPEND="${RDEPEND}
+ !net-mail/bincimap
+ !net-mail/courier-imap
+ !net-mail/cyrus-imapd
+ !net-mail/uw-imap"
+
+PDEPEND="pam? ( net-mail/mailbase )
+ crypt? ( >=app-crypt/gnupg-1.0.4 )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ use norewrite && epatch "${FILESDIR}/norewrite.patch"
+ epatch "${FILESDIR}/courier-0.74.0-fix-linking.diff"
+}
+
+src_compile() {
+ filter-flags '-fomit-frame-pointer'
+
+ local myconf
+ myconf=""
+
+ use ldap && myconf="${myconf} --with-ldapconfig=/etc/courier/maildropldap.conf"
+
+ econf ${myconf} \
+ $(use_with fam) \
+ $(use_with ipv6) \
+ $(use_with spell ispell) \
+ $(use_with ldap ldapaliasd) \
+ $(use_enable ldap maildroldap) \
+ $(use_with gnutls) \
+ --enable-mimetypes=/etc/mime.types \
+ --prefix=/usr \
+ --disable-root-check \
+ --mandir=/usr/share/man \
+ --sysconfdir=/etc/courier \
+ --libexecdir=/usr/$(get_libdir)/courier \
+ --datadir=/usr/share/courier \
+ --sharedstatedir=/var/lib/courier/com \
+ --localstatedir=/var/lib/courier \
+ --with-piddir=/var/run/courier \
+ --with-authdaemonvar=/var/lib/courier/authdaemon \
+ --with-mailuser=mail \
+ --with-mailgroup=mail \
+ --with-paranoid-smtpext \
+ --with-db=gdbm \
+ --disable-autorenamesent \
+ --cache-file="${S}/configuring.cache" \
+ --host="${CHOST}" debug=true || die "./configure"
+ sed -e'/^install-perms-local:/a\ sed -e\"s|^|'"${D}"'|g\" -i permissions.dat' -i Makefile
+ emake || die "Compile problem"
+}
+
+etc_courier() {
+ # Import existing /etc/courier/file if it exists.
+ # Add option only if it was not already set or even commented out
+ file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"
+ [ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \
+ cp "/etc/courier/${file}" "${D}/etc/courier/${file}"
+ grep -q "${word}" "${D}/etc/courier/${file}" || \
+ echo "${2}" >> "${D}/etc/courier/${file}"
+}
+
+etc_courier_chg() {
+ file="${1}" ; key="${2}" ; value="${3}" ; section="${4}"
+ [ -z "${section}" ] && section="${2}"
+ grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}"
+ sed -i -e"/\#\#NAME: ${section}/,+30 s|${key}=.*|${key}=\"${value}\"|g" ${file}
+}
+
+src_install() {
+ local f
+ diropts -o mail -g mail
+ keepdir /var/lib/courier/tmp
+ keepdir /var/lib/courier/msgs
+ make install DESTDIR="${D}" || die "install"
+ make install-configure || die "install-configure"
+
+ # Get rid of files we dont want
+ if ! use webmail ; then
+ rm -rf "${D}/usr/$(get_libdir)/courier/courier/webmail" \
+ "${D}/usr/$(get_libdir)/courier/courier/sqwebmaild" \
+ "${D}/usr/share/courier/sqwebmail/" \
+ "${D}/usr/sbin/webmaild" \
+ "${D}/usr/sbin/webgpg" \
+ "${D}/etc/courier/webmail.authpam" \
+ "${D}/var/lib/courier/webmail-logincache" \
+ "${D}"/etc/courier/sqwebmaild*
+ fi
+
+ if ! use web ; then
+ rm -rf "${D}/usr/share/courier/courierwebadmin/" \
+ "${D}/etc/courier/webadmin"
+ fi
+
+ for dir2keep in $(cd "${D}" && find ./var/lib/courier -type d) ; do
+ keepdir "$dir2keep" || die "failed running keepdir: $dir2keep"
+ done
+
+ newinitd "${FILESDIR}/courier-init-r4" "courier"
+ use fam || sed -i -e's|^.*use famd$||g' "${D}/etc/init.d/courier"
+
+ cd "${D}/etc/courier"
+ if use webmail ; then
+ insinto /etc/courier
+ newins "${FILESDIR}/apache-sqwebmail.inc" apache-sqwebmail.inc
+ fi
+
+ for f in *.dist ; do cp "${f}" "${f%%.dist}" ; done
+ if use ldap ; then
+ [ -e ldapaliasrc ] && ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc )
+ else
+ rm -f ldapaliasrc
+ fi
+
+ ( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \
+ > "${D}/etc/courier/sizelimit"
+ etc_courier maildroprc ""
+ etc_courier esmtproutes ""
+ etc_courier backuprelay ""
+ etc_courier locallowercase ""
+ etc_courier bofh "opt BOFHBADMIME=accept"
+ etc_courier bofh "opt BOFHSPFTRUSTME=1"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none"
+ etc_courier bofh "opt BOFHSPFFROM=all"
+ etc_courier bofh "opt BOFHSPFMAILFROM=all"
+ etc_courier bofh "#opt BOFHSPFHARDERROR=fail"
+ etc_courier esmtpd "BOFHBADMIME=accept"
+ etc_courier esmtpd-ssl "BOFHBADMIME=accept"
+ etc_courier esmtpd-msa "BOFHBADMIME=accept"
+
+ use fam && etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
+ use fam || etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256"
+
+ # Fix for a sandbox violation on subsequential merges
+ # - ticho@gentoo.org, 2005-07-10
+ dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d
+ dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl
+ dosym /usr/share/courier/imapd /usr/sbin/courier-imapd
+ dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl
+
+ cd "${S}"
+ cp imap/README README.imap
+ use nls && cp unicode/README README.unicode
+ dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt
+ dodoc tcpd/README.couriertls
+ mv "${D}/usr/share/courier/htmldoc" "${D}/usr/share/doc/${PF}/html"
+
+ if use webmail ; then
+ insinto /usr/$(get_libdir)/courier/courier
+ insopts -m 755 -o mail -g mail
+ doins "${S}/courier/webmaild"
+ fi
+
+ if use web ; then
+ insinto /etc/courier/webadmin
+ insopts -m 400 -o mail -g mail
+ doins "${FILESDIR}/password.dist"
+ fi
+
+ # avoid name collisions in /usr/sbin, make webadmin match
+ cd "${D}/usr/sbin"
+ for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv "${f}" "courier-${f}" ; done
+ if use web ; then
+ sed -i -e 's:\$sbindir\/imapd:\$sbindir\/courier-imapd:g' \
+ -e 's:\$sbindir\/imapd-ssl:\$sbindir\/courier-imapd-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-40imap.pl" \
+ || ewarn "failed to fix webadmin"
+ sed -i -e 's:\$sbindir\/pop3d:\$sbindir\/courier-pop3d:g' \
+ -e 's:\$sbindir\/pop3d-ssl:\$sbindir\/courier-pop3d-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-45pop3.pl" \
+ || ewarn "failed to fix webadmin"
+ fi
+
+ # users should be able to send mail. Could be restricted with suictl.
+ chmod u+s "${D}/usr/bin/sendmail"
+
+ dosym /usr/bin/sendmail /usr/sbin/sendmail
+}
+
+src_test() {
+ if [ `whoami` != 'root' ]; then
+ emake -j1 check || die "Make check failed."
+ else
+ einfo "make check skipped, can't run as root."
+ einfo "You can enable it with FEATURES=\"userpriv\""
+ fi
+}
+
+pkg_postinst() {
+ use fam && elog "fam daemon is needed for courier-imapd" \
+ || ewarn "courier was built without fam support"
+}
+
+pkg_config() {
+ mailhost="$(hostname)"
+ export mailhost
+
+ domainname="$(domainname)"
+ if [ "x$domainname" = "x(none)" ] ; then
+ domainname="$(echo ${mailhost} | sed -e "s/[^\.]*\.\(.*\)/\1/")"
+ fi
+ export domainname
+
+ if [ "${ROOT}" = "/" ] ; then
+ file="${ROOT}/etc/courier/locals"
+ if [ ! -f "${file}" ] ; then
+ echo "localhost" > "${file}";
+ echo "${domainname}" >> "${file}";
+ fi
+ file="${ROOT}/etc/courier/esmtpacceptmailfor.dir/${domainname}"
+ if [ ! -f "${file}" ] ; then
+ echo "${domainname}" > "${file}"
+ /usr/sbin/makeacceptmailfor
+ fi
+
+ file="${ROOT}/etc/courier/smtpaccess/${domainname}"
+ if [ ! -f "${file}" ]
+ then
+ netstat -nr | grep "^[1-9]" | while read network gateway netmask rest
+ do
+ i=1
+ net=""
+ TIFS="${IFS}"
+ IFS="."
+ for o in "${netmask}"
+ do
+ if [ "${o}" == "255" ]
+ then
+ [ "_${net}" == "_" ] || net="${net}."
+ t="$(echo "${network}" | cut -d " " -f ${i})"
+ net="${net}${t}"
+ fi
+ i="$((${i} + 1))"
+ done
+ IFS="${TIFS}"
+ echo "doing configuration - relay control for the network ${net} !"
+ echo "${net} allow,RELAYCLIENT" >> ${file}
+ done
+ /usr/sbin/makesmtpaccess
+ fi
+ fi
+
+ echo "creating cert for esmtpd-ssl:"
+ /usr/sbin/mkesmtpdcert
+ echo "creating cert for imapd-ssl:"
+ /usr/sbin/mkpop3dcert
+ echo "creating cert for pop3d-ssl:"
+ /usr/sbin/mkimapdcert
+}
diff --git a/mail-mta/courier/courier-0.74.1-r1.ebuild b/mail-mta/courier/courier-0.74.1-r1.ebuild
new file mode 100644
index 00000000000..1488c60ff82
--- /dev/null
+++ b/mail-mta/courier/courier-0.74.1-r1.ebuild
@@ -0,0 +1,309 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic multilib
+
+DESCRIPTION="An MTA designed specifically for maildirs"
+SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
+HOMEPAGE="http://www.courier-mta.org/"
+SLOT="0"
+LICENSE="GPL-2"
+# not in keywords due to missing dependencies:
+# ~arm ~s390 ~ppc64 ~alpha ~hppa ~ia64 ~ppc ~sparc ~x86
+KEYWORDS="amd64 ~arm hppa ppc ~x86"
+IUSE="postgres ldap mysql pam nls ipv6 spell fax crypt norewrite \
+ fam web webmail gnutls"
+
+DEPEND="
+ >=net-libs/courier-authlib-0.66.1
+ net-libs/courier-unicode
+ !gnutls? ( >=dev-libs/openssl-0.9.6 )
+ gnutls? ( net-libs/gnutls )
+ >=sys-libs/gdbm-1.8.0
+ dev-libs/libpcre
+ app-misc/mime-types
+ fax? ( >=media-libs/netpbm-9.12 app-text/ghostscript-gpl >=net-dialup/mgetty-1.1.28 )
+ pam? ( virtual/pam )
+ mysql? ( virtual/mysql )
+ ldap? ( >=net-nds/openldap-1.2.11 )
+ postgres? ( dev-db/postgresql )
+ spell? ( app-text/aspell )
+ fam? ( virtual/fam )
+ !mail-filter/maildrop
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ !mail-mta/opensmtpd
+ !net-mail/dot-forward
+ !sys-apps/ucspi-tcp
+ "
+
+RDEPEND="${DEPEND}
+ dev-lang/perl
+ sys-process/procps"
+
+# get rid of old style virtual/imapd - bug 350792
+# all blockers really needed?
+RDEPEND="${RDEPEND}
+ !net-mail/bincimap
+ !net-mail/courier-imap
+ !net-mail/cyrus-imapd
+ !net-mail/uw-imap"
+
+PDEPEND="pam? ( net-mail/mailbase )
+ crypt? ( >=app-crypt/gnupg-1.0.4 )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}/courier-0.74.1-fix-testsuite.diff"
+ epatch "${FILESDIR}/courier-0.74.1-fix-implicit-declaration-warning.diff"
+ use norewrite && epatch "${FILESDIR}/norewrite.patch"
+}
+
+src_compile() {
+ filter-flags '-fomit-frame-pointer'
+
+ local myconf
+ myconf=""
+
+ use ldap && myconf="${myconf} --with-ldapconfig=/etc/courier/maildropldap.conf"
+
+ econf ${myconf} \
+ $(use_with fam) \
+ $(use_with ipv6) \
+ $(use_with spell ispell) \
+ $(use_with ldap ldapaliasd) \
+ $(use_enable ldap maildroldap) \
+ $(use_with gnutls) \
+ --enable-mimetypes=/etc/mime.types \
+ --prefix=/usr \
+ --disable-root-check \
+ --mandir=/usr/share/man \
+ --sysconfdir=/etc/courier \
+ --libexecdir=/usr/$(get_libdir)/courier \
+ --datadir=/usr/share/courier \
+ --sharedstatedir=/var/lib/courier/com \
+ --localstatedir=/var/lib/courier \
+ --with-piddir=/var/run/courier \
+ --with-authdaemonvar=/var/lib/courier/authdaemon \
+ --with-mailuser=mail \
+ --with-mailgroup=mail \
+ --with-paranoid-smtpext \
+ --with-db=gdbm \
+ --disable-autorenamesent \
+ --cache-file="${S}/configuring.cache" \
+ --host="${CHOST}" debug=true || die "./configure"
+ sed -e'/^install-perms-local:/a\ sed -e\"s|^|'"${D}"'|g\" -i permissions.dat' -i Makefile
+ emake || die "Compile problem"
+}
+
+etc_courier() {
+ # Import existing /etc/courier/file if it exists.
+ # Add option only if it was not already set or even commented out
+ file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"
+ [ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \
+ cp "/etc/courier/${file}" "${D}/etc/courier/${file}"
+ grep -q "${word}" "${D}/etc/courier/${file}" || \
+ echo "${2}" >> "${D}/etc/courier/${file}"
+}
+
+etc_courier_chg() {
+ file="${1}" ; key="${2}" ; value="${3}" ; section="${4}"
+ [ -z "${section}" ] && section="${2}"
+ grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}"
+ sed -i -e"/\#\#NAME: ${section}/,+30 s|${key}=.*|${key}=\"${value}\"|g" ${file}
+}
+
+src_install() {
+ local f
+ diropts -o mail -g mail
+ keepdir /var/lib/courier/tmp
+ keepdir /var/lib/courier/msgs
+ make install DESTDIR="${D}" || die "install"
+ make install-configure || die "install-configure"
+
+ # init script takes care of this
+ rm -rf "${D}/var/run"
+
+ # Get rid of files we dont want
+ if ! use webmail ; then
+ rm -rf "${D}/usr/$(get_libdir)/courier/courier/webmail" \
+ "${D}/usr/$(get_libdir)/courier/courier/sqwebmaild" \
+ "${D}/usr/share/courier/sqwebmail/" \
+ "${D}/usr/sbin/webmaild" \
+ "${D}/usr/sbin/webgpg" \
+ "${D}/etc/courier/webmail.authpam" \
+ "${D}/var/lib/courier/webmail-logincache" \
+ "${D}"/etc/courier/sqwebmaild*
+ fi
+
+ if ! use web ; then
+ rm -rf "${D}/usr/share/courier/courierwebadmin/" \
+ "${D}/etc/courier/webadmin"
+ fi
+
+ for dir2keep in $(cd "${D}" && find ./var/lib/courier -type d) ; do
+ keepdir "$dir2keep" || die "failed running keepdir: $dir2keep"
+ done
+
+ newinitd "${FILESDIR}/courier-init-r4" "courier"
+ use fam || sed -i -e's|^.*use famd$||g' "${D}/etc/init.d/courier"
+
+ cd "${D}/etc/courier"
+ if use webmail ; then
+ insinto /etc/courier
+ newins "${FILESDIR}/apache-sqwebmail.inc" apache-sqwebmail.inc
+ fi
+
+ for f in *.dist ; do cp "${f}" "${f%%.dist}" ; done
+ if use ldap ; then
+ [ -e ldapaliasrc ] && ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc )
+ else
+ rm -f ldapaliasrc
+ fi
+
+ ( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \
+ > "${D}/etc/courier/sizelimit"
+ etc_courier maildroprc ""
+ etc_courier esmtproutes ""
+ etc_courier backuprelay ""
+ etc_courier locallowercase ""
+ etc_courier bofh "opt BOFHBADMIME=accept"
+ etc_courier bofh "opt BOFHSPFTRUSTME=1"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none"
+ etc_courier bofh "opt BOFHSPFFROM=all"
+ etc_courier bofh "opt BOFHSPFMAILFROM=all"
+ etc_courier bofh "#opt BOFHSPFHARDERROR=fail"
+ etc_courier esmtpd "BOFHBADMIME=accept"
+ etc_courier esmtpd-ssl "BOFHBADMIME=accept"
+ etc_courier esmtpd-msa "BOFHBADMIME=accept"
+
+ use fam && etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
+ use fam || etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256"
+
+ # Fix for a sandbox violation on subsequential merges
+ # - ticho@gentoo.org, 2005-07-10
+ dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d
+ dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl
+ dosym /usr/share/courier/imapd /usr/sbin/courier-imapd
+ dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl
+
+ cd "${S}"
+ cp imap/README README.imap
+ use nls && cp unicode/README README.unicode
+ dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt
+ dodoc libs/tcpd/README.couriertls
+ mv "${D}/usr/share/courier/htmldoc" "${D}/usr/share/doc/${PF}/html"
+
+ if use webmail ; then
+ insinto /usr/$(get_libdir)/courier/courier
+ insopts -m 755 -o mail -g mail
+ doins "${S}/courier/webmaild"
+ fi
+
+ if use web ; then
+ insinto /etc/courier/webadmin
+ insopts -m 400 -o mail -g mail
+ doins "${FILESDIR}/password.dist"
+ fi
+
+ # avoid name collisions in /usr/sbin, make webadmin match
+ cd "${D}/usr/sbin"
+ for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv "${f}" "courier-${f}" ; done
+ if use web ; then
+ sed -i -e 's:\$sbindir\/imapd:\$sbindir\/courier-imapd:g' \
+ -e 's:\$sbindir\/imapd-ssl:\$sbindir\/courier-imapd-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-40imap.pl" \
+ || ewarn "failed to fix webadmin"
+ sed -i -e 's:\$sbindir\/pop3d:\$sbindir\/courier-pop3d:g' \
+ -e 's:\$sbindir\/pop3d-ssl:\$sbindir\/courier-pop3d-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-45pop3.pl" \
+ || ewarn "failed to fix webadmin"
+ fi
+
+ # users should be able to send mail. Could be restricted with suictl.
+ chmod u+s "${D}/usr/bin/sendmail"
+
+ dosym /usr/bin/sendmail /usr/sbin/sendmail
+}
+
+src_test() {
+ if [ `whoami` != 'root' ]; then
+ emake -j1 check || die "Make check failed."
+ else
+ einfo "make check skipped, can't run as root."
+ einfo "You can enable it with FEATURES=\"userpriv\""
+ fi
+}
+
+pkg_postinst() {
+ use fam && elog "fam daemon is needed for courier-imapd" \
+ || ewarn "courier was built without fam support"
+}
+
+pkg_config() {
+ mailhost="$(hostname)"
+ export mailhost
+
+ domainname="$(domainname)"
+ if [ "x$domainname" = "x(none)" ] ; then
+ domainname="$(echo ${mailhost} | sed -e "s/[^\.]*\.\(.*\)/\1/")"
+ fi
+ export domainname
+
+ if [ "${ROOT}" = "/" ] ; then
+ file="${ROOT}/etc/courier/locals"
+ if [ ! -f "${file}" ] ; then
+ echo "localhost" > "${file}";
+ echo "${domainname}" >> "${file}";
+ fi
+ file="${ROOT}/etc/courier/esmtpacceptmailfor.dir/${domainname}"
+ if [ ! -f "${file}" ] ; then
+ echo "${domainname}" > "${file}"
+ /usr/sbin/makeacceptmailfor
+ fi
+
+ file="${ROOT}/etc/courier/smtpaccess/${domainname}"
+ if [ ! -f "${file}" ]
+ then
+ netstat -nr | grep "^[1-9]" | while read network gateway netmask rest
+ do
+ i=1
+ net=""
+ TIFS="${IFS}"
+ IFS="."
+ for o in "${netmask}"
+ do
+ if [ "${o}" == "255" ]
+ then
+ [ "_${net}" == "_" ] || net="${net}."
+ t="$(echo "${network}" | cut -d " " -f ${i})"
+ net="${net}${t}"
+ fi
+ i="$((${i} + 1))"
+ done
+ IFS="${TIFS}"
+ echo "doing configuration - relay control for the network ${net} !"
+ echo "${net} allow,RELAYCLIENT" >> ${file}
+ done
+ /usr/sbin/makesmtpaccess
+ fi
+ fi
+
+ echo "creating cert for esmtpd-ssl:"
+ /usr/sbin/mkesmtpdcert
+ echo "creating cert for imapd-ssl:"
+ /usr/sbin/mkpop3dcert
+ echo "creating cert for pop3d-ssl:"
+ /usr/sbin/mkimapdcert
+}
diff --git a/mail-mta/courier/courier-0.74.1.ebuild b/mail-mta/courier/courier-0.74.1.ebuild
new file mode 100644
index 00000000000..dfc607b8fba
--- /dev/null
+++ b/mail-mta/courier/courier-0.74.1.ebuild
@@ -0,0 +1,304 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic multilib
+
+DESCRIPTION="An MTA designed specifically for maildirs"
+SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
+HOMEPAGE="http://www.courier-mta.org/"
+SLOT="0"
+LICENSE="GPL-2"
+# not in keywords due to missing dependencies:
+# ~arm ~s390 ~ppc64 ~alpha ~hppa ~ia64 ~ppc ~sparc ~x86
+KEYWORDS="~amd64 ~hppa ~x86"
+IUSE="postgres ldap mysql pam nls ipv6 spell fax crypt norewrite \
+ fam web webmail gnutls"
+
+DEPEND="
+ >=net-libs/courier-authlib-0.66.1
+ net-libs/courier-unicode
+ !gnutls? ( >=dev-libs/openssl-0.9.6 )
+ gnutls? ( net-libs/gnutls )
+ >=sys-libs/gdbm-1.8.0
+ dev-libs/libpcre
+ app-misc/mime-types
+ fax? ( >=media-libs/netpbm-9.12 app-text/ghostscript-gpl >=net-dialup/mgetty-1.1.28 )
+ pam? ( virtual/pam )
+ mysql? ( virtual/mysql )
+ ldap? ( >=net-nds/openldap-1.2.11 )
+ postgres? ( dev-db/postgresql )
+ spell? ( app-text/aspell )
+ fam? ( virtual/fam )
+ !mail-filter/maildrop
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ !mail-mta/opensmtpd
+ !net-mail/dot-forward
+ !sys-apps/ucspi-tcp
+ "
+
+RDEPEND="${DEPEND}
+ dev-lang/perl
+ sys-process/procps"
+
+# get rid of old style virtual/imapd - bug 350792
+# all blockers really needed?
+RDEPEND="${RDEPEND}
+ !net-mail/bincimap
+ !net-mail/courier-imap
+ !net-mail/cyrus-imapd
+ !net-mail/uw-imap"
+
+PDEPEND="pam? ( net-mail/mailbase )
+ crypt? ( >=app-crypt/gnupg-1.0.4 )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ use norewrite && epatch "${FILESDIR}/norewrite.patch"
+}
+
+src_compile() {
+ filter-flags '-fomit-frame-pointer'
+
+ local myconf
+ myconf=""
+
+ use ldap && myconf="${myconf} --with-ldapconfig=/etc/courier/maildropldap.conf"
+
+ econf ${myconf} \
+ $(use_with fam) \
+ $(use_with ipv6) \
+ $(use_with spell ispell) \
+ $(use_with ldap ldapaliasd) \
+ $(use_enable ldap maildroldap) \
+ $(use_with gnutls) \
+ --enable-mimetypes=/etc/mime.types \
+ --prefix=/usr \
+ --disable-root-check \
+ --mandir=/usr/share/man \
+ --sysconfdir=/etc/courier \
+ --libexecdir=/usr/$(get_libdir)/courier \
+ --datadir=/usr/share/courier \
+ --sharedstatedir=/var/lib/courier/com \
+ --localstatedir=/var/lib/courier \
+ --with-piddir=/var/run/courier \
+ --with-authdaemonvar=/var/lib/courier/authdaemon \
+ --with-mailuser=mail \
+ --with-mailgroup=mail \
+ --with-paranoid-smtpext \
+ --with-db=gdbm \
+ --disable-autorenamesent \
+ --cache-file="${S}/configuring.cache" \
+ --host="${CHOST}" debug=true || die "./configure"
+ sed -e'/^install-perms-local:/a\ sed -e\"s|^|'"${D}"'|g\" -i permissions.dat' -i Makefile
+ emake || die "Compile problem"
+}
+
+etc_courier() {
+ # Import existing /etc/courier/file if it exists.
+ # Add option only if it was not already set or even commented out
+ file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"
+ [ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \
+ cp "/etc/courier/${file}" "${D}/etc/courier/${file}"
+ grep -q "${word}" "${D}/etc/courier/${file}" || \
+ echo "${2}" >> "${D}/etc/courier/${file}"
+}
+
+etc_courier_chg() {
+ file="${1}" ; key="${2}" ; value="${3}" ; section="${4}"
+ [ -z "${section}" ] && section="${2}"
+ grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}"
+ sed -i -e"/\#\#NAME: ${section}/,+30 s|${key}=.*|${key}=\"${value}\"|g" ${file}
+}
+
+src_install() {
+ local f
+ diropts -o mail -g mail
+ keepdir /var/lib/courier/tmp
+ keepdir /var/lib/courier/msgs
+ make install DESTDIR="${D}" || die "install"
+ make install-configure || die "install-configure"
+
+ # Get rid of files we dont want
+ if ! use webmail ; then
+ rm -rf "${D}/usr/$(get_libdir)/courier/courier/webmail" \
+ "${D}/usr/$(get_libdir)/courier/courier/sqwebmaild" \
+ "${D}/usr/share/courier/sqwebmail/" \
+ "${D}/usr/sbin/webmaild" \
+ "${D}/usr/sbin/webgpg" \
+ "${D}/etc/courier/webmail.authpam" \
+ "${D}/var/lib/courier/webmail-logincache" \
+ "${D}"/etc/courier/sqwebmaild*
+ fi
+
+ if ! use web ; then
+ rm -rf "${D}/usr/share/courier/courierwebadmin/" \
+ "${D}/etc/courier/webadmin"
+ fi
+
+ for dir2keep in $(cd "${D}" && find ./var/lib/courier -type d) ; do
+ keepdir "$dir2keep" || die "failed running keepdir: $dir2keep"
+ done
+
+ newinitd "${FILESDIR}/courier-init-r4" "courier"
+ use fam || sed -i -e's|^.*use famd$||g' "${D}/etc/init.d/courier"
+
+ cd "${D}/etc/courier"
+ if use webmail ; then
+ insinto /etc/courier
+ newins "${FILESDIR}/apache-sqwebmail.inc" apache-sqwebmail.inc
+ fi
+
+ for f in *.dist ; do cp "${f}" "${f%%.dist}" ; done
+ if use ldap ; then
+ [ -e ldapaliasrc ] && ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc )
+ else
+ rm -f ldapaliasrc
+ fi
+
+ ( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \
+ > "${D}/etc/courier/sizelimit"
+ etc_courier maildroprc ""
+ etc_courier esmtproutes ""
+ etc_courier backuprelay ""
+ etc_courier locallowercase ""
+ etc_courier bofh "opt BOFHBADMIME=accept"
+ etc_courier bofh "opt BOFHSPFTRUSTME=1"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none"
+ etc_courier bofh "opt BOFHSPFFROM=all"
+ etc_courier bofh "opt BOFHSPFMAILFROM=all"
+ etc_courier bofh "#opt BOFHSPFHARDERROR=fail"
+ etc_courier esmtpd "BOFHBADMIME=accept"
+ etc_courier esmtpd-ssl "BOFHBADMIME=accept"
+ etc_courier esmtpd-msa "BOFHBADMIME=accept"
+
+ use fam && etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
+ use fam || etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256"
+
+ # Fix for a sandbox violation on subsequential merges
+ # - ticho@gentoo.org, 2005-07-10
+ dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d
+ dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl
+ dosym /usr/share/courier/imapd /usr/sbin/courier-imapd
+ dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl
+
+ cd "${S}"
+ cp imap/README README.imap
+ use nls && cp unicode/README README.unicode
+ dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt
+ dodoc tcpd/README.couriertls
+ mv "${D}/usr/share/courier/htmldoc" "${D}/usr/share/doc/${PF}/html"
+
+ if use webmail ; then
+ insinto /usr/$(get_libdir)/courier/courier
+ insopts -m 755 -o mail -g mail
+ doins "${S}/courier/webmaild"
+ fi
+
+ if use web ; then
+ insinto /etc/courier/webadmin
+ insopts -m 400 -o mail -g mail
+ doins "${FILESDIR}/password.dist"
+ fi
+
+ # avoid name collisions in /usr/sbin, make webadmin match
+ cd "${D}/usr/sbin"
+ for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv "${f}" "courier-${f}" ; done
+ if use web ; then
+ sed -i -e 's:\$sbindir\/imapd:\$sbindir\/courier-imapd:g' \
+ -e 's:\$sbindir\/imapd-ssl:\$sbindir\/courier-imapd-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-40imap.pl" \
+ || ewarn "failed to fix webadmin"
+ sed -i -e 's:\$sbindir\/pop3d:\$sbindir\/courier-pop3d:g' \
+ -e 's:\$sbindir\/pop3d-ssl:\$sbindir\/courier-pop3d-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-45pop3.pl" \
+ || ewarn "failed to fix webadmin"
+ fi
+
+ # users should be able to send mail. Could be restricted with suictl.
+ chmod u+s "${D}/usr/bin/sendmail"
+
+ dosym /usr/bin/sendmail /usr/sbin/sendmail
+}
+
+src_test() {
+ if [ `whoami` != 'root' ]; then
+ emake -j1 check || die "Make check failed."
+ else
+ einfo "make check skipped, can't run as root."
+ einfo "You can enable it with FEATURES=\"userpriv\""
+ fi
+}
+
+pkg_postinst() {
+ use fam && elog "fam daemon is needed for courier-imapd" \
+ || ewarn "courier was built without fam support"
+}
+
+pkg_config() {
+ mailhost="$(hostname)"
+ export mailhost
+
+ domainname="$(domainname)"
+ if [ "x$domainname" = "x(none)" ] ; then
+ domainname="$(echo ${mailhost} | sed -e "s/[^\.]*\.\(.*\)/\1/")"
+ fi
+ export domainname
+
+ if [ "${ROOT}" = "/" ] ; then
+ file="${ROOT}/etc/courier/locals"
+ if [ ! -f "${file}" ] ; then
+ echo "localhost" > "${file}";
+ echo "${domainname}" >> "${file}";
+ fi
+ file="${ROOT}/etc/courier/esmtpacceptmailfor.dir/${domainname}"
+ if [ ! -f "${file}" ] ; then
+ echo "${domainname}" > "${file}"
+ /usr/sbin/makeacceptmailfor
+ fi
+
+ file="${ROOT}/etc/courier/smtpaccess/${domainname}"
+ if [ ! -f "${file}" ]
+ then
+ netstat -nr | grep "^[1-9]" | while read network gateway netmask rest
+ do
+ i=1
+ net=""
+ TIFS="${IFS}"
+ IFS="."
+ for o in "${netmask}"
+ do
+ if [ "${o}" == "255" ]
+ then
+ [ "_${net}" == "_" ] || net="${net}."
+ t="$(echo "${network}" | cut -d " " -f ${i})"
+ net="${net}${t}"
+ fi
+ i="$((${i} + 1))"
+ done
+ IFS="${TIFS}"
+ echo "doing configuration - relay control for the network ${net} !"
+ echo "${net} allow,RELAYCLIENT" >> ${file}
+ done
+ /usr/sbin/makesmtpaccess
+ fi
+ fi
+
+ echo "creating cert for esmtpd-ssl:"
+ /usr/sbin/mkesmtpdcert
+ echo "creating cert for imapd-ssl:"
+ /usr/sbin/mkpop3dcert
+ echo "creating cert for pop3d-ssl:"
+ /usr/sbin/mkimapdcert
+}
diff --git a/mail-mta/courier/courier-0.75.0.ebuild b/mail-mta/courier/courier-0.75.0.ebuild
new file mode 100644
index 00000000000..fe94bc20d40
--- /dev/null
+++ b/mail-mta/courier/courier-0.75.0.ebuild
@@ -0,0 +1,311 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic multilib
+
+DESCRIPTION="An MTA designed specifically for maildirs"
+SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
+HOMEPAGE="http://www.courier-mta.org/"
+SLOT="0"
+LICENSE="GPL-2"
+# not in keywords due to missing dependencies:
+# ~s390 ~ppc64 ~alpha ~ia64 ~sparc ~x86
+KEYWORDS="alpha amd64 ~arm hppa ia64 ppc sparc x86"
+IUSE="postgres ldap mysql pam nls ipv6 spell fax crypt norewrite \
+ fam web webmail gnutls"
+
+DEPEND="
+ >=net-libs/courier-authlib-0.66.3
+ >=net-libs/courier-unicode-1.3
+ !gnutls? ( dev-libs/openssl:= )
+ gnutls? ( net-libs/gnutls )
+ >=sys-libs/gdbm-1.8.0
+ dev-libs/libpcre
+ app-misc/mime-types
+ fax? ( >=media-libs/netpbm-9.12 app-text/ghostscript-gpl >=net-dialup/mgetty-1.1.28 )
+ pam? ( virtual/pam )
+ mysql? ( virtual/mysql )
+ ldap? ( >=net-nds/openldap-1.2.11 )
+ postgres? ( dev-db/postgresql:= )
+ spell? ( app-text/aspell )
+ fam? ( virtual/fam )
+ !mail-filter/maildrop
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ !mail-mta/opensmtpd
+ !net-mail/dot-forward
+ !sys-apps/ucspi-tcp
+ "
+
+RDEPEND="${DEPEND}
+ dev-lang/perl
+ sys-process/procps"
+
+# get rid of old style virtual/imapd - bug 350792
+# all blockers really needed?
+RDEPEND="${RDEPEND}
+ !net-mail/bincimap
+ !net-mail/courier-imap
+ !net-mail/cyrus-imapd
+ !net-mail/uw-imap"
+
+PDEPEND="pam? ( net-mail/mailbase )
+ crypt? ( >=app-crypt/gnupg-1.0.4 )"
+
+src_prepare() {
+# unpack ${A}
+# cd "${S}"
+ use norewrite && epatch "${FILESDIR}/norewrite.patch"
+}
+
+src_configure() {
+ filter-flags '-fomit-frame-pointer'
+
+ local myconf
+ myconf=""
+
+ use ldap && myconf="${myconf} --with-ldapconfig=/etc/courier/maildropldap.conf"
+
+ econf ${myconf} \
+ $(use_with fam) \
+ $(use_with ipv6) \
+ $(use_with spell ispell) \
+ $(use_with ldap ldapaliasd) \
+ $(use_enable ldap maildroldap) \
+ $(use_with gnutls) \
+ --enable-mimetypes=/etc/mime.types \
+ --prefix=/usr \
+ --disable-root-check \
+ --mandir=/usr/share/man \
+ --sysconfdir=/etc/courier \
+ --libexecdir=/usr/$(get_libdir)/courier \
+ --datadir=/usr/share/courier \
+ --sharedstatedir=/var/lib/courier/com \
+ --localstatedir=/var/lib/courier \
+ --with-piddir=/var/run/courier \
+ --with-authdaemonvar=/var/lib/courier/authdaemon \
+ --with-mailuser=mail \
+ --with-mailgroup=mail \
+ --with-paranoid-smtpext \
+ --with-db=gdbm \
+ --disable-autorenamesent \
+ --cache-file="${S}/configuring.cache" \
+ --host="${CHOST}" debug=true || die "./configure"
+ sed -e'/^install-perms-local:/a\ sed -e\"s|^|'"${D}"'|g\" -i permissions.dat' -i Makefile
+}
+
+src_compile() {
+ default
+}
+
+etc_courier() {
+ # Import existing /etc/courier/file if it exists.
+ # Add option only if it was not already set or even commented out
+ file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"
+ [ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \
+ cp "/etc/courier/${file}" "${D}/etc/courier/${file}"
+ grep -q "${word}" "${D}/etc/courier/${file}" || \
+ echo "${2}" >> "${D}/etc/courier/${file}"
+}
+
+etc_courier_chg() {
+ file="${1}" ; key="${2}" ; value="${3}" ; section="${4}"
+ [ -z "${section}" ] && section="${2}"
+ grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}"
+ sed -i -e"/\#\#NAME: ${section}/,+30 s|${key}=.*|${key}=\"${value}\"|g" ${file}
+}
+
+src_install() {
+ local f
+ diropts -o mail -g mail
+ keepdir /var/lib/courier/tmp
+ keepdir /var/lib/courier/msgs
+ make install DESTDIR="${D}" || die "install"
+ make install-configure || die "install-configure"
+
+ # init script takes care of this
+ rm -rf "${D}/var/run"
+
+ # Get rid of files we dont want
+ if ! use webmail ; then
+ rm -rf "${D}/usr/$(get_libdir)/courier/courier/webmail" \
+ "${D}/usr/$(get_libdir)/courier/courier/sqwebmaild" \
+ "${D}/usr/share/courier/sqwebmail/" \
+ "${D}/usr/sbin/webmaild" \
+ "${D}/usr/sbin/webgpg" \
+ "${D}/etc/courier/webmail.authpam" \
+ "${D}/var/lib/courier/webmail-logincache" \
+ "${D}"/etc/courier/sqwebmaild*
+ fi
+
+ if ! use web ; then
+ rm -rf "${D}/usr/share/courier/courierwebadmin/" \
+ "${D}/etc/courier/webadmin"
+ fi
+
+ for dir2keep in $(cd "${D}" && find ./var/lib/courier -type d) ; do
+ keepdir "$dir2keep" || die "failed running keepdir: $dir2keep"
+ done
+
+ newinitd "${FILESDIR}/courier-init-r4" "courier"
+ use fam || sed -i -e's|^.*use famd$||g' "${D}/etc/init.d/courier"
+
+ cd "${D}/etc/courier"
+ if use webmail ; then
+ insinto /etc/courier
+ newins "${FILESDIR}/apache-sqwebmail.inc" apache-sqwebmail.inc
+ fi
+
+ for f in *.dist ; do cp "${f}" "${f%%.dist}" ; done
+ if use ldap ; then
+ [ -e ldapaliasrc ] && ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc )
+ else
+ rm -f ldapaliasrc
+ fi
+
+ ( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \
+ > "${D}/etc/courier/sizelimit"
+ etc_courier maildroprc ""
+ etc_courier esmtproutes ""
+ etc_courier backuprelay ""
+ etc_courier locallowercase ""
+ etc_courier bofh "opt BOFHBADMIME=accept"
+ etc_courier bofh "opt BOFHSPFTRUSTME=1"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail"
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none"
+ etc_courier bofh "opt BOFHSPFFROM=all"
+ etc_courier bofh "opt BOFHSPFMAILFROM=all"
+ etc_courier bofh "#opt BOFHSPFHARDERROR=fail"
+ etc_courier esmtpd "BOFHBADMIME=accept"
+ etc_courier esmtpd-ssl "BOFHBADMIME=accept"
+ etc_courier esmtpd-msa "BOFHBADMIME=accept"
+
+ use fam && etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
+ use fam || etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256"
+
+ # Fix for a sandbox violation on subsequential merges
+ # - ticho@gentoo.org, 2005-07-10
+ dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d
+ dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl
+ dosym /usr/share/courier/imapd /usr/sbin/courier-imapd
+ dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl
+
+ cd "${S}"
+ cp imap/README README.imap
+ use nls && cp unicode/README README.unicode
+ dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt
+ dodoc libs/tcpd/README.couriertls
+ mv "${D}/usr/share/courier/htmldoc" "${D}/usr/share/doc/${PF}/html"
+
+ if use webmail ; then
+ insinto /usr/$(get_libdir)/courier/courier
+ insopts -m 755 -o mail -g mail
+ doins "${S}/courier/webmaild"
+ fi
+
+ if use web ; then
+ insinto /etc/courier/webadmin
+ insopts -m 400 -o mail -g mail
+ doins "${FILESDIR}/password.dist"
+ fi
+
+ # avoid name collisions in /usr/sbin, make webadmin match
+ cd "${D}/usr/sbin"
+ for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv "${f}" "courier-${f}" ; done
+ if use web ; then
+ sed -i -e 's:\$sbindir\/imapd:\$sbindir\/courier-imapd:g' \
+ -e 's:\$sbindir\/imapd-ssl:\$sbindir\/courier-imapd-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-40imap.pl" \
+ || ewarn "failed to fix webadmin"
+ sed -i -e 's:\$sbindir\/pop3d:\$sbindir\/courier-pop3d:g' \
+ -e 's:\$sbindir\/pop3d-ssl:\$sbindir\/courier-pop3d-ssl:g' \
+ "${D}/usr/share/courier/courierwebadmin/admin-45pop3.pl" \
+ || ewarn "failed to fix webadmin"
+ fi
+
+ # users should be able to send mail. Could be restricted with suictl.
+ chmod u+s "${D}/usr/bin/sendmail"
+
+ dosym /usr/bin/sendmail /usr/sbin/sendmail
+}
+
+src_test() {
+ if [ `whoami` != 'root' ]; then
+ emake -j1 check || die "Make check failed."
+ else
+ einfo "make check skipped, can't run as root."
+ einfo "You can enable it with FEATURES=\"userpriv\""
+ fi
+}
+
+pkg_postinst() {
+ use fam && elog "fam daemon is needed for courier-imapd" \
+ || ewarn "courier was built without fam support"
+}
+
+pkg_config() {
+ mailhost="$(hostname)"
+ export mailhost
+
+ domainname="$(domainname)"
+ if [ "x$domainname" = "x(none)" ] ; then
+ domainname="$(echo ${mailhost} | sed -e "s/[^\.]*\.\(.*\)/\1/")"
+ fi
+ export domainname
+
+ if [ "${ROOT}" = "/" ] ; then
+ file="${ROOT}/etc/courier/locals"
+ if [ ! -f "${file}" ] ; then
+ echo "localhost" > "${file}";
+ echo "${domainname}" >> "${file}";
+ fi
+ file="${ROOT}/etc/courier/esmtpacceptmailfor.dir/${domainname}"
+ if [ ! -f "${file}" ] ; then
+ echo "${domainname}" > "${file}"
+ /usr/sbin/makeacceptmailfor
+ fi
+
+ file="${ROOT}/etc/courier/smtpaccess/${domainname}"
+ if [ ! -f "${file}" ]
+ then
+ netstat -nr | grep "^[1-9]" | while read network gateway netmask rest
+ do
+ i=1
+ net=""
+ TIFS="${IFS}"
+ IFS="."
+ for o in "${netmask}"
+ do
+ if [ "${o}" == "255" ]
+ then
+ [ "_${net}" == "_" ] || net="${net}."
+ t="$(echo "${network}" | cut -d " " -f ${i})"
+ net="${net}${t}"
+ fi
+ i="$((${i} + 1))"
+ done
+ IFS="${TIFS}"
+ echo "doing configuration - relay control for the network ${net} !"
+ echo "${net} allow,RELAYCLIENT" >> ${file}
+ done
+ /usr/sbin/makesmtpaccess
+ fi
+ fi
+
+ echo "creating cert for esmtpd-ssl:"
+ /usr/sbin/mkesmtpdcert
+ echo "creating cert for imapd-ssl:"
+ /usr/sbin/mkpop3dcert
+ echo "creating cert for pop3d-ssl:"
+ /usr/sbin/mkimapdcert
+}
diff --git a/mail-mta/courier/files/apache-sqwebmail.inc b/mail-mta/courier/files/apache-sqwebmail.inc
new file mode 100644
index 00000000000..c88f803c5d1
--- /dev/null
+++ b/mail-mta/courier/files/apache-sqwebmail.inc
@@ -0,0 +1,14 @@
+Alias /webmail/ /usr/share/courier/sqwebmail/images/
+<Directory /usr/share/courier/sqwebmail/>
+ Order Allow,Deny
+ AllowOverride All
+ Allow from all
+</Directory>
+
+ScriptAlias /courier/ /usr/lib/courier/courier/webmail/
+<Directory /usr/lib/courier/courier/webmail/>
+ AllowOverride All
+ Options ExecCGI
+ Order allow,deny
+ Allow from all
+</Directory>
diff --git a/mail-mta/courier/files/courier-0.74.0-fix-linking.diff b/mail-mta/courier/files/courier-0.74.0-fix-linking.diff
new file mode 100644
index 00000000000..f9d10d02c43
--- /dev/null
+++ b/mail-mta/courier/files/courier-0.74.0-fix-linking.diff
@@ -0,0 +1,24 @@
+diff -Naur courier-0.74.0/libs/gpglib/Makefile.am courier-0.74.0-1/libs/gpglib/Makefile.am
+--- courier-0.74.0/libs/gpglib/Makefile.am 2014-12-04 03:31:09.000000000 +0100
++++ courier-0.74.0-1/libs/gpglib/Makefile.am 2014-12-14 02:18:25.599274395 +0100
+@@ -18,7 +18,7 @@
+
+ testgpg_SOURCES=testgpg.c
+ testgpg_DEPENDENCIES=libgpg.la ../numlib/libnumlib.la
+-testgpg_LDADD= -lunicode $(testgpg_DEPENDENCIES)
++testgpg_LDADD= $(testgpg_DEPENDENCIES) -lunicode
+ testgpg_LDFLAGS=-static
+
+ mimegpg_SOURCES=mimegpg.c
+diff -Naur courier-0.74.0/libs/gpglib/Makefile.in courier-0.74.0-1/libs/gpglib/Makefile.in
+--- courier-0.74.0/libs/gpglib/Makefile.in 2014-12-13 15:26:42.000000000 +0100
++++ courier-0.74.0-1/libs/gpglib/Makefile.in 2014-12-14 02:18:35.512275143 +0100
+@@ -335,7 +335,7 @@
+
+ testgpg_SOURCES = testgpg.c
+ testgpg_DEPENDENCIES = libgpg.la ../numlib/libnumlib.la
+-testgpg_LDADD = -lunicode $(testgpg_DEPENDENCIES)
++testgpg_LDADD = $(testgpg_DEPENDENCIES) -lunicode
+ testgpg_LDFLAGS = -static
+ mimegpg_SOURCES = mimegpg.c
+ mimegpg_LDADD = libgpg.la ../rfc2045/librfc2045.la ../rfc822/librfc822.la \
diff --git a/mail-mta/courier/files/courier-0.74.1-fix-implicit-declaration-warning.diff b/mail-mta/courier/files/courier-0.74.1-fix-implicit-declaration-warning.diff
new file mode 100644
index 00000000000..e21da955d17
--- /dev/null
+++ b/mail-mta/courier/files/courier-0.74.1-fix-implicit-declaration-warning.diff
@@ -0,0 +1,12 @@
+--- courier-0.74.1/libs/rfc1035/testlookup.c 2014-11-04 13:15:00.000000000 +0100
++++ courier-0.74.1-1/libs/rfc1035/testlookup.c 2015-02-16 13:36:14.455760592 +0100
+@@ -41,6 +41,9 @@
+
+ extern char rfc1035_spf_gettxt(const char *current_domain,
+ char *buf);
++extern char rfc1035_spf_gettxt_n(const char *current_domain,
++ char **buf);
++
+
+ static void spflookup(const char *current_domain)
+ {
diff --git a/mail-mta/courier/files/courier-0.74.1-fix-testsuite.diff b/mail-mta/courier/files/courier-0.74.1-fix-testsuite.diff
new file mode 100644
index 00000000000..b19bf2fc6fc
--- /dev/null
+++ b/mail-mta/courier/files/courier-0.74.1-fix-testsuite.diff
@@ -0,0 +1,12 @@
+--- courier-0.74.1-plain/libs/maildrop/testsuite2 2013-08-30 02:36:07.000000000 +0200
++++ courier-0.74.1/libs/maildrop/testsuite2 2015-02-16 13:22:37.455698929 +0100
+@@ -232,7 +232,8 @@
+
+ for f in testsuite?.filter
+ do
+- echo 'xfilter "cat"' >t
++ echo "SHELL=/bin/sh" > t
++ echo 'xfilter "cat"' >>t
+ cat $f >>t
+ chmod 600 t
+ mv -f t $f
diff --git a/mail-mta/courier/files/courier-init-r4 b/mail-mta/courier/files/courier-init-r4
new file mode 100644
index 00000000000..03dece396e8
--- /dev/null
+++ b/mail-mta/courier/files/courier-init-r4
@@ -0,0 +1,190 @@
+#!/sbin/runscript
+# Portions Copyright 2003 Gentoo Linux
+# $Id$
+#
+# script originally from Courier distfile original name = courier.sysvinit
+# adapted for Gentoo by Brian Jackson
+#
+# TODO
+# should we update all the .dat/.pem files when the source/config files are
+# newer than the .dat/.pem files?
+
+prefix="/usr"
+exec_prefix="/usr/bin"
+sysconfdir="/etc/courier"
+sbindir="/usr/sbin"
+libexecdir="/usr/lib/courier"
+datadir="/usr/share/courier"
+
+depend() {
+ need net
+ [ -d /etc/courier/authlib ] && need courier-authlib
+ grep -q "^IMAPDSTART=.*[Yy].*" /etc/courier/imapd && use famd
+ grep -q "^IMAPDSSLSTART=.*[Yy].*" /etc/courier/imapd-ssl && use famd
+}
+
+checkconfig() {
+ checkpath -q -d -o mail:mail -m 0755 /var/run/courier
+
+ [ -f ${sysconfdir}/pop3d-ssl ] && . ${sysconfdir}/pop3d-ssl
+
+ # If we do not have a certificate, make one up.
+ [ ! -f "${datadir}/pop3d.pem" ] && \
+ ebegin " generating-POP3-SSL-certificate..." && "${sbindir}/mkpop3dcert"
+
+ [ -f ${sysconfdir}/imapd-ssl ] && . ${sysconfdir}/imapd-ssl
+
+ # If we do not have a certificate, make one up.
+ [ ! -f ${datadir}/imapd.pem ] && \
+ ebegin " generating-IMAP-SSL-certificate..." && "${sbindir}/mkimapdcert"
+
+ [ -f ${sysconfdir}/esmtpd-ssl ] && . ${sysconfdir}/esmtpd-ssl
+
+ # If we do not have a certificate, make one up.
+ [ ! -f ${datadir}/esmtpd.pem ] && \
+ ebegin " generating-ESMTP-SSL-certificate..." && "${sbindir}/mkesmtpdcert"
+
+ # First time after install create aliases.dat and smtpaccess.dat
+
+ [ -f ${sysconfdir}/aliases.dat ] || ${sbindir}/makealiases
+
+ [ -f ${sysconfdir}/${ACCESSFILE}.dat ] || ${sbindir}/makesmtpaccess
+
+ [ -f ${sysconfdir}/${ACCESSFILE}.dat ] || ${sbindir}/makesmtpaccess-msa
+}
+
+start() {
+ # Start daemons.
+ ebegin "Starting Courier mail server:"
+
+ checkconfig || return 1
+
+ ebegin " Starting courierfilterd"
+ ${sbindir}/courierfilter start
+
+ [ ! -d /etc/courier/authlib ] && [ -x ${libexecdir}/authlib/authdaemond ] && \
+ ${libexecdir}/authlib/authdaemond start && ebegin " Starting authdaemond"
+
+ [ -x ${sbindir}/webmaild ] && \
+ ${sbindir}/webmaild start && ebegin " Starting webmaild"
+
+ [ -x ${sbindir}/courierldapaliasd ] && \
+ ${sbindir}/courierldapaliasd start && ebegin " Starting courierldapaliasd"
+
+ ebegin " Starting courierd"
+ ${sbindir}/courier start
+
+ savepath="$PATH"
+ # start esmtpd if so written
+ [ -f ${sysconfdir}/esmtpd ] && source ${sysconfdir}/esmtpd
+ PATH="$savepath"
+ case x$ESMTPDSTART in
+ x[yY]*)
+ ebegin " Starting esmtpd"
+ ${sbindir}/esmtpd start
+ ;;
+ esac
+
+ # start esmtpd-msa if so written
+ [ -f ${sysconfdir}/esmtpd-msa ] && source ${sysconfdir}/esmtpd-msa
+ PATH="$savepath"
+ case x$ESMTPDSTART in
+ x[yY]*)
+ ebegin " Starting esmtpd-msa"
+ ${sbindir}/esmtpd-msa start
+ ;;
+ esac
+
+ # start esmtpd-ssl if so written
+ [ -f ${sysconfdir}/esmtpd-ssl ] && source ${sysconfdir}/esmtpd-ssl
+ PATH="$savepath"
+ case x$ESMTPDSSLSTART in
+ x[yY]*)
+ ebegin " Starting esmtpd-ssl"
+ ${sbindir}/esmtpd-ssl start
+ ;;
+ esac
+
+ # start pop3d if so written
+ [ -f ${sysconfdir}/pop3d ] && source ${sysconfdir}/pop3d
+ PATH="$savepath"
+ case x$POP3DSTART in
+ x[yY]*)
+ ebegin " courier-pop3d"
+ ${sbindir}/courier-pop3d start
+ ;;
+ esac
+
+ # start pop3d-ssl if so written
+ [ -f ${sysconfdir}/pop3d-ssl ] && source ${sysconfdir}/pop3d-ssl
+ PATH="$savepath"
+ case x$POP3DSSLSTART in
+ x[yY]*)
+ ebegin " courier-pop3d-ssl"
+ ${sbindir}/courier-pop3d-ssl start
+ ;;
+ esac
+
+ [ -f ${sysconfdir}/imapd ] && source ${sysconfdir}/imapd
+ PATH="$savepath"
+ case x$IMAPDSTART in
+ x[yY]*)
+ ebegin " courier-imapd"
+ ${sbindir}/courier-imapd start
+ ;;
+ esac
+
+ [ -f ${sysconfdir}/imapd-ssl ] && source ${sysconfdir}/imapd-ssl
+ PATH="$savepath"
+ case x$IMAPDSSLSTART in
+ x[yY]*)
+ ebegin " courier-imapd-ssl"
+ ${sbindir}/courier-imapd-ssl start
+ ;;
+ esac
+
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Courier mail server:"
+
+ ebegin " Stopping courier-esmtpd"
+ ${sbindir}/esmtpd stop
+
+ ebegin " Stopping courier-esmtpd-msa"
+ ${sbindir}/esmtpd-msa stop
+
+ ebegin " Stopping courier-esmtpd-ssl"
+ ${sbindir}/esmtpd-ssl stop
+
+ [ -x ${sbindir}/courier-pop3d ] && \
+ ebegin " Stopping courier-pop3d" && ${sbindir}/courier-pop3d stop
+
+ [ -x ${sbindir}/courier-pop3d-ssl ] && \
+ ebegin " Stopping courier-pop3d-ssl" && ${sbindir}/courier-pop3d-ssl stop
+
+ [ -x ${sbindir}/courier-imapd ] && \
+ ebegin " Stopping courier-imapd" && ${sbindir}/courier-imapd stop
+
+
+ [ -x ${sbindir}/courier-imapd-ssl ] && \
+ ebegin " Stopping courier-imapd-ssl" && ${sbindir}/courier-imapd-ssl stop
+
+ ebegin " Stopping courierd"
+ ${sbindir}/courier stop
+
+ [ -x ${sbindir}/courierldapaliasd ] && \
+ ( ${sbindir}/courierldapaliasd stop ; ebegin " Stopping courierldapaliasd" )
+
+ [ -x ${sbindir}/webmaild ] && \
+ ( ${sbindir}/webmaild stop ; ebegin " Stopping webmaild" )
+
+ [ ! -d /etc/courier/authlib ] && [ -x ${libexecdir}/authlib/authdaemond ] && \
+ ( ${libexecdir}/authlib/authdaemond stop ; ebegin " Stopping authdaemond" )
+
+ ${sbindir}/courierfilter stop
+ ebegin " Stopping courierfilterd"
+
+ eend $?
+}
diff --git a/mail-mta/courier/files/norewrite.patch b/mail-mta/courier/files/norewrite.patch
new file mode 100644
index 00000000000..8d8f5362967
--- /dev/null
+++ b/mail-mta/courier/files/norewrite.patch
@@ -0,0 +1,21 @@
+--- courier/module.esmtp/esmtp.c.orig 2004-02-03 01:08:15.679486558 -0700
++++ courier/module.esmtp/esmtp.c 2004-02-03 01:07:41.262697092 -0700
+@@ -255,6 +255,10 @@ const char *me;
+ struct rfc822t *tp;
+ struct rfc822token at;
+
++#if 1
++ (*func)(info);
++ return;
++#else
+ if (info->ptr == 0)
+ {
+ (*func)(info);
+@@ -289,6 +293,7 @@ struct rfc822token at;
+ (*func)(info);
+ *r=0;
+ rfc822t_free(tp);
++#endif
+ }
+
+ static void rw_esmtp(struct rw_info *info, void (*func)(struct rw_info *))
diff --git a/mail-mta/courier/files/password.dist b/mail-mta/courier/files/password.dist
new file mode 100644
index 00000000000..5220e4ee0eb
--- /dev/null
+++ b/mail-mta/courier/files/password.dist
@@ -0,0 +1,6 @@
+# 1. Open /etc/courier/webadmin/password for editing
+# 2. There should be one word in this file. The webadmin password
+# 3. chown mail:mail password
+# 4. chmod 400 password
+#
+# Thanks to Fernando Tobler on bug #10574 for the concise instructions
diff --git a/mail-mta/courier/metadata.xml b/mail-mta/courier/metadata.xml
new file mode 100644
index 00000000000..319a82ad1df
--- /dev/null
+++ b/mail-mta/courier/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-mail</herd>
+ <maintainer>
+ <email>hanno@gentoo.org</email>
+ </maintainer>
+ <longdescription>
+ Complete email package consisting of pop, imap, smtp, and fax
+ server and secure version of the above also.
+ </longdescription>
+ <use>
+ <flag name="fax">Enables fax support in the courier mail server</flag>
+ <flag name="norewrite">Prevents courier mail server from mangling
+ virtual user addresses when sending</flag>
+ <flag name="web">Enable the web interface</flag>
+ <flag name="webmail">Enable the webmail interface</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">courier</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/mail-mta/esmtp/Manifest b/mail-mta/esmtp/Manifest
new file mode 100644
index 00000000000..f17102d4196
--- /dev/null
+++ b/mail-mta/esmtp/Manifest
@@ -0,0 +1 @@
+DIST esmtp-1.2.tar.bz2 127921 SHA256 a0d26931bf731f97514da266d079d8bc7d73c65b3499ed080576ab606b21c0ce
diff --git a/mail-mta/esmtp/esmtp-1.2.ebuild b/mail-mta/esmtp/esmtp-1.2.ebuild
new file mode 100644
index 00000000000..7d20f083b5e
--- /dev/null
+++ b/mail-mta/esmtp/esmtp-1.2.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="esmtp is a user configurable relay-only Mail Transfer Agent (MTA) with a sendmail compatible syntax"
+HOMEPAGE="http://esmtp.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~x86-macos"
+IUSE=""
+
+DEPEND="net-libs/libesmtp
+ dev-libs/openssl
+ sys-devel/flex"
+RDEPEND="net-libs/libesmtp
+ dev-libs/openssl
+ !mail-mta/courier
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ !mail-mta/opensmtpd"
+
+src_install() {
+ emake DESTDIR="${D}" install || die "einstall failed"
+ dodoc AUTHORS ChangeLog NEWS README TODO sample.esmtprc || die
+}
+
+pkg_postinst() {
+ elog "A sample esmtprc file has been installed in /usr/share/doc/${P}"
+}
diff --git a/mail-mta/esmtp/files/mailer.conf b/mail-mta/esmtp/files/mailer.conf
new file mode 100644
index 00000000000..b0bc2589b24
--- /dev/null
+++ b/mail-mta/esmtp/files/mailer.conf
@@ -0,0 +1,8 @@
+# $Id$
+
+# Execute the "real" sendmail program from esmtp
+#
+sendmail /usr/sbin/sendmail.esmtp
+send-mail /usr/sbin/sendmail.esmtp
+mailq /usr/sbin/sendmail.esmtp
+newaliases /usr/sbin/sendmail.esmtp
diff --git a/mail-mta/esmtp/metadata.xml b/mail-mta/esmtp/metadata.xml
new file mode 100644
index 00000000000..725ab79598b
--- /dev/null
+++ b/mail-mta/esmtp/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-mail</herd>
+ <upstream>
+ <remote-id type="sourceforge">esmtp</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/mail-mta/exim/Manifest b/mail-mta/exim/Manifest
new file mode 100644
index 00000000000..ba0314886d2
--- /dev/null
+++ b/mail-mta/exim/Manifest
@@ -0,0 +1,7 @@
+DIST exim-4.84.tar.bz2 1761790 SHA256 78ea22be87fb6df880e7fd482f3bec9ef6ceca0c9dedd50f8a26cae0b38b9e9c SHA512 3cd41af6d57e5f0377fc93367753eae6cb6bf835803e8608c44e1da5acefce1ed8886f4fe7536950de072bfed6e927afe1536c1e6466cf3121dd352b69a68039 WHIRLPOOL 9e840aa6afa0db68455b4ab458706eedd7ea57b084999c9e85eaaec0530ed93958731d934ff1d7830d9b5cd086e36cb56dc8a2f78dad85bdba9ae6573510e840
+DIST exim-4.85.tar.bz2 1784150 SHA256 13211f2bbc5400d095a9b4be075eb1347e0d98676fdfe4be8a3b4d56281daaa4 SHA512 2c5846528ee98e4aff5dbabe49dfa5ba6753fa64154b9671a7849db8a17773917fe13bcb9e5f732c43d7479debfadd8012b8650823eb12504a6b1b28be456161 WHIRLPOOL 4057cd745f12ff62e956838406544060d3d2d7383027959f3c1ca12eff43bddb9be63e284767245b271e53bef92596c1241f5e90e9ed611d02e95b7a30adc7c8
+DIST exim-4.86.tar.bz2 1804807 SHA256 f1ccf2ce2ea51b7fbbf160e7e0e41d24ca401cf44a185128ad99ea04635fc456 SHA512 0b90cd1b4d99bbb976336ccf9c2c3375f453a74bb306f1b0215f7ecca80fbda83cf5cc38c502516c2903c5d753f1f559c534fc4f4b1b32ee3300db86de6610ab WHIRLPOOL a7e938cfaeb92af1b81c8a113752914b61e49d7fd71c39460b944716725b1e98b50a7c9ef1699569cd031ee7cac210639d9ef9bd21280e5ce7682eb40db91726
+DIST exim-html-4.84.tar.bz2 465281 SHA256 7ee7e9015b853915604b7806be93d56e9ba1fb915b63f0d6828c47f2228fd45b SHA512 7de8513476b6abcdfd36b0121a2a9d6decf1ccf94ef51b8363e544066cc05670e6f2b4d03d5fbc49071b1431183dfd9badde5cbcc65f51d55ec6b25ebcb070b9 WHIRLPOOL 88c376fd399e17b2bc06d2d0fad19f8c6485807118a81e0c200f6c39defe7155fa920489481a8b82e629951766ce0222b85956f387d22d22549303bd3dff7f82
+DIST exim-html-4.85.tar.bz2 467069 SHA256 fd91946369626e74842a0799b93d0d9e4a201fe640af84e1b5349fe6ff204167 SHA512 8214576300827f79c0880e2d2163f71d7f1b3fe2aff714b591a011e48816965de5a773c3509137b085fec3d4d2128931f8398768c24dad6c92b7df27cbcafe74 WHIRLPOOL a7edffd7124c4920708616d3e59c0db5159dee5f7e4fd62ce29fdba769d39781a3826d4e3e39cdc97669941bb9a5c977defe280feb73cbe159b23df4cb6fe95f
+DIST exim-html-4.86.tar.bz2 471159 SHA256 02226a9fbb6d5aaa9d35f3e2a3bd9077e2307463de6baf6e3e2e938c1fe39146 SHA512 0c15fbccaf9b744fb8b7990d2b2bd0555a04ef5ed82ffbf2e32372a539bae6d7cebad96960f5570a2f8f27d31ebdf2467c51cb053b059996bb9122bc02fa741b WHIRLPOOL d9fbaa73491ab1657afb6ba59da5adea26144b58b358aeb9829731d3f35d6c1d8c7021c5243cb989e7c704cc346cde2a330f9eedc5b357326c1d56d7caa4a6c5
+DIST system_filter.exim.gz 3075 SHA256 3a3471b486a09e0a0153f7b520e1eaf26d21b97d73ea8348bdc593c00eb1e437 SHA512 cb358d3ce2499a0bb5920d962a06f2af8486e55ec90c8c928bd8e3aefb279aa57f5f960d5adfcef68bd94110b405eaa144e9629cfe6014a529c79c544600bbf3 WHIRLPOOL ce68d9c18b24eca3ef97ea810964cc1ada5f85b795a7c432ad39b5788188a16419101c92fb52b418738d760e1d658f7a41485e5561079a667d84d276c71be5a4
diff --git a/mail-mta/exim/exim-4.84.ebuild b/mail-mta/exim/exim-4.84.ebuild
new file mode 100644
index 00000000000..86d5c6adf57
--- /dev/null
+++ b/mail-mta/exim/exim-4.84.ebuild
@@ -0,0 +1,508 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils toolchain-funcs multilib pam systemd
+
+IUSE="dcc +dkim dlfunc dmarc +dnsdb doc dovecot-sasl dsn exiscan-acl gnutls ipv6 ldap lmtp maildir mbx mysql nis pam perl pkcs11 postgres +prdr proxy radius redis sasl selinux spf sqlite srs ssl syslog tcpd tpda X"
+REQUIRED_USE="spf? ( exiscan-acl ) srs? ( exiscan-acl ) dmarc? ( spf dkim ) pkcs11? ( gnutls )"
+
+COMM_URI="ftp://ftp.exim.org/pub/exim/exim4$([[ ${PV} == *_rc* ]] && echo /test)"
+
+DESCRIPTION="A highly configurable, drop-in replacement for sendmail"
+SRC_URI="${COMM_URI}/${P//rc/RC}.tar.bz2
+ mirror://gentoo/system_filter.exim.gz
+ doc? ( ${COMM_URI}/${PN}-html-${PV//rc/RC}.tar.bz2 )"
+HOMEPAGE="http://www.exim.org/"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd ~x86-solaris"
+
+COMMON_DEPEND=">=sys-apps/sed-4.0.5
+ >=sys-libs/db-3.2
+ dev-libs/libpcre
+ perl? ( dev-lang/perl:= )
+ pam? ( virtual/pam )
+ tcpd? ( sys-apps/tcp-wrappers )
+ ssl? ( dev-libs/openssl )
+ gnutls? ( net-libs/gnutls[pkcs11?]
+ dev-libs/libtasn1 )
+ ldap? ( >=net-nds/openldap-2.0.7 )
+ mysql? ( virtual/mysql )
+ postgres? ( dev-db/postgresql )
+ sasl? ( >=dev-libs/cyrus-sasl-2.1.26-r2 )
+ redis? ( dev-libs/hiredis )
+ spf? ( >=mail-filter/libspf2-1.2.5-r1 )
+ dmarc? ( mail-filter/opendmarc )
+ srs? ( mail-filter/libsrs_alt )
+ X? ( x11-proto/xproto
+ x11-libs/libX11
+ x11-libs/libXmu
+ x11-libs/libXt
+ x11-libs/libXaw
+ )
+ sqlite? ( dev-db/sqlite )
+ radius? ( net-dialup/radiusclient )
+ virtual/libiconv
+ "
+ # added X check for #57206
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig"
+RDEPEND="${COMMON_DEPEND}
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/mini-qmail
+ !<mail-mta/msmtp-1.4.19-r1
+ !>=mail-mta/msmtp-1.4.19-r1[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ !net-mail/mailwrapper
+ >=net-mail/mailbase-0.00-r5
+ virtual/logger
+ dcc? ( mail-filter/dcc )
+ selinux? ( sec-policy/selinux-exim )
+ "
+
+S=${WORKDIR}/${P//rc/RC}
+
+src_prepare() {
+ epatch "${FILESDIR}"/exim-4.14-tail.patch
+ epatch "${FILESDIR}"/exim-4.74-localscan_dlopen.patch
+ epatch "${FILESDIR}"/exim-4.69-r1.27021.patch
+ epatch "${FILESDIR}"/exim-4.74-radius-db-ENV-clash.patch # 287426
+ epatch "${FILESDIR}"/exim-4.82-makefile-freebsd.patch # 235785
+ epatch "${FILESDIR}"/exim-4.77-as-needed-ldflags.patch # 352265, 391279
+ epatch "${FILESDIR}"/exim-4.76-crosscompile.patch # 266591
+
+ if use maildir ; then
+ epatch "${FILESDIR}"/exim-4.20-maildir.patch
+ else
+ epatch "${FILESDIR}"/exim-4.80-spool-mail-group.patch # 438606
+ fi
+
+ # user Exim believes it should be
+ MAILUSER=mail
+ MAILGROUP=mail
+ if use prefix && [[ ${EUID} != 0 ]] ; then
+ MAILUSER=$(id -un)
+ MAILGROUP=$(id -gn)
+ fi
+}
+
+src_configure() {
+ # general config and paths
+
+ sed -i.orig \
+ -e "/SYSTEM_ALIASES_FILE/s'SYSTEM_ALIASES_FILE'${EPREFIX}/etc/mail/aliases'" \
+ "${S}"/src/configure.default || die
+
+ sed -i -e 's/^buildname=.*/buildname=exim-gentoo/g' Makefile || die
+
+ sed -e "48i\CFLAGS=${CFLAGS}" \
+ -e "s:BIN_DIRECTORY=/usr/exim/bin:BIN_DIRECTORY=${EPREFIX}/usr/sbin:" \
+ -e "s:EXIM_USER=:EXIM_USER=${MAILUSER}:" \
+ -e "s:CONFIGURE_FILE=/usr/exim/configure:CONFIGURE_FILE=${EPREFIX}/etc/exim/exim.conf:" \
+ -e "s:ZCAT_COMMAND=.*$:ZCAT_COMMAND=${EPREFIX}/bin/zcat:" \
+ -e "s:COMPRESS_COMMAND=.*$:COMPRESS_COMMAND=${EPREFIX}/bin/gzip:" \
+ src/EDITME > Local/Makefile
+
+ cd Local
+
+ cat >> Makefile <<- EOC
+ INFO_DIRECTORY=${EPREFIX}/usr/share/info
+ PID_FILE_PATH=${EPREFIX}/run/exim.pid
+ SPOOL_DIRECTORY=${EPREFIX}/var/spool/exim
+ HAVE_ICONV=yes
+ EOC
+
+ # if we use libiconv, now is the time to tell so
+ use !elibc_glibc && echo "EXTRALIBS_EXIM=-liconv" >> Makefile
+
+ # support for IPv6
+ if use ipv6; then
+ cat >> Makefile <<- EOC
+ HAVE_IPV6=YES
+ EOC
+ fi
+
+ #
+ # mail storage formats
+
+ # mailstore is Exim's traditional storage format
+ cat >> Makefile <<- EOC
+ SUPPORT_MAILSTORE=yes
+ EOC
+
+ # mbox
+ if use mbx; then
+ cat >> Makefile <<- EOC
+ SUPPORT_MBX=yes
+ EOC
+ fi
+
+ # maildir
+ if use maildir; then
+ cat >> Makefile <<- EOC
+ SUPPORT_MAILDIR=yes
+ EOC
+ fi
+
+ #
+ # lookup methods
+
+ # use the "native" interfaces to the DBM and CDB libraries, support
+ # passwd and directory lookups by default
+ cat >> Makefile <<- EOC
+ USE_DB=yes
+ DBMLIB=-ldb
+ LOOKUP_CDB=yes
+ LOOKUP_PASSWD=yes
+ LOOKUP_DSEARCH=yes
+ EOC
+
+ if ! use dnsdb; then
+ # DNSDB lookup is enabled by default
+ sed -i "s:^LOOKUP_DNSDB=yes:# LOOKUP_DNSDB=yes:" Makefile
+ fi
+
+ if use ldap; then
+ cat >> Makefile <<- EOC
+ LOOKUP_LDAP=yes
+ LDAP_LIB_TYPE=OPENLDAP2
+ LOOKUP_INCLUDE += -I"${EROOT}"usr/include/ldap
+ LOOKUP_LIBS += -lldap -llber
+ EOC
+ fi
+
+ if use mysql; then
+ cat >> Makefile <<- EOC
+ LOOKUP_MYSQL=yes
+ LOOKUP_INCLUDE += $(mysql_config --include)
+ LOOKUP_LIBS += $(mysql_config --libs)
+ EOC
+ fi
+
+ if use nis; then
+ cat >> Makefile <<- EOC
+ LOOKUP_NIS=yes
+ LOOKUP_NISPLUS=yes
+ EOC
+ fi
+
+ if use postgres; then
+ cat >> Makefile <<- EOC
+ LOOKUP_PGSQL=yes
+ LOOKUP_INCLUDE += -I$(pg_config --includedir)
+ LOOKUP_LIBS += -L$(pg_config --libdir) -lpq
+ EOC
+ fi
+
+ if use sqlite; then
+ cat >> Makefile <<- EOC
+ LOOKUP_SQLITE=yes
+ LOOKUP_SQLITE_PC=sqlite3
+ EOC
+ fi
+
+ if use redis; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_REDIS=yes
+ LOOKUP_LIBS += -lhiredis
+ EOC
+ fi
+
+ #
+ # Exim monitor, enabled by default, controlled via X USE-flag,
+ # disable if not requested, bug #46778
+ if use X; then
+ cp ../exim_monitor/EDITME eximon.conf || die
+ else
+ sed -i -e '/^EXIM_MONITOR=/s/^/# /' Makefile
+ fi
+
+ #
+ # features
+
+ # content scanning support
+ if use exiscan-acl; then
+ cat >> Makefile <<- EOC
+ WITH_CONTENT_SCAN=yes
+ WITH_OLD_DEMIME=yes
+ EOC
+ fi
+
+ # DomainKeys Identified Mail, RFC4871
+ if ! use dkim; then
+ # DKIM is enabled by default
+ cat >> Makefile <<- EOC
+ DISABLE_DKIM=yes
+ EOC
+ fi
+
+ # Per-Recipient-Data-Response
+ if ! use prdr; then
+ # PRDR is enabled by default
+ cat >> Makefile <<- EOC
+ DISABLE_PRDR=yes
+ EOC
+ fi
+
+ # log to syslog
+ if use syslog; then
+ sed -i "s:LOG_FILE_PATH=/var/log/exim/exim_%s.log:LOG_FILE_PATH=syslog:" Makefile
+ cat >> Makefile <<- EOC
+ LOG_FILE_PATH=syslog
+ EOC
+ else
+ cat >> Makefile <<- EOC
+ LOG_FILE_PATH=${EPREFIX}/var/log/exim/exim_%s.log
+ EOC
+ fi
+
+ # starttls support (ssl)
+ if use ssl; then
+ echo "SUPPORT_TLS=yes" >> Makefile
+ if use gnutls; then
+ echo "USE_GNUTLS=yes" >> Makefile
+ echo "USE_GNUTLS_PC=gnutls" >> Makefile
+ use pkcs11 || echo "AVOID_GNUTLS_PKCS11=yes" >> Makefile
+ else
+ echo "USE_OPENSSL_PC=openssl" >> Makefile
+ fi
+ fi
+
+ # TCP wrappers
+ if use tcpd; then
+ cat >> Makefile <<- EOC
+ USE_TCP_WRAPPERS=yes
+ EXTRALIBS_EXIM += -lwrap
+ EOC
+ fi
+
+ # Light Mail Transport Protocol
+ if use lmtp; then
+ cat >> Makefile <<- EOC
+ TRANSPORT_LMTP=yes
+ EOC
+ fi
+
+ # embedded Perl
+ if use perl; then
+ cat >> Makefile <<- EOC
+ EXIM_PERL=perl.o
+ EOC
+ fi
+
+ # dlfunc
+ if use dlfunc; then
+ cat >> Makefile <<- EOC
+ EXPAND_DLFUNC=yes
+ EOC
+ fi
+
+ #
+ # experimental features
+
+ # Distributed Checksum Clearinghouse
+ if use dcc; then
+ echo "EXPERIMENTAL_DCC=yes">> Makefile
+ fi
+
+ # Sender Policy Framework
+ if use spf; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_SPF=yes
+ EXTRALIBS_EXIM += -lspf2
+ EOC
+ fi
+
+ # Sender Rewriting Scheme
+ if use srs; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_SRS=yes
+ EXTRALIBS_EXIM += -lsrs_alt
+ EOC
+ fi
+
+ # DMARC
+ if use dmarc; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_DMARC=yes
+ EXTRALIBS_EXIM += -lopendmarc
+ EOC
+ fi
+
+ # Transport post-delivery actions
+ if use tpda; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_TPDA=yes
+ EOC
+ fi
+
+ # Proxy Protocol
+ if use proxy; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_PROXY=yes
+ EOC
+ fi
+
+ # Delivery Sender Notifications
+ if use dsn; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_DSN=yes
+ EOC
+ fi
+
+ #
+ # authentication (SMTP AUTH)
+
+ # standard bits
+ cat >> Makefile <<- EOC
+ AUTH_SPA=yes
+ AUTH_CRAM_MD5=yes
+ AUTH_PLAINTEXT=yes
+ EOC
+
+ # Cyrus SASL
+ if use sasl; then
+ cat >> Makefile <<- EOC
+ CYRUS_SASLAUTHD_SOCKET=${EPREFIX}/run/saslauthd/mux
+ AUTH_CYRUS_SASL=yes
+ AUTH_LIBS += -lsasl2
+ EOC
+ fi
+
+ # Dovecot
+ if use dovecot-sasl; then
+ cat >> Makefile <<- EOC
+ AUTH_DOVECOT=yes
+ EOC
+ fi
+
+ # Pluggable Authentication Modules
+ if use pam; then
+ cat >> Makefile <<- EOC
+ SUPPORT_PAM=yes
+ AUTH_LIBS += -lpam
+ EOC
+ fi
+
+ # Radius
+ if use radius; then
+ cat >> Makefile <<- EOC
+ RADIUS_CONFIG_FILE=${EPREFIX}/etc/radiusclient/radiusclient.conf
+ RADIUS_LIB_TYPE=RADIUSCLIENT
+ AUTH_LIBS += -lradiusclient
+ EOC
+ fi
+}
+
+src_compile() {
+ emake -j1 CC="$(tc-getCC)" HOSTCC="$(tc-getCC $CBUILD)" \
+ AR="$(tc-getAR) cq" RANLIB="$(tc-getRANLIB)" FULLECHO='' \
+ || die "make failed"
+}
+
+src_install () {
+ cd "${S}"/build-exim-gentoo || die
+ dosbin exim
+ if use X; then
+ dosbin eximon.bin
+ dosbin eximon
+ fi
+ fperms 4755 /usr/sbin/exim
+
+ dosym exim /usr/sbin/sendmail
+ dosym exim /usr/sbin/rsmtp
+ dosym exim /usr/sbin/rmail
+ dosym /usr/sbin/exim /usr/bin/mailq
+ dosym /usr/sbin/exim /usr/bin/newaliases
+ dosym /usr/sbin/sendmail /usr/lib/sendmail
+
+ for i in exicyclog exim_dbmbuild exim_dumpdb exim_fixdb exim_lock \
+ exim_tidydb exinext exiwhat exigrep eximstats exiqsumm exiqgrep \
+ convert4r3 convert4r4 exipick
+ do
+ dosbin $i
+ done
+
+ dodoc "${S}"/doc/*
+ doman "${S}"/doc/exim.8
+ use dsn && dodoc "${S}"/README.DSN
+ use doc && dohtml -r "${WORKDIR}"/${PN}-html-${PV//rc/RC}/doc/html/spec_html/*
+
+ # conf files
+ insinto /etc/exim
+ newins "${S}"/src/configure.default exim.conf.dist
+ if use exiscan-acl; then
+ newins "${S}"/src/configure.default exim.conf.exiscan-acl
+ fi
+ doins "${WORKDIR}"/system_filter.exim
+ doins "${FILESDIR}"/auth_conf.sub
+
+ pamd_mimic system-auth exim auth account
+
+ # headers, #436406
+ if use dlfunc ; then
+ # fixup includes so they actually can be found when including
+ sed -i \
+ -e '/#include "\(config\|store\|mytypes\).h"/s:"\(.\+\)":<exim/\1>:' \
+ local_scan.h || die
+ insinto /usr/include/exim
+ doins {config,local_scan}.h ../src/{mytypes,store}.h
+ fi
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/exim.logrotate" exim
+
+ newinitd "${FILESDIR}"/exim.rc8 exim
+ newconfd "${FILESDIR}"/exim.confd exim
+
+ systemd_dounit "${FILESDIR}"/{exim.service,exim.socket,exim-submission.socket}
+ systemd_newunit "${FILESDIR}"/exim_at.service 'exim@.service'
+ systemd_newunit "${FILESDIR}"/exim-submission_at.service 'exim-submission@.service'
+
+ DIROPTIONS="-m 0750 -o ${MAILUSER} -g ${MAILGROUP}"
+ dodir /var/log/${PN}
+}
+
+pkg_postinst() {
+ if [[ ! -f ${EROOT}etc/exim/exim.conf ]] ; then
+ einfo "${EROOT}etc/exim/system_filter.exim is a sample system_filter."
+ einfo "${EROOT}etc/exim/auth_conf.sub contains the configuration sub for using smtp auth."
+ einfo "Please create ${EROOT}etc/exim/exim.conf from ${EROOT}etc/exim/exim.conf.dist."
+ fi
+ if use dcc ; then
+ einfo "DCC support is experimental, you can find some limited"
+ einfo "documentation at the bottom of this prerelease message:"
+ einfo "http://article.gmane.org/gmane.mail.exim.devel/3579"
+ fi
+ use spf && einfo "SPF support is experimental"
+ use srs && einfo "SRS support is experimental"
+ if use dmarc ; then
+ einfo "DMARC support is experimental. See global settings to"
+ einfo "configure DMARC, for usage see the documentation at "
+ einfo "experimental-spec.txt."
+ fi
+ use tpda && einfo "TPDA support is experimental"
+ use proxy && einfo "proxy support is experimental"
+ if use dsn ; then
+ einfo "Starting from Exim 4.83, DSN support comes from upstream."
+ einfo "DSN support is an experimental feature. If you used DSN"
+ einfo "support prior to 4.83, make sure to remove all dsn_process"
+ einfo "switches from your routers, see http://bugs.gentoo.org/511818"
+ fi
+ einfo "Exim maintains some db files under its spool directory that need"
+ einfo "cleaning from time to time. (${EROOT}var/spool/exim/db)"
+ einfo "Please use the exim_tidydb tool as documented in the Exim manual:"
+ einfo "http://www.exim.org/exim-html-current/doc/html/spec_html/ch-exim_utilities.html#SECThindatmai"
+}
diff --git a/mail-mta/exim/exim-4.85.ebuild b/mail-mta/exim/exim-4.85.ebuild
new file mode 100644
index 00000000000..8728359a564
--- /dev/null
+++ b/mail-mta/exim/exim-4.85.ebuild
@@ -0,0 +1,508 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils toolchain-funcs multilib pam systemd
+
+IUSE="dcc +dkim dlfunc dmarc +dnsdb doc dovecot-sasl dsn exiscan-acl gnutls ipv6 ldap lmtp maildir mbx mysql nis pam perl pkcs11 postgres +prdr proxy radius redis sasl selinux spf sqlite srs ssl syslog tcpd tpda X"
+REQUIRED_USE="spf? ( exiscan-acl ) srs? ( exiscan-acl ) dmarc? ( spf dkim ) pkcs11? ( gnutls )"
+
+COMM_URI="ftp://ftp.exim.org/pub/exim/exim4$([[ ${PV} == *_rc* ]] && echo /test)"
+
+DESCRIPTION="A highly configurable, drop-in replacement for sendmail"
+SRC_URI="${COMM_URI}/${P//rc/RC}.tar.bz2
+ mirror://gentoo/system_filter.exim.gz
+ doc? ( ${COMM_URI}/${PN}-html-${PV//rc/RC}.tar.bz2 )"
+HOMEPAGE="http://www.exim.org/"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="alpha amd64 ~hppa ia64 ppc ~ppc64 sparc x86 ~x86-fbsd ~x86-solaris"
+
+COMMON_DEPEND=">=sys-apps/sed-4.0.5
+ >=sys-libs/db-3.2
+ dev-libs/libpcre
+ perl? ( dev-lang/perl:= )
+ pam? ( virtual/pam )
+ tcpd? ( sys-apps/tcp-wrappers )
+ ssl? ( dev-libs/openssl )
+ gnutls? ( net-libs/gnutls[pkcs11?]
+ dev-libs/libtasn1 )
+ ldap? ( >=net-nds/openldap-2.0.7 )
+ mysql? ( virtual/mysql )
+ postgres? ( dev-db/postgresql )
+ sasl? ( >=dev-libs/cyrus-sasl-2.1.26-r2 )
+ redis? ( dev-libs/hiredis )
+ spf? ( >=mail-filter/libspf2-1.2.5-r1 )
+ dmarc? ( mail-filter/opendmarc )
+ srs? ( mail-filter/libsrs_alt )
+ X? ( x11-proto/xproto
+ x11-libs/libX11
+ x11-libs/libXmu
+ x11-libs/libXt
+ x11-libs/libXaw
+ )
+ sqlite? ( dev-db/sqlite )
+ radius? ( net-dialup/radiusclient )
+ virtual/libiconv
+ "
+ # added X check for #57206
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig"
+RDEPEND="${COMMON_DEPEND}
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/mini-qmail
+ !<mail-mta/msmtp-1.4.19-r1
+ !>=mail-mta/msmtp-1.4.19-r1[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ !net-mail/mailwrapper
+ >=net-mail/mailbase-0.00-r5
+ virtual/logger
+ dcc? ( mail-filter/dcc )
+ selinux? ( sec-policy/selinux-exim )
+ "
+
+S=${WORKDIR}/${P//rc/RC}
+
+src_prepare() {
+ epatch "${FILESDIR}"/exim-4.14-tail.patch
+ epatch "${FILESDIR}"/exim-4.74-localscan_dlopen.patch
+ epatch "${FILESDIR}"/exim-4.69-r1.27021.patch
+ epatch "${FILESDIR}"/exim-4.74-radius-db-ENV-clash.patch # 287426
+ epatch "${FILESDIR}"/exim-4.82-makefile-freebsd.patch # 235785
+ epatch "${FILESDIR}"/exim-4.77-as-needed-ldflags.patch # 352265, 391279
+ epatch "${FILESDIR}"/exim-4.76-crosscompile.patch # 266591
+
+ if use maildir ; then
+ epatch "${FILESDIR}"/exim-4.20-maildir.patch
+ else
+ epatch "${FILESDIR}"/exim-4.80-spool-mail-group.patch # 438606
+ fi
+
+ # user Exim believes it should be
+ MAILUSER=mail
+ MAILGROUP=mail
+ if use prefix && [[ ${EUID} != 0 ]] ; then
+ MAILUSER=$(id -un)
+ MAILGROUP=$(id -gn)
+ fi
+}
+
+src_configure() {
+ # general config and paths
+
+ sed -i.orig \
+ -e "/SYSTEM_ALIASES_FILE/s'SYSTEM_ALIASES_FILE'${EPREFIX}/etc/mail/aliases'" \
+ "${S}"/src/configure.default || die
+
+ sed -i -e 's/^buildname=.*/buildname=exim-gentoo/g' Makefile || die
+
+ sed -e "48i\CFLAGS=${CFLAGS}" \
+ -e "s:BIN_DIRECTORY=/usr/exim/bin:BIN_DIRECTORY=${EPREFIX}/usr/sbin:" \
+ -e "s:EXIM_USER=:EXIM_USER=${MAILUSER}:" \
+ -e "s:CONFIGURE_FILE=/usr/exim/configure:CONFIGURE_FILE=${EPREFIX}/etc/exim/exim.conf:" \
+ -e "s:ZCAT_COMMAND=.*$:ZCAT_COMMAND=${EPREFIX}/bin/zcat:" \
+ -e "s:COMPRESS_COMMAND=.*$:COMPRESS_COMMAND=${EPREFIX}/bin/gzip:" \
+ src/EDITME > Local/Makefile
+
+ cd Local
+
+ cat >> Makefile <<- EOC
+ INFO_DIRECTORY=${EPREFIX}/usr/share/info
+ PID_FILE_PATH=${EPREFIX}/run/exim.pid
+ SPOOL_DIRECTORY=${EPREFIX}/var/spool/exim
+ HAVE_ICONV=yes
+ EOC
+
+ # if we use libiconv, now is the time to tell so
+ use !elibc_glibc && echo "EXTRALIBS_EXIM=-liconv" >> Makefile
+
+ # support for IPv6
+ if use ipv6; then
+ cat >> Makefile <<- EOC
+ HAVE_IPV6=YES
+ EOC
+ fi
+
+ #
+ # mail storage formats
+
+ # mailstore is Exim's traditional storage format
+ cat >> Makefile <<- EOC
+ SUPPORT_MAILSTORE=yes
+ EOC
+
+ # mbox
+ if use mbx; then
+ cat >> Makefile <<- EOC
+ SUPPORT_MBX=yes
+ EOC
+ fi
+
+ # maildir
+ if use maildir; then
+ cat >> Makefile <<- EOC
+ SUPPORT_MAILDIR=yes
+ EOC
+ fi
+
+ #
+ # lookup methods
+
+ # use the "native" interfaces to the DBM and CDB libraries, support
+ # passwd and directory lookups by default
+ cat >> Makefile <<- EOC
+ USE_DB=yes
+ DBMLIB=-ldb
+ LOOKUP_CDB=yes
+ LOOKUP_PASSWD=yes
+ LOOKUP_DSEARCH=yes
+ EOC
+
+ if ! use dnsdb; then
+ # DNSDB lookup is enabled by default
+ sed -i "s:^LOOKUP_DNSDB=yes:# LOOKUP_DNSDB=yes:" Makefile
+ fi
+
+ if use ldap; then
+ cat >> Makefile <<- EOC
+ LOOKUP_LDAP=yes
+ LDAP_LIB_TYPE=OPENLDAP2
+ LOOKUP_INCLUDE += -I"${EROOT}"usr/include/ldap
+ LOOKUP_LIBS += -lldap -llber
+ EOC
+ fi
+
+ if use mysql; then
+ cat >> Makefile <<- EOC
+ LOOKUP_MYSQL=yes
+ LOOKUP_INCLUDE += $(mysql_config --include)
+ LOOKUP_LIBS += $(mysql_config --libs)
+ EOC
+ fi
+
+ if use nis; then
+ cat >> Makefile <<- EOC
+ LOOKUP_NIS=yes
+ LOOKUP_NISPLUS=yes
+ EOC
+ fi
+
+ if use postgres; then
+ cat >> Makefile <<- EOC
+ LOOKUP_PGSQL=yes
+ LOOKUP_INCLUDE += -I$(pg_config --includedir)
+ LOOKUP_LIBS += -L$(pg_config --libdir) -lpq
+ EOC
+ fi
+
+ if use sqlite; then
+ cat >> Makefile <<- EOC
+ LOOKUP_SQLITE=yes
+ LOOKUP_SQLITE_PC=sqlite3
+ EOC
+ fi
+
+ if use redis; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_REDIS=yes
+ LOOKUP_LIBS += -lhiredis
+ EOC
+ fi
+
+ #
+ # Exim monitor, enabled by default, controlled via X USE-flag,
+ # disable if not requested, bug #46778
+ if use X; then
+ cp ../exim_monitor/EDITME eximon.conf || die
+ else
+ sed -i -e '/^EXIM_MONITOR=/s/^/# /' Makefile
+ fi
+
+ #
+ # features
+
+ # content scanning support
+ if use exiscan-acl; then
+ cat >> Makefile <<- EOC
+ WITH_CONTENT_SCAN=yes
+ WITH_OLD_DEMIME=yes
+ EOC
+ fi
+
+ # DomainKeys Identified Mail, RFC4871
+ if ! use dkim; then
+ # DKIM is enabled by default
+ cat >> Makefile <<- EOC
+ DISABLE_DKIM=yes
+ EOC
+ fi
+
+ # Per-Recipient-Data-Response
+ if ! use prdr; then
+ # PRDR is enabled by default
+ cat >> Makefile <<- EOC
+ DISABLE_PRDR=yes
+ EOC
+ fi
+
+ # log to syslog
+ if use syslog; then
+ sed -i "s:LOG_FILE_PATH=/var/log/exim/exim_%s.log:LOG_FILE_PATH=syslog:" Makefile
+ cat >> Makefile <<- EOC
+ LOG_FILE_PATH=syslog
+ EOC
+ else
+ cat >> Makefile <<- EOC
+ LOG_FILE_PATH=${EPREFIX}/var/log/exim/exim_%s.log
+ EOC
+ fi
+
+ # starttls support (ssl)
+ if use ssl; then
+ echo "SUPPORT_TLS=yes" >> Makefile
+ if use gnutls; then
+ echo "USE_GNUTLS=yes" >> Makefile
+ echo "USE_GNUTLS_PC=gnutls" >> Makefile
+ use pkcs11 || echo "AVOID_GNUTLS_PKCS11=yes" >> Makefile
+ else
+ echo "USE_OPENSSL_PC=openssl" >> Makefile
+ fi
+ fi
+
+ # TCP wrappers
+ if use tcpd; then
+ cat >> Makefile <<- EOC
+ USE_TCP_WRAPPERS=yes
+ EXTRALIBS_EXIM += -lwrap
+ EOC
+ fi
+
+ # Light Mail Transport Protocol
+ if use lmtp; then
+ cat >> Makefile <<- EOC
+ TRANSPORT_LMTP=yes
+ EOC
+ fi
+
+ # embedded Perl
+ if use perl; then
+ cat >> Makefile <<- EOC
+ EXIM_PERL=perl.o
+ EOC
+ fi
+
+ # dlfunc
+ if use dlfunc; then
+ cat >> Makefile <<- EOC
+ EXPAND_DLFUNC=yes
+ EOC
+ fi
+
+ #
+ # experimental features
+
+ # Distributed Checksum Clearinghouse
+ if use dcc; then
+ echo "EXPERIMENTAL_DCC=yes">> Makefile
+ fi
+
+ # Sender Policy Framework
+ if use spf; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_SPF=yes
+ EXTRALIBS_EXIM += -lspf2
+ EOC
+ fi
+
+ # Sender Rewriting Scheme
+ if use srs; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_SRS=yes
+ EXTRALIBS_EXIM += -lsrs_alt
+ EOC
+ fi
+
+ # DMARC
+ if use dmarc; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_DMARC=yes
+ EXTRALIBS_EXIM += -lopendmarc
+ EOC
+ fi
+
+ # Transport post-delivery actions
+ if use tpda; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_EVENT=yes
+ EOC
+ fi
+
+ # Proxy Protocol
+ if use proxy; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_PROXY=yes
+ EOC
+ fi
+
+ # Delivery Sender Notifications
+ if use dsn; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_DSN=yes
+ EOC
+ fi
+
+ #
+ # authentication (SMTP AUTH)
+
+ # standard bits
+ cat >> Makefile <<- EOC
+ AUTH_SPA=yes
+ AUTH_CRAM_MD5=yes
+ AUTH_PLAINTEXT=yes
+ EOC
+
+ # Cyrus SASL
+ if use sasl; then
+ cat >> Makefile <<- EOC
+ CYRUS_SASLAUTHD_SOCKET=${EPREFIX}/run/saslauthd/mux
+ AUTH_CYRUS_SASL=yes
+ AUTH_LIBS += -lsasl2
+ EOC
+ fi
+
+ # Dovecot
+ if use dovecot-sasl; then
+ cat >> Makefile <<- EOC
+ AUTH_DOVECOT=yes
+ EOC
+ fi
+
+ # Pluggable Authentication Modules
+ if use pam; then
+ cat >> Makefile <<- EOC
+ SUPPORT_PAM=yes
+ AUTH_LIBS += -lpam
+ EOC
+ fi
+
+ # Radius
+ if use radius; then
+ cat >> Makefile <<- EOC
+ RADIUS_CONFIG_FILE=${EPREFIX}/etc/radiusclient/radiusclient.conf
+ RADIUS_LIB_TYPE=RADIUSCLIENT
+ AUTH_LIBS += -lradiusclient
+ EOC
+ fi
+}
+
+src_compile() {
+ emake -j1 CC="$(tc-getCC)" HOSTCC="$(tc-getCC $CBUILD)" \
+ AR="$(tc-getAR) cq" RANLIB="$(tc-getRANLIB)" FULLECHO='' \
+ || die "make failed"
+}
+
+src_install () {
+ cd "${S}"/build-exim-gentoo || die
+ dosbin exim
+ if use X; then
+ dosbin eximon.bin
+ dosbin eximon
+ fi
+ fperms 4755 /usr/sbin/exim
+
+ dosym exim /usr/sbin/sendmail
+ dosym exim /usr/sbin/rsmtp
+ dosym exim /usr/sbin/rmail
+ dosym /usr/sbin/exim /usr/bin/mailq
+ dosym /usr/sbin/exim /usr/bin/newaliases
+ dosym /usr/sbin/sendmail /usr/lib/sendmail
+
+ for i in exicyclog exim_dbmbuild exim_dumpdb exim_fixdb exim_lock \
+ exim_tidydb exinext exiwhat exigrep eximstats exiqsumm exiqgrep \
+ convert4r3 convert4r4 exipick
+ do
+ dosbin $i
+ done
+
+ dodoc "${S}"/doc/*
+ doman "${S}"/doc/exim.8
+ use dsn && dodoc "${S}"/README.DSN
+ use doc && dohtml -r "${WORKDIR}"/${PN}-html-${PV//rc/RC}/doc/html/spec_html/*
+
+ # conf files
+ insinto /etc/exim
+ newins "${S}"/src/configure.default exim.conf.dist
+ if use exiscan-acl; then
+ newins "${S}"/src/configure.default exim.conf.exiscan-acl
+ fi
+ doins "${WORKDIR}"/system_filter.exim
+ doins "${FILESDIR}"/auth_conf.sub
+
+ pamd_mimic system-auth exim auth account
+
+ # headers, #436406
+ if use dlfunc ; then
+ # fixup includes so they actually can be found when including
+ sed -i \
+ -e '/#include "\(config\|store\|mytypes\).h"/s:"\(.\+\)":<exim/\1>:' \
+ local_scan.h || die
+ insinto /usr/include/exim
+ doins {config,local_scan}.h ../src/{mytypes,store}.h
+ fi
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/exim.logrotate" exim
+
+ newinitd "${FILESDIR}"/exim.rc9 exim
+ newconfd "${FILESDIR}"/exim.confd exim
+
+ systemd_dounit "${FILESDIR}"/{exim.service,exim.socket,exim-submission.socket}
+ systemd_newunit "${FILESDIR}"/exim_at.service 'exim@.service'
+ systemd_newunit "${FILESDIR}"/exim-submission_at.service 'exim-submission@.service'
+
+ DIROPTIONS="-m 0750 -o ${MAILUSER} -g ${MAILGROUP}"
+ dodir /var/log/${PN}
+}
+
+pkg_postinst() {
+ if [[ ! -f ${EROOT}etc/exim/exim.conf ]] ; then
+ einfo "${EROOT}etc/exim/system_filter.exim is a sample system_filter."
+ einfo "${EROOT}etc/exim/auth_conf.sub contains the configuration sub for using smtp auth."
+ einfo "Please create ${EROOT}etc/exim/exim.conf from ${EROOT}etc/exim/exim.conf.dist."
+ fi
+ if use dcc ; then
+ einfo "DCC support is experimental, you can find some limited"
+ einfo "documentation at the bottom of this prerelease message:"
+ einfo "http://article.gmane.org/gmane.mail.exim.devel/3579"
+ fi
+ use spf && einfo "SPF support is experimental"
+ use srs && einfo "SRS support is experimental"
+ if use dmarc ; then
+ einfo "DMARC support is experimental. See global settings to"
+ einfo "configure DMARC, for usage see the documentation at "
+ einfo "experimental-spec.txt."
+ fi
+ use tpda && einfo "TPDA/EVENT support is experimental"
+ use proxy && einfo "proxy support is experimental"
+ if use dsn ; then
+ einfo "Starting from Exim 4.83, DSN support comes from upstream."
+ einfo "DSN support is an experimental feature. If you used DSN"
+ einfo "support prior to 4.83, make sure to remove all dsn_process"
+ einfo "switches from your routers, see http://bugs.gentoo.org/511818"
+ fi
+ einfo "Exim maintains some db files under its spool directory that need"
+ einfo "cleaning from time to time. (${EROOT}var/spool/exim/db)"
+ einfo "Please use the exim_tidydb tool as documented in the Exim manual:"
+ einfo "http://www.exim.org/exim-html-current/doc/html/spec_html/ch-exim_utilities.html#SECThindatmai"
+}
diff --git a/mail-mta/exim/exim-4.86.ebuild b/mail-mta/exim/exim-4.86.ebuild
new file mode 100644
index 00000000000..5f27531fd69
--- /dev/null
+++ b/mail-mta/exim/exim-4.86.ebuild
@@ -0,0 +1,508 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils toolchain-funcs multilib pam systemd
+
+IUSE="dcc +dkim dlfunc dmarc +dnsdb doc dovecot-sasl dsn exiscan-acl gnutls ipv6 ldap lmtp maildir mbx mysql nis pam perl pkcs11 postgres +prdr proxy radius redis sasl selinux spf sqlite srs ssl syslog tcpd tpda X"
+REQUIRED_USE="spf? ( exiscan-acl ) srs? ( exiscan-acl ) dmarc? ( spf dkim ) pkcs11? ( gnutls )"
+
+COMM_URI="ftp://ftp.exim.org/pub/exim/exim4$([[ ${PV} == *_rc* ]] && echo /test)"
+
+DESCRIPTION="A highly configurable, drop-in replacement for sendmail"
+SRC_URI="${COMM_URI}/${P//rc/RC}.tar.bz2
+ mirror://gentoo/system_filter.exim.gz
+ doc? ( ${COMM_URI}/${PN}-html-${PV//rc/RC}.tar.bz2 )"
+HOMEPAGE="http://www.exim.org/"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-solaris"
+
+COMMON_DEPEND=">=sys-apps/sed-4.0.5
+ >=sys-libs/db-3.2
+ dev-libs/libpcre
+ perl? ( dev-lang/perl:= )
+ pam? ( virtual/pam )
+ tcpd? ( sys-apps/tcp-wrappers )
+ ssl? ( dev-libs/openssl )
+ gnutls? ( net-libs/gnutls[pkcs11?]
+ dev-libs/libtasn1 )
+ ldap? ( >=net-nds/openldap-2.0.7 )
+ mysql? ( virtual/mysql )
+ postgres? ( dev-db/postgresql )
+ sasl? ( >=dev-libs/cyrus-sasl-2.1.26-r2 )
+ redis? ( dev-libs/hiredis )
+ spf? ( >=mail-filter/libspf2-1.2.5-r1 )
+ dmarc? ( mail-filter/opendmarc )
+ srs? ( mail-filter/libsrs_alt )
+ X? ( x11-proto/xproto
+ x11-libs/libX11
+ x11-libs/libXmu
+ x11-libs/libXt
+ x11-libs/libXaw
+ )
+ sqlite? ( dev-db/sqlite )
+ radius? ( net-dialup/radiusclient )
+ virtual/libiconv
+ "
+ # added X check for #57206
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig"
+RDEPEND="${COMMON_DEPEND}
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/mini-qmail
+ !<mail-mta/msmtp-1.4.19-r1
+ !>=mail-mta/msmtp-1.4.19-r1[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ !net-mail/mailwrapper
+ >=net-mail/mailbase-0.00-r5
+ virtual/logger
+ dcc? ( mail-filter/dcc )
+ selinux? ( sec-policy/selinux-exim )
+ "
+
+S=${WORKDIR}/${P//rc/RC}
+
+src_prepare() {
+ epatch "${FILESDIR}"/exim-4.14-tail.patch
+ epatch "${FILESDIR}"/exim-4.74-localscan_dlopen.patch
+ epatch "${FILESDIR}"/exim-4.69-r1.27021.patch
+ epatch "${FILESDIR}"/exim-4.74-radius-db-ENV-clash.patch # 287426
+ epatch "${FILESDIR}"/exim-4.82-makefile-freebsd.patch # 235785
+ epatch "${FILESDIR}"/exim-4.77-as-needed-ldflags.patch # 352265, 391279
+ epatch "${FILESDIR}"/exim-4.76-crosscompile.patch # 266591
+
+ if use maildir ; then
+ epatch "${FILESDIR}"/exim-4.20-maildir.patch
+ else
+ epatch "${FILESDIR}"/exim-4.80-spool-mail-group.patch # 438606
+ fi
+
+ # user Exim believes it should be
+ MAILUSER=mail
+ MAILGROUP=mail
+ if use prefix && [[ ${EUID} != 0 ]] ; then
+ MAILUSER=$(id -un)
+ MAILGROUP=$(id -gn)
+ fi
+}
+
+src_configure() {
+ # general config and paths
+
+ sed -i.orig \
+ -e "/SYSTEM_ALIASES_FILE/s'SYSTEM_ALIASES_FILE'${EPREFIX}/etc/mail/aliases'" \
+ "${S}"/src/configure.default || die
+
+ sed -i -e 's/^buildname=.*/buildname=exim-gentoo/g' Makefile || die
+
+ sed -e "48i\CFLAGS=${CFLAGS}" \
+ -e "s:BIN_DIRECTORY=/usr/exim/bin:BIN_DIRECTORY=${EPREFIX}/usr/sbin:" \
+ -e "s:EXIM_USER=:EXIM_USER=${MAILUSER}:" \
+ -e "s:CONFIGURE_FILE=/usr/exim/configure:CONFIGURE_FILE=${EPREFIX}/etc/exim/exim.conf:" \
+ -e "s:ZCAT_COMMAND=.*$:ZCAT_COMMAND=${EPREFIX}/bin/zcat:" \
+ -e "s:COMPRESS_COMMAND=.*$:COMPRESS_COMMAND=${EPREFIX}/bin/gzip:" \
+ src/EDITME > Local/Makefile
+
+ cd Local
+
+ cat >> Makefile <<- EOC
+ INFO_DIRECTORY=${EPREFIX}/usr/share/info
+ PID_FILE_PATH=${EPREFIX}/run/exim.pid
+ SPOOL_DIRECTORY=${EPREFIX}/var/spool/exim
+ HAVE_ICONV=yes
+ EOC
+
+ # if we use libiconv, now is the time to tell so
+ use !elibc_glibc && echo "EXTRALIBS_EXIM=-liconv" >> Makefile
+
+ # support for IPv6
+ if use ipv6; then
+ cat >> Makefile <<- EOC
+ HAVE_IPV6=YES
+ EOC
+ fi
+
+ #
+ # mail storage formats
+
+ # mailstore is Exim's traditional storage format
+ cat >> Makefile <<- EOC
+ SUPPORT_MAILSTORE=yes
+ EOC
+
+ # mbox
+ if use mbx; then
+ cat >> Makefile <<- EOC
+ SUPPORT_MBX=yes
+ EOC
+ fi
+
+ # maildir
+ if use maildir; then
+ cat >> Makefile <<- EOC
+ SUPPORT_MAILDIR=yes
+ EOC
+ fi
+
+ #
+ # lookup methods
+
+ # use the "native" interfaces to the DBM and CDB libraries, support
+ # passwd and directory lookups by default
+ cat >> Makefile <<- EOC
+ USE_DB=yes
+ DBMLIB=-ldb
+ LOOKUP_CDB=yes
+ LOOKUP_PASSWD=yes
+ LOOKUP_DSEARCH=yes
+ EOC
+
+ if ! use dnsdb; then
+ # DNSDB lookup is enabled by default
+ sed -i "s:^LOOKUP_DNSDB=yes:# LOOKUP_DNSDB=yes:" Makefile
+ fi
+
+ if use ldap; then
+ cat >> Makefile <<- EOC
+ LOOKUP_LDAP=yes
+ LDAP_LIB_TYPE=OPENLDAP2
+ LOOKUP_INCLUDE += -I"${EROOT}"usr/include/ldap
+ LOOKUP_LIBS += -lldap -llber
+ EOC
+ fi
+
+ if use mysql; then
+ cat >> Makefile <<- EOC
+ LOOKUP_MYSQL=yes
+ LOOKUP_INCLUDE += $(mysql_config --include)
+ LOOKUP_LIBS += $(mysql_config --libs)
+ EOC
+ fi
+
+ if use nis; then
+ cat >> Makefile <<- EOC
+ LOOKUP_NIS=yes
+ LOOKUP_NISPLUS=yes
+ EOC
+ fi
+
+ if use postgres; then
+ cat >> Makefile <<- EOC
+ LOOKUP_PGSQL=yes
+ LOOKUP_INCLUDE += -I$(pg_config --includedir)
+ LOOKUP_LIBS += -L$(pg_config --libdir) -lpq
+ EOC
+ fi
+
+ if use sqlite; then
+ cat >> Makefile <<- EOC
+ LOOKUP_SQLITE=yes
+ LOOKUP_SQLITE_PC=sqlite3
+ EOC
+ fi
+
+ if use redis; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_REDIS=yes
+ LOOKUP_LIBS += -lhiredis
+ EOC
+ fi
+
+ #
+ # Exim monitor, enabled by default, controlled via X USE-flag,
+ # disable if not requested, bug #46778
+ if use X; then
+ cp ../exim_monitor/EDITME eximon.conf || die
+ else
+ sed -i -e '/^EXIM_MONITOR=/s/^/# /' Makefile
+ fi
+
+ #
+ # features
+
+ # content scanning support
+ if use exiscan-acl; then
+ cat >> Makefile <<- EOC
+ WITH_CONTENT_SCAN=yes
+ WITH_OLD_DEMIME=yes
+ EOC
+ fi
+
+ # DomainKeys Identified Mail, RFC4871
+ if ! use dkim; then
+ # DKIM is enabled by default
+ cat >> Makefile <<- EOC
+ DISABLE_DKIM=yes
+ EOC
+ fi
+
+ # Per-Recipient-Data-Response
+ if ! use prdr; then
+ # PRDR is enabled by default
+ cat >> Makefile <<- EOC
+ DISABLE_PRDR=yes
+ EOC
+ fi
+
+ # log to syslog
+ if use syslog; then
+ sed -i "s:LOG_FILE_PATH=/var/log/exim/exim_%s.log:LOG_FILE_PATH=syslog:" Makefile
+ cat >> Makefile <<- EOC
+ LOG_FILE_PATH=syslog
+ EOC
+ else
+ cat >> Makefile <<- EOC
+ LOG_FILE_PATH=${EPREFIX}/var/log/exim/exim_%s.log
+ EOC
+ fi
+
+ # starttls support (ssl)
+ if use ssl; then
+ echo "SUPPORT_TLS=yes" >> Makefile
+ if use gnutls; then
+ echo "USE_GNUTLS=yes" >> Makefile
+ echo "USE_GNUTLS_PC=gnutls" >> Makefile
+ use pkcs11 || echo "AVOID_GNUTLS_PKCS11=yes" >> Makefile
+ else
+ echo "USE_OPENSSL_PC=openssl" >> Makefile
+ fi
+ fi
+
+ # TCP wrappers
+ if use tcpd; then
+ cat >> Makefile <<- EOC
+ USE_TCP_WRAPPERS=yes
+ EXTRALIBS_EXIM += -lwrap
+ EOC
+ fi
+
+ # Light Mail Transport Protocol
+ if use lmtp; then
+ cat >> Makefile <<- EOC
+ TRANSPORT_LMTP=yes
+ EOC
+ fi
+
+ # embedded Perl
+ if use perl; then
+ cat >> Makefile <<- EOC
+ EXIM_PERL=perl.o
+ EOC
+ fi
+
+ # dlfunc
+ if use dlfunc; then
+ cat >> Makefile <<- EOC
+ EXPAND_DLFUNC=yes
+ EOC
+ fi
+
+ #
+ # experimental features
+
+ # Distributed Checksum Clearinghouse
+ if use dcc; then
+ echo "EXPERIMENTAL_DCC=yes">> Makefile
+ fi
+
+ # Sender Policy Framework
+ if use spf; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_SPF=yes
+ EXTRALIBS_EXIM += -lspf2
+ EOC
+ fi
+
+ # Sender Rewriting Scheme
+ if use srs; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_SRS=yes
+ EXTRALIBS_EXIM += -lsrs_alt
+ EOC
+ fi
+
+ # DMARC
+ if use dmarc; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_DMARC=yes
+ EXTRALIBS_EXIM += -lopendmarc
+ EOC
+ fi
+
+ # Transport post-delivery actions
+ if use tpda; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_EVENT=yes
+ EOC
+ fi
+
+ # Proxy Protocol
+ if use proxy; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_PROXY=yes
+ EOC
+ fi
+
+ # Delivery Sender Notifications
+ if use dsn; then
+ cat >> Makefile <<- EOC
+ EXPERIMENTAL_DSN=yes
+ EOC
+ fi
+
+ #
+ # authentication (SMTP AUTH)
+
+ # standard bits
+ cat >> Makefile <<- EOC
+ AUTH_SPA=yes
+ AUTH_CRAM_MD5=yes
+ AUTH_PLAINTEXT=yes
+ EOC
+
+ # Cyrus SASL
+ if use sasl; then
+ cat >> Makefile <<- EOC
+ CYRUS_SASLAUTHD_SOCKET=${EPREFIX}/run/saslauthd/mux
+ AUTH_CYRUS_SASL=yes
+ AUTH_LIBS += -lsasl2
+ EOC
+ fi
+
+ # Dovecot
+ if use dovecot-sasl; then
+ cat >> Makefile <<- EOC
+ AUTH_DOVECOT=yes
+ EOC
+ fi
+
+ # Pluggable Authentication Modules
+ if use pam; then
+ cat >> Makefile <<- EOC
+ SUPPORT_PAM=yes
+ AUTH_LIBS += -lpam
+ EOC
+ fi
+
+ # Radius
+ if use radius; then
+ cat >> Makefile <<- EOC
+ RADIUS_CONFIG_FILE=${EPREFIX}/etc/radiusclient/radiusclient.conf
+ RADIUS_LIB_TYPE=RADIUSCLIENT
+ AUTH_LIBS += -lradiusclient
+ EOC
+ fi
+}
+
+src_compile() {
+ emake -j1 CC="$(tc-getCC)" HOSTCC="$(tc-getCC $CBUILD)" \
+ AR="$(tc-getAR) cq" RANLIB="$(tc-getRANLIB)" FULLECHO='' \
+ || die "make failed"
+}
+
+src_install () {
+ cd "${S}"/build-exim-gentoo || die
+ dosbin exim
+ if use X; then
+ dosbin eximon.bin
+ dosbin eximon
+ fi
+ fperms 4755 /usr/sbin/exim
+
+ dosym exim /usr/sbin/sendmail
+ dosym exim /usr/sbin/rsmtp
+ dosym exim /usr/sbin/rmail
+ dosym /usr/sbin/exim /usr/bin/mailq
+ dosym /usr/sbin/exim /usr/bin/newaliases
+ dosym /usr/sbin/sendmail /usr/lib/sendmail
+
+ for i in exicyclog exim_dbmbuild exim_dumpdb exim_fixdb exim_lock \
+ exim_tidydb exinext exiwhat exigrep eximstats exiqsumm exiqgrep \
+ convert4r3 convert4r4 exipick
+ do
+ dosbin $i
+ done
+
+ dodoc "${S}"/doc/*
+ doman "${S}"/doc/exim.8
+ use dsn && dodoc "${S}"/README.DSN
+ use doc && dohtml -r "${WORKDIR}"/${PN}-html-${PV//rc/RC}/doc/html/spec_html/*
+
+ # conf files
+ insinto /etc/exim
+ newins "${S}"/src/configure.default exim.conf.dist
+ if use exiscan-acl; then
+ newins "${S}"/src/configure.default exim.conf.exiscan-acl
+ fi
+ doins "${WORKDIR}"/system_filter.exim
+ doins "${FILESDIR}"/auth_conf.sub
+
+ pamd_mimic system-auth exim auth account
+
+ # headers, #436406
+ if use dlfunc ; then
+ # fixup includes so they actually can be found when including
+ sed -i \
+ -e '/#include "\(config\|store\|mytypes\).h"/s:"\(.\+\)":<exim/\1>:' \
+ local_scan.h || die
+ insinto /usr/include/exim
+ doins {config,local_scan}.h ../src/{mytypes,store}.h
+ fi
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/exim.logrotate" exim
+
+ newinitd "${FILESDIR}"/exim.rc9 exim
+ newconfd "${FILESDIR}"/exim.confd exim
+
+ systemd_dounit "${FILESDIR}"/{exim.service,exim.socket,exim-submission.socket}
+ systemd_newunit "${FILESDIR}"/exim_at.service 'exim@.service'
+ systemd_newunit "${FILESDIR}"/exim-submission_at.service 'exim-submission@.service'
+
+ DIROPTIONS="-m 0750 -o ${MAILUSER} -g ${MAILGROUP}"
+ dodir /var/log/${PN}
+}
+
+pkg_postinst() {
+ if [[ ! -f ${EROOT}etc/exim/exim.conf ]] ; then
+ einfo "${EROOT}etc/exim/system_filter.exim is a sample system_filter."
+ einfo "${EROOT}etc/exim/auth_conf.sub contains the configuration sub for using smtp auth."
+ einfo "Please create ${EROOT}etc/exim/exim.conf from ${EROOT}etc/exim/exim.conf.dist."
+ fi
+ if use dcc ; then
+ einfo "DCC support is experimental, you can find some limited"
+ einfo "documentation at the bottom of this prerelease message:"
+ einfo "http://article.gmane.org/gmane.mail.exim.devel/3579"
+ fi
+ use spf && einfo "SPF support is experimental"
+ use srs && einfo "SRS support is experimental"
+ if use dmarc ; then
+ einfo "DMARC support is experimental. See global settings to"
+ einfo "configure DMARC, for usage see the documentation at "
+ einfo "experimental-spec.txt."
+ fi
+ use tpda && einfo "TPDA/EVENT support is experimental"
+ use proxy && einfo "proxy support is experimental"
+ if use dsn ; then
+ einfo "Starting from Exim 4.83, DSN support comes from upstream."
+ einfo "DSN support is an experimental feature. If you used DSN"
+ einfo "support prior to 4.83, make sure to remove all dsn_process"
+ einfo "switches from your routers, see http://bugs.gentoo.org/511818"
+ fi
+ einfo "Exim maintains some db files under its spool directory that need"
+ einfo "cleaning from time to time. (${EROOT}var/spool/exim/db)"
+ einfo "Please use the exim_tidydb tool as documented in the Exim manual:"
+ einfo "http://www.exim.org/exim-html-current/doc/html/spec_html/ch-exim_utilities.html#SECThindatmai"
+}
diff --git a/mail-mta/exim/files/auth_conf.sub b/mail-mta/exim/files/auth_conf.sub
new file mode 100644
index 00000000000..24434a7164a
--- /dev/null
+++ b/mail-mta/exim/files/auth_conf.sub
@@ -0,0 +1,25 @@
+######################################################################
+# AUTHENTICATION CONFIGURATION #
+######################################################################
+# If you're using PAM to authenticate, lifes real simple.
+# This plain directive works for nearly everything except windows MUA's the
+# login directive will allow you to authenticate your Outlook 2000 and
+# outlook express clients.
+
+
+
+plain:
+ driver = plaintext
+ public_name = PLAIN
+ server_condition = "${if pam{$2:$3}{1}{0}}"
+ server_set_id = $2
+
+login:
+ driver = plaintext
+ public_name = LOGIN
+ server_prompts = "Username:: : Password::"
+ server_condition = "${if pam{$1:${sg{$2}{:}{::}}}{1}{0}}"
+ server_set_id = $1
+#
+# FIXME
+# Need to add authenticator for SPA!!
diff --git a/mail-mta/exim/files/exim-4.14-tail.patch b/mail-mta/exim/files/exim-4.14-tail.patch
new file mode 100644
index 00000000000..481dca9b80d
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.14-tail.patch
@@ -0,0 +1,11 @@
+--- scripts/Configure-config.h.orig 2003-07-17 18:01:19.000000000 -0400
++++ scripts/Configure-config.h 2003-07-17 18:01:25.000000000 -0400
+@@ -41,7 +41,7 @@
+
+ # Double-check that config.h is complete.
+
+-if [ "`tail -1 config.h`" != "/* End of config.h */" ] ; then
++if [ "`tail -n 1 config.h`" != "/* End of config.h */" ] ; then
+ echo "*** config.h appears to be incomplete"
+ echo "*** unexpected failure in buildconfig program"
+ exit 1
diff --git a/mail-mta/exim/files/exim-4.20-maildir.patch b/mail-mta/exim/files/exim-4.20-maildir.patch
new file mode 100644
index 00000000000..3cb198d545c
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.20-maildir.patch
@@ -0,0 +1,14 @@
+diff -urN ./exim-4.20.orig/src/configure.default exim-4.20/src/configure.default
+--- ./exim-4.20.orig/src/configure.default 2003-06-27 16:48:22.000000000 -0700
++++ exim-4.20/src/configure.default 2003-06-27 16:52:20.000000000 -0700
+@@ -451,7 +451,9 @@
+
+ local_delivery:
+ driver = appendfile
+- file = /var/mail/$local_part
++# file = /var/mail/$local_part
++ directory = /home/$local_part/.maildir
++ maildir_format
+ delivery_date_add
+ envelope_to_add
+ return_path_add
diff --git a/mail-mta/exim/files/exim-4.69-r1.27021.patch b/mail-mta/exim/files/exim-4.69-r1.27021.patch
new file mode 100644
index 00000000000..804e16d6acd
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.69-r1.27021.patch
@@ -0,0 +1,48 @@
+diff -urN exim-4.69.orig/src/configure.default exim-4.69/src/configure.default
+--- exim-4.69.orig/src/configure.default 2008-05-05 10:17:44.000000000 +0100
++++ exim-4.69/src/configure.default 2008-05-05 10:18:26.000000000 +0100
+@@ -592,6 +592,22 @@
+ pipe_transport = address_pipe
+ reply_transport = address_reply
+
++# This router runs procmail if users have a .procmailrc file
++procmail:
++ check_local_user
++ driver = accept
++ transport = procmail_pipe
++ require_files = ${local_part}:+${home}:+${home}/.procmailrc:+/usr/bin/procmail
++ no_verify
++
++# This router runs maildrop if users have a .mailfilter file
++maildrop:
++ check_local_user
++ driver = accept
++ transport = maildrop_pipe
++ require_files = ${local_part}:+${home}:+${home}/.mailfilter:+/usr/bin/maildrop
++ no_verify
++
+
+ # This router matches local user mailboxes. If the router fails, the error
+ # message is "Unknown user".
+@@ -676,6 +692,21 @@
+ address_reply:
+ driver = autoreply
+
++# This transport is used for procmail
++procmail_pipe:
++ driver = pipe
++ command = "/usr/bin/procmail -d ${local_part}"
++ return_path_add
++ delivery_date_add
++ envelope_to_add
++
++# This transport is used for courier-maildrop filtering (Maildir filter system)
++maildrop_pipe:
++ driver = pipe
++ command = "/usr/bin/maildrop -d ${local_part}"
++ return_path_add
++ delivery_date_add
++ envelope_to_add
+
+
+ ######################################################################
diff --git a/mail-mta/exim/files/exim-4.74-localscan_dlopen.patch b/mail-mta/exim/files/exim-4.74-localscan_dlopen.patch
new file mode 100644
index 00000000000..3bb57c1637c
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.74-localscan_dlopen.patch
@@ -0,0 +1,262 @@
+diff -Naur exim-4.32/src/EDITME exim-4.32-dlopen/src/EDITME
+--- src/EDITME 2004-04-15 08:27:01.000000000 +0000
++++ src/EDITME 2004-05-06 16:15:47.000000000 +0000
+@@ -505,6 +505,24 @@
+
+
+ #------------------------------------------------------------------------------
++# On systems which support dynamic loading of shared libraries, Exim can
++# load a local_scan function specified in its config file instead of having
++# to be recompiled with the desired local_scan function. For a full
++# description of the API to this function, see the Exim specification.
++
++DLOPEN_LOCAL_SCAN=yes
++
++# If you set DLOPEN_LOCAL_SCAN, then you need to include -rdynamic in the
++# linker flags. Without it, the loaded .so won't be able to access any
++# functions from exim.
++
++LFLAGS = -rdynamic
++ifeq ($(OSTYPE),Linux)
++LFLAGS += -ldl
++endif
++
++
++#------------------------------------------------------------------------------
+ # The default distribution of Exim contains only the plain text form of the
+ # documentation. Other forms are available separately. If you want to install
+ # the documentation in "info" format, first fetch the Texinfo documentation
+diff -Naur exim-4.32/src/config.h.defaults exim-4.32-dlopen/src/config.h.defaults
+--- src/config.h.defaults 2004-04-15 08:27:01.000000000 +0000
++++ src/config.h.defaults 2004-05-06 16:16:30.000000000 +0000
+@@ -20,6 +20,8 @@
+ #define AUTH_PLAINTEXT
+ #define AUTH_SPA
+
++#define DLOPEN_LOCAL_SCAN
++
+ #define BIN_DIRECTORY
+
+ #define CONFIGURE_FILE
+diff -Naur exim-4.32/src/globals.c exim-4.32-dlopen/src/globals.c
+--- src/globals.c 2004-04-15 08:27:01.000000000 +0000
++++ src/globals.c 2004-05-06 16:17:07.000000000 +0000
+@@ -109,6 +109,10 @@
+ uschar *tls_verify_hosts = NULL;
+ #endif
+
++#ifdef DLOPEN_LOCAL_SCAN
++uschar *local_scan_path = NULL;
++#endif
++
+
+ /* Input-reading functions for messages, so we can use special ones for
+ incoming TCP/IP. The defaults use stdin. We never need these for any
+diff -Naur exim-4.32/src/globals.h exim-4.32-dlopen/src/globals.h
+--- src/globals.h 2004-04-15 08:27:01.000000000 +0000
++++ src/globals.h 2004-05-06 16:17:50.000000000 +0000
+@@ -73,6 +73,9 @@
+ extern uschar *tls_verify_hosts; /* Mandatory client verification */
+ #endif
+
++#ifdef DLOPEN_LOCAL_SCAN
++extern uschar *local_scan_path; /* Path to local_scan() library */
++#endif
+
+ /* Input-reading functions for messages, so we can use special ones for
+ incoming TCP/IP. */
+diff -Naur exim-4.32/src/local_scan.c exim-4.32-dlopen/src/local_scan.c
+--- src/local_scan.c 2004-04-15 08:27:01.000000000 +0000
++++ src/local_scan.c 2004-05-06 16:21:57.000000000 +0000
+@@ -5,60 +5,131 @@
+ /* Copyright (c) University of Cambridge 1995 - 2004 */
+ /* See the file NOTICE for conditions of use and distribution. */
+
++#include "exim.h"
+
+-/******************************************************************************
+-This file contains a template local_scan() function that just returns ACCEPT.
+-If you want to implement your own version, you should copy this file to, say
+-Local/local_scan.c, and edit the copy. To use your version instead of the
+-default, you must set
+-
+-LOCAL_SCAN_SOURCE=Local/local_scan.c
+-
+-in your Local/Makefile. This makes it easy to copy your version for use with
+-subsequent Exim releases.
+-
+-For a full description of the API to this function, see the Exim specification.
+-******************************************************************************/
+-
+-
+-/* This is the only Exim header that you should include. The effect of
+-including any other Exim header is not defined, and may change from release to
+-release. Use only the documented interface! */
+-
+-#include "local_scan.h"
+-
+-
+-/* This is a "do-nothing" version of a local_scan() function. The arguments
+-are:
+-
+- fd The file descriptor of the open -D file, which contains the
+- body of the message. The file is open for reading and
+- writing, but modifying it is dangerous and not recommended.
+-
+- return_text A pointer to an unsigned char* variable which you can set in
+- order to return a text string. It is initialized to NULL.
+-
+-The return values of this function are:
+-
+- LOCAL_SCAN_ACCEPT
+- The message is to be accepted. The return_text argument is
+- saved in $local_scan_data.
+-
+- LOCAL_SCAN_REJECT
+- The message is to be rejected. The returned text is used
+- in the rejection message.
+-
+- LOCAL_SCAN_TEMPREJECT
+- This specifies a temporary rejection. The returned text
+- is used in the rejection message.
+-*/
++#ifdef DLOPEN_LOCAL_SCAN
++#include <dlfcn.h>
++static int (*local_scan_fn)(int fd, uschar **return_text) = NULL;
++static int load_local_scan_library(void);
++#endif
+
+ int
+ local_scan(int fd, uschar **return_text)
+ {
+ fd = fd; /* Keep picky compilers happy */
+ return_text = return_text;
+-return LOCAL_SCAN_ACCEPT;
++#ifdef DLOPEN_LOCAL_SCAN
++/* local_scan_path is defined AND not the empty string */
++if (local_scan_path && *local_scan_path)
++ {
++ if (!local_scan_fn)
++ {
++ if (!load_local_scan_library())
++ {
++ char *base_msg , *error_msg , *final_msg ;
++ int final_length = -1 ;
++
++ base_msg=US"Local configuration error - local_scan() library failure\n";
++ error_msg = dlerror() ;
++
++ final_length = strlen(base_msg) + strlen(error_msg) + 1 ;
++ final_msg = (char*)malloc( final_length*sizeof(char) ) ;
++ *final_msg = '\0' ;
++
++ strcat( final_msg , base_msg ) ;
++ strcat( final_msg , error_msg ) ;
++
++ *return_text = final_msg ;
++ return LOCAL_SCAN_TEMPREJECT;
++ }
++ }
++ return local_scan_fn(fd, return_text);
++ }
++else
++#endif
++ return LOCAL_SCAN_ACCEPT;
++}
++
++#ifdef DLOPEN_LOCAL_SCAN
++
++static int load_local_scan_library(void)
++{
++/* No point in keeping local_scan_lib since we'll never dlclose() anyway */
++void *local_scan_lib = NULL;
++int (*local_scan_version_fn)(void);
++int vers_maj;
++int vers_min;
++
++local_scan_lib = dlopen(local_scan_path, RTLD_NOW);
++if (!local_scan_lib)
++ {
++ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() library open failed - "
++ "message temporarily rejected");
++ return FALSE;
++ }
++
++local_scan_version_fn = dlsym(local_scan_lib, "local_scan_version_major");
++if (!local_scan_version_fn)
++ {
++ dlclose(local_scan_lib);
++ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() library doesn't contain "
++ "local_scan_version_major() function - message temporarily rejected");
++ return FALSE;
++ }
++
++/* The major number is increased when the ABI is changed in a non
++ backward compatible way. */
++vers_maj = local_scan_version_fn();
++
++local_scan_version_fn = dlsym(local_scan_lib, "local_scan_version_minor");
++if (!local_scan_version_fn)
++ {
++ dlclose(local_scan_lib);
++ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() library doesn't contain "
++ "local_scan_version_minor() function - message temporarily rejected");
++ return FALSE;
++ }
++
++/* The minor number is increased each time a new feature is added (in a
++ way that doesn't break backward compatibility) -- Marc */
++vers_min = local_scan_version_fn();
++
++
++if (vers_maj != LOCAL_SCAN_ABI_VERSION_MAJOR)
++ {
++ dlclose(local_scan_lib);
++ local_scan_lib = NULL;
++ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() has an incompatible major"
++ "version number, you need to recompile your module for this version"
++ "of exim (The module was compiled for version %d.%d and this exim provides"
++ "ABI version %d.%d)", vers_maj, vers_min, LOCAL_SCAN_ABI_VERSION_MAJOR,
++ LOCAL_SCAN_ABI_VERSION_MINOR);
++ return FALSE;
++ }
++else if (vers_min > LOCAL_SCAN_ABI_VERSION_MINOR)
++ {
++ dlclose(local_scan_lib);
++ local_scan_lib = NULL;
++ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() has an incompatible minor"
++ "version number, you need to recompile your module for this version"
++ "of exim (The module was compiled for version %d.%d and this exim provides"
++ "ABI version %d.%d)", vers_maj, vers_min, LOCAL_SCAN_ABI_VERSION_MAJOR,
++ LOCAL_SCAN_ABI_VERSION_MINOR);
++ return FALSE;
++ }
++
++local_scan_fn = dlsym(local_scan_lib, "local_scan");
++if (!local_scan_fn)
++ {
++ dlclose(local_scan_lib);
++ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() library doesn't contain "
++ "local_scan() function - message temporarily rejected");
++ return FALSE;
++ }
++
++return TRUE;
+ }
+
++#endif /* DLOPEN_LOCAL_SCAN */
++
+ /* End of local_scan.c */
+diff -Naur exim-4.32/src/readconf.c exim-4.32-dlopen/src/readconf.c
+--- src/readconf.c 2004-04-15 08:27:01.000000000 +0000
++++ src/readconf.c 2004-05-06 16:23:12.000000000 +0000
+@@ -223,6 +223,9 @@
+ { "local_from_prefix", opt_stringptr, &local_from_prefix },
+ { "local_from_suffix", opt_stringptr, &local_from_suffix },
+ { "local_interfaces", opt_stringptr, &local_interfaces },
++#ifdef DLOPEN_LOCAL_SCAN
++ { "local_scan_path", opt_stringptr, &local_scan_path },
++#endif
+ { "local_scan_timeout", opt_time, &local_scan_timeout },
+ { "local_sender_retain", opt_bool, &local_sender_retain },
+ { "localhost_number", opt_stringptr, &host_number_string },
diff --git a/mail-mta/exim/files/exim-4.74-radius-db-ENV-clash.patch b/mail-mta/exim/files/exim-4.74-radius-db-ENV-clash.patch
new file mode 100644
index 00000000000..247668ef3da
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.74-radius-db-ENV-clash.patch
@@ -0,0 +1,22 @@
+Nasty workaround for
+http://bugs.gentoo.org/show_bug.cgi?id=287426
+
+--- src/auths/call_radius.c
++++ src/auths/call_radius.c
+@@ -10,6 +10,16 @@
+ /* This file was originally supplied by Ian Kirk. The libradius support came
+ from Alex Kiernan. */
+
++/* ugly hack to work around redefinition of ENV by radiusclient.h and
++ * db.h: define _DB_H_ so the db.h include thinks it's already included,
++ * we can get away with it like this, since this file doesn't use any db
++ * functions. */
++#ifndef _DB_H_
++#define _DB_H_ 1
++#define _DB_EXT_PROT_IN_ 1
++#define DB void
++#endif
++
+ #include "../exim.h"
+
+ /* This module contains functions that call the Radius authentication
diff --git a/mail-mta/exim/files/exim-4.76-crosscompile.patch b/mail-mta/exim/files/exim-4.76-crosscompile.patch
new file mode 100644
index 00000000000..cf47adee626
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.76-crosscompile.patch
@@ -0,0 +1,15 @@
+https://bugs.gentoo.org/show_bug.cgi?id=266591
+
+--- OS/Makefile-Base
++++ OS/Makefile-Base
+@@ -114,8 +114,8 @@
+
+ # Targets for special-purpose configuration header builders
+ buildconfig: buildconfig.c
+- @echo "$(CC) buildconfig.c"
+- $(FE)$(CC) $(CFLAGS) $(INCLUDE) -o buildconfig buildconfig.c $(LIBS)
++ @echo "$(HOSTCC) buildconfig.c"
++ $(FE)$(HOSTCC) $(HOSTCFLAGS) $(INCLUDE) -o buildconfig buildconfig.c $(LIBS)
+
+
+ # Target for the exicyclog utility script
diff --git a/mail-mta/exim/files/exim-4.76-dsn.patch b/mail-mta/exim/files/exim-4.76-dsn.patch
new file mode 100644
index 00000000000..8a608ba62fb
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.76-dsn.patch
@@ -0,0 +1,18 @@
+http://bugs.gentoo.org/show_bug.cgi?id=366835
+https://sourceforge.net/tracker/?func=detail&aid=3300653&group_id=121058&atid=689120
+
+--- exim_469_dsn_1_3.patch
++++ exim_469_dsn_1_3.patch
+@@ -524,10 +524,10 @@
+ diff -urN exim-4.69-orig/src/readconf.c exim-4.69-dsn/src/readconf.c
+ --- exim-4.69-orig/src/readconf.c 2007-08-23 12:01:49.000000000 +0100
+ +++ exim-4.69-dsn/src/readconf.c 2008-07-28 09:52:55.000000000 +0100
+-@@ -207,6 +207,9 @@
+- { "dns_ipv4_lookup", opt_stringptr, &dns_ipv4_lookup },
++@@ -219,6 +219,9 @@
+ { "dns_retrans", opt_time, &dns_retrans },
+ { "dns_retry", opt_int, &dns_retry },
++ { "dns_use_edns0", opt_int, &dns_use_edns0 },
+ +#ifdef SUPPORT_DSN
+ + { "dsn", opt_bool, &dsn },
+ +#endif
diff --git a/mail-mta/exim/files/exim-4.77-as-needed-ldflags.patch b/mail-mta/exim/files/exim-4.77-as-needed-ldflags.patch
new file mode 100644
index 00000000000..4eac9aa3a2a
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.77-as-needed-ldflags.patch
@@ -0,0 +1,144 @@
+https://bugs.gentoo.org/show_bug.cgi?id=352265
+
+Make sure LDFLAGS comes first, such that all libraries are considered,
+and not discarded when --as-needed is in effect.
+
+https://bugs.gentoo.org/show_bug.cgi?id=391279
+
+Use LDFLAGS for all targets, not just the exim binary, such that
+--as-needed works as well.
+
+
+--- OS/Makefile-Base
++++ OS/Makefile-Base
+@@ -327,12 +327,12 @@
+ $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) version.c
+ rm -f exim
+ @echo "$(LNCC) -o exim"
+- $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
++ $(FE)$(PURIFY) $(LNCC) -o exim $(LDFLAGS) $(OBJ_EXIM) version.o \
+ routers/routers.a transports/transports.a lookups/lookups.a \
+ auths/auths.a pdkim/pdkim.a \
+ $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
+ $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
+- $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LDFLAGS)
++ $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LFLAGS)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim; \
+ $(STRIP_COMMAND) exim; \
+@@ -340,8 +340,8 @@
+
+ exim_dumpdb: $(OBJ_DUMPDB)
+ @echo "$(LNCC) -o exim_dumpdb"
+- $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \
+- $(LIBS) $(EXTRALIBS) $(DBMLIB)
++ $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LDFLAGS) $(OBJ_DUMPDB) \
++ $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_dumpdb; \
+ $(STRIP_COMMAND) exim_dumpdb; \
+@@ -355,8 +355,8 @@
+
+ exim_fixdb: $(OBJ_FIXDB) auths/auths.a
+ @echo "$(LNCC) -o exim_fixdb"
+- $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
+- auths/auths.a $(LIBS) $(EXTRALIBS) $(DBMLIB)
++ $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LDFLAGS) $(OBJ_FIXDB) \
++ auths/auths.a $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_fixdb; \
+ $(STRIP_COMMAND) exim_fixdb; \
+@@ -370,8 +370,8 @@
+
+ exim_tidydb: $(OBJ_TIDYDB)
+ @echo "$(LNCC) -o exim_tidydb"
+- $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \
+- $(LIBS) $(EXTRALIBS) $(DBMLIB)
++ $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LDFLAGS) $(OBJ_TIDYDB) \
++ $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_tidydb; \
+ $(STRIP_COMMAND) exim_tidydb; \
+@@ -383,8 +383,8 @@
+
+ exim_dbmbuild: exim_dbmbuild.o
+ @echo "$(LNCC) -o exim_dbmbuild"
+- $(FE)$(LNCC) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \
+- $(LIBS) $(EXTRALIBS) $(DBMLIB)
++ $(FE)$(LNCC) -o exim_dbmbuild $(LDFLAGS) exim_dbmbuild.o \
++ $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_dbmbuild; \
+ $(STRIP_COMMAND) exim_dbmbuild; \
+@@ -398,8 +398,8 @@
+ @echo "$(CC) exim_lock.c"
+ $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c
+ @echo "$(LNCC) -o exim_lock"
+- $(FE)$(LNCC) -o exim_lock $(LFLAGS) exim_lock.o \
+- $(LIBS) $(EXTRALIBS)
++ $(FE)$(LNCC) -o exim_lock $(LDFLAGS) exim_lock.o \
++ $(LIBS) $(EXTRALIBS) $(LFLAGS)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_lock; \
+ $(STRIP_COMMAND) exim_lock; \
+@@ -429,9 +429,9 @@
+ $(FE)$(CC) -o em_version.o -c \
+ $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c
+ @echo "$(LNCC) -o eximon.bin"
+- $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \
++ $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LDFLAGS) $(XLFLAGS) \
+ $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 $(PCRE_LIBS) \
+- $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc
++ $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc $(LFLAGS)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) eximon.bin; \
+ $(STRIP_COMMAND) eximon.bin; \
+@@ -706,9 +706,9 @@
+ test_dbfn: config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \
+ string.o tod.o version.o
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
+- $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
++ $(LNCC) -o test_dbfn $(LDFLAGS) dbfn.o \
+ dummies.o sa-globals.o sa-os.o store.o string.o \
+- tod.o version.o $(LIBS) $(DBMLIB)
++ tod.o version.o $(LIBS) $(DBMLIB) $(LFLAGS)
+ rm -f dbfn.o
+
+ test_host: config.h child.c host.c dns.c dummies.c sa-globals.o os.o \
+@@ -717,28 +717,28 @@
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
+- $(LNCC) -o test_host $(LFLAGS) \
++ $(LNCC) -o test_host $(LDFLAGS) \
+ host.o child.o dns.o dummies.o sa-globals.o os.o store.o string.o \
+- tod.o tree.o $(LIBS) $(LIBRESOLV)
++ tod.o tree.o $(LIBS) $(LIBRESOLV) $(LFLAGS)
+ rm -f child.o dummies.o host.o dns.o
+
+ test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
+- $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
+- sa-globals.o store.o string.o tod.o $(LIBS)
++ $(LNCC) -o test_os $(LDFLAGS) os.o dummies.o \
++ sa-globals.o store.o string.o tod.o $(LIBS) $(LFLAGS)
+ rm -f os.o
+
+ test_parse: config.h parse.c dummies.o sa-globals.o \
+ store.o string.o tod.o version.o
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
+- $(LNCC) -o test_parse $(LFLAGS) parse.o \
+- dummies.o sa-globals.o store.o string.o tod.o version.o
++ $(LNCC) -o test_parse $(LDFLAGS) parse.o \
++ dummies.o sa-globals.o store.o string.o tod.o version.o $(LFLAGS)
+ rm -f parse.o
+
+ test_string: config.h string.c dummies.o sa-globals.o store.o tod.o
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
+- $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
+- dummies.o sa-globals.o store.o tod.o $(LIBS)
++ $(LNCC) -o test_string $(LDFLAGS) -DSTAND_ALONE string.o \
++ dummies.o sa-globals.o store.o tod.o $(LIBS) $(LFLAGS)
+ rm -f string.o
+
+ # End
diff --git a/mail-mta/exim/files/exim-4.77-makefile-freebsd.patch b/mail-mta/exim/files/exim-4.77-makefile-freebsd.patch
new file mode 100644
index 00000000000..f3c03323f87
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.77-makefile-freebsd.patch
@@ -0,0 +1,48 @@
+--- OS/Makefile-FreeBSD
++++ OS/Makefile-FreeBSD
+@@ -1,12 +1,10 @@
+-# Exim: OS-specific make file for FreeBSD
+-# There's no setting of CFLAGS here, to allow the system default
+-# for "make" to be the default.
+-
+-PORTOBJFORMAT!= test -x /usr/bin/objformat && /usr/bin/objformat || echo aout
+-
+-CHOWN_COMMAND=/usr/sbin/chown
+-STRIP_COMMAND=/usr/bin/strip
+-CHMOD_COMMAND=/bin/chmod
++# Exim: OS-specific FreeBSD make file, modified for Gentoo Prefix
++
++
++BASENAME_COMMAND=look_for_it
++CHOWN_COMMAND=look_for_it
++CHGRP_COMMAND=look_for_it
++CHMOD_COMMAND=look_for_it
+
+ HAVE_SA_LEN=YES
+
+@@ -18,23 +16,12 @@
+ # Dynamicly loaded modules need to be built with -fPIC
+ CFLAGS_DYNAMIC=-shared -rdynamic -fPIC
+
+-# FreeBSD always ships with Berkeley DB
++DBMLIB = -ldb
+ USE_DB=yes
+
+-# This code for building outside ports suggested by Richard Clayton
+-.ifdef X11BASE
+-X11=${X11BASE}
+-.elifdef LOCALBASE
+-X11=$(LOCALBASE)
+-.else
+-X11=/usr/local
+-.endif
+-
++X11=/usr/X11R6
+ XINCLUDE=-I$(X11)/include
+ XLFLAGS=-L$(X11)/lib
+-.if ${PORTOBJFORMAT} == "elf"
+-XLFLAGS+=-Wl,-rpath,${X11}/lib
+-.endif
+ X11_LD_LIB=$(X11)/lib
+
+ EXIWHAT_PS_ARG=-ax
diff --git a/mail-mta/exim/files/exim-4.80-spool-mail-group.patch b/mail-mta/exim/files/exim-4.80-spool-mail-group.patch
new file mode 100644
index 00000000000..6f88d8533e8
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.80-spool-mail-group.patch
@@ -0,0 +1,27 @@
+Change default such that we run on a stock Gentoo system. Bug #438606
+
+--- src/configure.default
++++ src/configure.default
+@@ -674,8 +674,9 @@
+ # BSD mailbox format. By default it will be run under the uid and gid of the
+ # local user, and requires the sticky bit to be set on the /var/mail directory.
+ # Some systems use the alternative approach of running mail deliveries under a
+-# particular group instead of using the sticky bit. The commented options below
+-# show how this can be done.
++# particular group instead of using the sticky bit. This is also the
++# default case on Gentoo, therefore group and mode are set below.
++# Comment them out, to get the default behaviour.
+
+ local_delivery:
+ driver = appendfile
+@@ -683,8 +684,8 @@
+ delivery_date_add
+ envelope_to_add
+ return_path_add
+-# group = mail
+-# mode = 0660
++ group = mail
++ mode = 0660
+
+
+ # This transport is used for handling pipe deliveries generated by alias or
diff --git a/mail-mta/exim/files/exim-4.82-makefile-freebsd.patch b/mail-mta/exim/files/exim-4.82-makefile-freebsd.patch
new file mode 100644
index 00000000000..9693d4945ad
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.82-makefile-freebsd.patch
@@ -0,0 +1,45 @@
+--- OS/Makefile-FreeBSD.orig 2013-09-30 19:59:09.000000000 +0200
++++ OS/Makefile-FreeBSD 2013-09-30 20:01:22.000000000 +0200
+@@ -1,10 +1,8 @@
+-# Exim: OS-specific make file for FreeBSD
+-# There's no setting of CFLAGS here, to allow the system default
+-# for "make" to be the default.
+-
+-CHOWN_COMMAND=/usr/sbin/chown
+-STRIP_COMMAND=/usr/bin/strip
+-CHMOD_COMMAND=/bin/chmod
++# Exim: OS-specific FreeBSD make file, modified for Gentoo Prefix
++
++CHOWN_COMMAND=look_for_it
++STRIP_COMMAND=
++CHMOD_COMMAND=look_for_it
+
+ HAVE_SA_LEN=YES
+
+@@ -15,17 +13,9 @@
+ CFLAGS_DYNAMIC=-shared -rdynamic -fPIC
+
+ # FreeBSD always ships with Berkeley DB
++DBMLIB = -ldb
+ USE_DB=yes
+
+-# This code for building outside ports suggested by Richard Clayton
+-.ifdef X11BASE
+-X11=${X11BASE}
+-.elifdef LOCALBASE
+-X11=$(LOCALBASE)
+-.else
+-X11=/usr/local
+-.endif
+-
+ # nb: FreeBSD is entirely elf; objformat was removed prior to FreeBSD 7
+ # http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/objformat/Attic/objformat.c
+ # deleted Jan 2007.
+@@ -37,6 +27,7 @@
+ # switch to default to ELF came with FreeBSD 3. elf(5) claims ELF support
+ # introduced in FreeBSD 2.2.6.
+ #
++X11=/usr/X11R6
+ XINCLUDE=-I$(X11)/include
+ XLFLAGS=-L$(X11)/lib -Wl,-rpath,${X11}/lib
+ X11_LD_LIB=$(X11)/lib
diff --git a/mail-mta/exim/files/exim-submission.socket b/mail-mta/exim/files/exim-submission.socket
new file mode 100644
index 00000000000..b9593e2ef7b
--- /dev/null
+++ b/mail-mta/exim/files/exim-submission.socket
@@ -0,0 +1,10 @@
+[Unit]
+Description=Exim Mail Transfer Agent (message submission)
+Conflicts=exim.service
+
+[Socket]
+ListenStream=587
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/mail-mta/exim/files/exim-submission_at.service b/mail-mta/exim/files/exim-submission_at.service
new file mode 100644
index 00000000000..4f90cd83dc8
--- /dev/null
+++ b/mail-mta/exim/files/exim-submission_at.service
@@ -0,0 +1,11 @@
+# It doesn't make sense for this to be separate from exim@.service
+# However, I couldn't think of a way to have two .socket files point
+# to it ([Socket] Service= is rejected if Accept=yes is set).
+
+[Unit]
+Description=Exim Mail Daemon per-connection server (message submission)
+
+[Service]
+ExecStart=-/usr/bin/exim -bs
+StandardInput=socket
+StandardError=syslog
diff --git a/mail-mta/exim/files/exim.confd b/mail-mta/exim/files/exim.confd
new file mode 100644
index 00000000000..1534d9dfaf0
--- /dev/null
+++ b/mail-mta/exim/files/exim.confd
@@ -0,0 +1,5 @@
+# Command-line options for running exim
+EXIM_OPTS="-bd -q15m"
+
+# Additional flags passed to exim_tidydb upon start (e.g. -t 7d)
+TIDY_OPTS=""
diff --git a/mail-mta/exim/files/exim.logrotate b/mail-mta/exim/files/exim.logrotate
new file mode 100644
index 00000000000..f54f8c479af
--- /dev/null
+++ b/mail-mta/exim/files/exim.logrotate
@@ -0,0 +1,9 @@
+/var/log/exim/exim*.log {
+ daily
+ missingok
+ rotate 28
+ compress
+ delaycompress
+ notifempty
+ create 640 mail mail
+}
diff --git a/mail-mta/exim/files/exim.rc8 b/mail-mta/exim/files/exim.rc8
new file mode 100644
index 00000000000..582d40d7bd9
--- /dev/null
+++ b/mail-mta/exim/files/exim.rc8
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+
+depend() {
+ need logger
+ use antivirus net
+ provide mta
+}
+
+start() {
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --exec /usr/sbin/exim --pidfile /run/${SVCNAME}.pid -- -C /etc/exim/${SVCNAME}.conf ${EXIM_OPTS:--bd -q15m}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --pidfile /run/${SVCNAME}.pid --name exim
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading ${SVCNAME}"
+ start-stop-daemon --signal HUP --pidfile /run/${SVCNAME}.pid --name exim
+ eend $?
+}
diff --git a/mail-mta/exim/files/exim.rc9 b/mail-mta/exim/files/exim.rc9
new file mode 100644
index 00000000000..f14d058b719
--- /dev/null
+++ b/mail-mta/exim/files/exim.rc9
@@ -0,0 +1,46 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+
+depend() {
+ need logger
+ use antivirus net
+ provide mta
+}
+
+tidy_dbs() {
+ local spooldir=$(/usr/sbin/exim -C /etc/exim/${SVCNAME}.conf -bP -n spool_directory)
+ local db
+ local ret=0
+ ebegin "Tidying hints databases in ${spooldir}/db"
+ for db in "${spooldir}"/db/* ; do
+ [[ ${db} == *".lockfile" || ${db} == *"*" ]] && continue
+ /usr/sbin/exim_tidydb ${TIDY_OPTS} "${spooldir}" ${db##*/} > /dev/null
+ : $((ret += $?))
+ done
+ eend ${ret}
+}
+
+start() {
+ # if you use multiple instances, make sure you set spool_directory
+ # in the configfile
+ tidy_dbs
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --exec /usr/sbin/exim --pidfile /run/${SVCNAME}.pid -- -C /etc/exim/${SVCNAME}.conf ${EXIM_OPTS:--bd -q15m}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --pidfile /run/${SVCNAME}.pid --name exim
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading ${SVCNAME}"
+ start-stop-daemon --signal HUP --pidfile /run/${SVCNAME}.pid --name exim
+ eend $?
+}
diff --git a/mail-mta/exim/files/exim.service b/mail-mta/exim/files/exim.service
new file mode 100644
index 00000000000..c8a61cdc4a4
--- /dev/null
+++ b/mail-mta/exim/files/exim.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Exim Mail Transport Agent
+After=network.target
+
+[Service]
+Environment=QUEUE=15m
+ExecStart=/usr/sbin/exim -bdf -q${QUEUE}
+ExecReload=/bin/kill -HUP $MAINPID
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mail-mta/exim/files/exim.socket b/mail-mta/exim/files/exim.socket
new file mode 100644
index 00000000000..36d28684f18
--- /dev/null
+++ b/mail-mta/exim/files/exim.socket
@@ -0,0 +1,10 @@
+[Unit]
+Description=Exim Mail Transfer Agent
+Conflicts=exim.service
+
+[Socket]
+ListenStream=25
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/mail-mta/exim/files/exim_482_dsn_1_3.patch b/mail-mta/exim/files/exim_482_dsn_1_3.patch
new file mode 100644
index 00000000000..c3006996730
--- /dev/null
+++ b/mail-mta/exim/files/exim_482_dsn_1_3.patch
@@ -0,0 +1,1212 @@
+Modified for 4.82 by Gentoo -- not the official patch from
+http://sourceforge.net/projects/eximdsn/
+
+diff -Naur exim-4.82_RC5.orig/README.DSN exim-4.82_RC5/README.DSN
+--- exim-4.82_RC5.orig/README.DSN 1970-01-01 01:00:00.000000000 +0100
++++ exim-4.82_RC5/README.DSN 2013-10-27 21:47:32.000000000 +0100
+@@ -0,0 +1,118 @@
++Exim DSN Patch (4.76)
++---------------------
++
++This patch is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This patch is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this patch; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
++
++Install
++-------
++cd into the source tree for a vanilla exim
++
++patch -p1 </path/to/patch/file.patch
++
++Example :-
++[root@linuxbuild exim-4.72-test]# patch -p1 <../exim.dsn.patch-472
++
++Expected Output :-
++patching file README.DSN
++patching file src/config.h.defaults
++patching file src/deliver.c
++patching file src/exim.c
++patching file src/exim.h
++patching file src/globals.c
++patching file src/globals.h
++patching file src/local_scan.h
++patching file src/macros.h
++patching file src/readconf.c
++patching file src/route.c
++patching file src/smtp_in.c
++patching file src/spool_in.c
++patching file src/spool_out.c
++patching file src/structs.h
++patching file src/transport.c
++patching file src/transports/smtp.c
++
++
++This patch can be included / excluded from the compilation by use of the #define SUPPORT_DSN
++which gets added into src/config.h.defaults & src/EDITME by the patch.
++
++Use
++---
++
++The facility (once compiled in) can be turned on for a particular router via the
++dsn_process directive Eg :-
++
++dest_delivery_int:
++ driver = manualroute
++ domains = +relay_to_domains
++ condition = ${if eq {${lc:$sender_address_domain}}\
++ {domain.com}\
++ {yes}{no}\
++ }
++ dsn_process
++ hide route_data = ${lc:${extract{mailHost}{$address_data}{$value}{}}}
++ transport = remote_smtp
++
++Exim will produce 1 of 2 DSN's back to the originator, or pass on the DSN request.
++The 2 DSN's will either contain (relayed via non "Remote SMTP" router) or
++(relayed to non-DSN-aware mailer) depending on if the delivery was VIA an SMTP
++transport or not.
++
++
++Credits
++-------
++
++The original work for the patch was done by Philip Hazel in Exim 3
++
++The extract was taken and re-applied to Exim 4 by the following :-
++Phil Bingham (phil.bingham@cwipapps.net)
++Steve Falla (steve.falla@cwipapps.net)
++Ray Edah (ray.edah@cwipapps.net)
++Andrew Johnson (andrew.johnson@cwippaps.net)
++Adrian Hungate (adrian.hungate@cwipapps.net)
++
++Now Primarily maintained by :-
++Andrew Johnson (andrew.johnson@cwippaps.net)
++
++Contributions
++-------------
++Andrey J. Melnikoff (TEMHOTA) (temnota@kmv.ru)
++
++
++ChangeLog
++---------
++
++14-Apr-2006 : Changed subject to "Delivery Status Notification"
++
++17-May-2006 : debug_printf in spool-in.c were not wrapped with #ifndef COMPILE_UTILITY
++ thanks to Andrey J. Melnikoff for this information
++
++12-Sep-2006 : Now supports Exim 4.63
++
++12-Sep-2006 : src/EDITME did not include the #define SUPPORT_DSN as stated
++ in the documentation, this has now been corrected
++ thanks to Robert Kehl for this information
++
++28-Jul-2008 : New version for exim 4.69 released.
++
++02-Jul-2010 : New version for exim 4.72 released.
++
++20-May-2011 : New version for exim 4.76 released.
++
++
++Support for this patch (limited though it is) will only be provided through the SourceForge
++project page (http://sourceforge.net/projects/eximdsn/)
++
++--
++Andrew Johnson Cable & Wireless
+diff -Naur exim-4.82_RC5.orig/src/config.h.defaults exim-4.82_RC5/src/config.h.defaults
+--- exim-4.82_RC5.orig/src/config.h.defaults 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/config.h.defaults 2013-10-27 21:47:32.000000000 +0100
+@@ -136,6 +136,7 @@
+ #define SUPPORT_MOVE_FROZEN_MESSAGES
+ #define SUPPORT_PAM
+ #define SUPPORT_TLS
++#define SUPPORT_DSN
+ #define SUPPORT_TRANSLATE_IP_ADDRESS
+
+ #define SYSLOG_LOG_PID
+diff -Naur exim-4.82_RC5.orig/src/deliver.c exim-4.82_RC5/src/deliver.c
+--- exim-4.82_RC5.orig/src/deliver.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/deliver.c 2013-10-27 21:47:32.000000000 +0100
+@@ -63,6 +63,9 @@
+ static address_item *addr_remote = NULL;
+ static address_item *addr_route = NULL;
+ static address_item *addr_succeed = NULL;
++#ifdef SUPPORT_DSN
++static address_item *addr_dsntmp = NULL;
++#endif
+
+ static FILE *message_log = NULL;
+ static BOOL update_spool;
+@@ -2966,6 +2969,15 @@
+ addr->flags |= af_prdr_used; break;
+ #endif
+
++ #ifdef SUPPORT_DSN
++ case 'D':
++ if (addr == NULL) break;
++ addr->dsn_aware = (*ptr)? string_copy(ptr) : string_copy(" ");
++ while (*ptr++);
++ DEBUG(D_deliver) debug_printf("DSN read: addr->dsn_aware = %s\n", addr->dsn_aware);
++ break;
++ #endif
++
+ case 'A':
+ if (addr == NULL)
+ {
+@@ -4074,6 +4086,15 @@
+ if (addr->flags & af_prdr_used) rmt_dlv_checked_write(fd, "P", 1);
+ #endif
+
++ #ifdef SUPPORT_DSN
++ if (addr->dsn_aware == NULL)
++ addr->dsn_aware = string_copy(" ");
++ DEBUG(D_deliver) debug_printf("DSN write: addr->dsn_aware = %s\n", addr->dsn_aware);
++ sprintf(big_buffer, "D%s", addr->dsn_aware);
++ DEBUG(D_deliver) debug_printf("DSN write: big_buffer = %s (%d)\n", big_buffer, strlen(big_buffer)+1);
++ write(fd, big_buffer, strlen(big_buffer)+1);
++ #endif
++
+ /* Retry information: for most success cases this will be null. */
+
+ for (r = addr->retries; r != NULL; r = r->next)
+@@ -5219,6 +5240,14 @@
+ if (r->pno >= 0)
+ new->onetime_parent = recipients_list[r->pno].address;
+
++ #ifdef SUPPORT_DSN
++ /* If DSN support is enabled, set the dsn flags and the original receipt
++ to be passed on to other DSN enabled MTAs */
++ new->dsn_flags = r->dsn_flags & rf_dsnflags;
++ new->dsn_orcpt = r->orcpt;
++ debug_printf("DSN (deliver): orcpt: %s flags: %d\n", new->dsn_orcpt, new->dsn_flags);
++ #endif
++
+ switch (process_recipients)
+ {
+ /* RECIP_DEFER is set when a system filter freezes a message. */
+@@ -6163,6 +6192,12 @@
+ regex_must_compile(US"\\n250[\\s\\-]PRDR(\\s|\\n|$)", FALSE, TRUE);
+ #endif
+
++ #ifdef SUPPORT_DSN
++ /* Set the regex to check for DSN support on remote MTA */
++ if (regex_DSN == NULL) regex_DSN =
++ regex_must_compile(US"\\n250[\\s\\-]DSN(\\s|\\n|$)", FALSE, TRUE);
++ #endif
++
+ /* Now sort the addresses if required, and do the deliveries. The yield of
+ do_remote_deliveries is FALSE when mua_wrapper is set and all addresses
+ cannot be delivered in one transaction. */
+@@ -6267,6 +6302,179 @@
+
+ else if (!dont_deliver) retry_update(&addr_defer, &addr_failed, &addr_succeed);
+
++#ifdef SUPPORT_DSN
++/* ********** philb - Send DSN for successful messages */
++
++addr_dsntmp = addr_succeed;
++
++while(addr_dsntmp != NULL)
++{
++ BOOL dsn_sendmessage = FALSE;
++ uschar dsnmsgbuf[4096];
++
++ DEBUG(D_deliver)
++ debug_printf("DSN: processing router : %s\n", addr_dsntmp->router->name);
++
++ DEBUG(D_deliver)
++ debug_printf("DSN: processing successful delivery address: %s\n", addr_dsntmp->address);
++
++ if (testflag(addr_dsntmp, af_ignore_error))
++ {
++ DEBUG(D_deliver)
++ debug_printf("DSN: Ignore error for: %s\n", addr_dsntmp->address);
++ }
++ else
++ {
++ DEBUG(D_deliver) debug_printf("DSN: Checking Flag\n");
++ if (addr_dsntmp->dsn_aware == NULL) {
++ DEBUG(D_deliver) debug_printf("DSN: dsn_aware was NULL, setting to space at %s %d\n", __FILE__, __LINE__);
++ addr_dsntmp->dsn_aware = string_copy(" ");
++ }
++ DEBUG(D_deliver) debug_printf("DSN: Sender_address: %s\n", sender_address);
++ DEBUG(D_deliver) debug_printf("DSN: orcpt: %s flags: %d\n", addr_dsntmp->dsn_orcpt, addr_dsntmp->dsn_flags);
++ DEBUG(D_deliver) debug_printf("DSN: envid: %s ret: %d\n", dsn_envid, dsn_ret);
++ DEBUG(D_deliver) debug_printf("DSN: Remote SMTP server supports DSN: %s\n", addr_dsntmp->dsn_aware);
++
++ /* Process the flags */
++ if((addr_dsntmp->dsn_flags & rf_dsnflags) != 0)
++ {
++ /* We've got at least one flag set */
++
++ /* set flag so we don't send bounces */
++ setflag(addr_dsntmp, af_ignore_error);
++
++ if((addr_dsntmp->dsn_flags & rf_notify_never) != 0)
++ {
++ DEBUG(D_deliver) debug_printf("DSN: NEVER FLAG\n");
++
++ /* nothing to do here */
++ }
++
++ if((addr_dsntmp->dsn_flags & rf_notify_success) != 0)
++ {
++ DEBUG(D_deliver) debug_printf("DSN: SUCCESS FLAG\n");
++
++ dsn_sendmessage = TRUE;
++ }
++
++ if((addr_dsntmp->dsn_flags & rf_notify_failure) != 0)
++ {
++ DEBUG(D_deliver) debug_printf("DSN: FAILURE FLAG\n");
++
++ /* allow bounce messages */
++ clearflag(addr_dsntmp, af_ignore_error);
++ }
++
++ if((addr_dsntmp->dsn_flags & rf_notify_delay) != 0)
++ {
++ DEBUG(D_deliver) debug_printf("DSN: DELAY FLAG\n");
++
++ /* hmm, what to do here? */
++ }
++ }
++
++ if ((addr_dsntmp->dsn_aware != 0) && (addr_dsntmp->dsn_aware[0] != 'Y') && (dsn_sendmessage == TRUE) && (addr_dsntmp->router->dsn_process == TRUE))
++ {
++ pid_t pid;
++ int fd;
++
++ /* remote MTA does not support DSN, so we need to send message */
++
++ /* create exim process to send message */
++ pid = child_open_exim(&fd);
++
++ DEBUG(D_deliver) debug_printf("DSN: child_open_exim returns: %d\n", pid);
++
++ if (pid < 0) /* Creation of child failed */
++ {
++ log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Process %d (parent %d) failed to "
++ "create child process to send failure message: %s", getpid(),
++ getppid(), strerror(errno));
++
++ DEBUG(D_deliver) debug_printf("DSN: child_open_exim failed\n");
++
++ }
++ else /* Creation of child succeeded */
++ {
++ FILE *f = fdopen(fd, "wb");
++ int topt = topt_add_return_path;
++ uschar boundaryStr[64];
++
++ DEBUG(D_deliver) debug_printf("sending error message to: %s\n", sender_address);
++
++ /* build unique id for MIME boundary */
++ snprintf(boundaryStr, 63, "%d-cwdsn-%d", pid, rand());
++ DEBUG(D_deliver) debug_printf("DSN: MIME boundary: %s\n", boundaryStr);
++
++ /* if the sender doesn't want the whole message returned, don't send the body */
++ if (dsn_ret != dsn_ret_full) topt |= topt_no_body;
++
++ if (errors_reply_to != NULL) fprintf(f,"Reply-To: %s\n", errors_reply_to);
++
++ fprintf(f,"Auto-Submitted: auto-generated\n");
++ fprintf(f,"From: Mail Delivery System <Mailer-Daemon@%s>\n", qualify_domain_sender);
++ fprintf(f,"To: %s\n", sender_address);
++ fprintf(f,"Subject: Delivery Status Notification\n");
++ fprintf(f,"Content-Type: multipart/report; report-type=delivery-status; boundary=%s\n", boundaryStr);
++ fprintf(f,"MIME-Version: 1.0\n\n");
++
++ fprintf(f,"--%s\n", boundaryStr);
++ fprintf(f,"Content-type: text/plain; charset=us-ascii\n\n");
++
++ fprintf(f,"This message was created automatically by mail delivery software.\n");
++ fprintf(f," ----- The following addresses had successful delivery notifications -----\n");
++/* AH: added specific message for non "Remote SMTP" situations */
++ if (addr_dsntmp->dsn_aware[0] == 'N') {
++ fprintf(f,"<%s> (relayed to non-DSN-aware mailer)\n\n", addr_dsntmp->address);
++ } else {
++ fprintf(f,"<%s> (relayed via non \"Remote SMTP\" router)\n\n", addr_dsntmp->address);
++ }
++
++ fprintf(f,"--%s\n", boundaryStr);
++ fprintf(f,"Content-type: message/delivery-status\n\n");
++
++ if (dsn_envid) { /* Test for NULL added by GC */
++ fprintf(f,"Original-Envelope-Id: %s\n", dsn_envid);
++ }
++ fprintf(f,"Reporting-MTA: dns; %s\n", qualify_domain_sender);
++ if (addr_dsntmp->dsn_orcpt) { /* Test for NULL added by GC */
++ fprintf(f,"Original-Recipient: %s\n", addr_dsntmp->dsn_orcpt);
++ }
++ fprintf(f,"Action: delivered\n\n");
++
++ fprintf(f,"--%s\n", boundaryStr);
++ fprintf(f,"Content-type: message/rfc822\n\n");
++
++ fflush(f);
++ transport_filter_argv = NULL; /* Just in case */
++ return_path = sender_address; /* In case not previously set */
++
++ /* Write the original email out */
++ transport_write_message(NULL, fileno(f), topt, 2048, NULL, NULL, NULL, NULL, NULL, 0);
++ fflush(f);
++
++ fprintf(f,"\n");
++ fprintf(f,"--%s--\n", boundaryStr);
++
++ fflush(f);
++ fclose(f);
++ rc = child_close(pid, 0); /* Waits for child to close, no timeout */
++ }
++ }
++ else
++ { if (addr_dsntmp->router->dsn_process == TRUE)
++ DEBUG(D_deliver) debug_printf("DSN: *** NOT SENDING DSN SUCCESS Message ***\n");
++ if (addr_dsntmp->router->dsn_process == FALSE)
++ DEBUG(D_deliver) debug_printf("DSN: *** NOT SENDING DSN SUCCESS Message (gagged) ***\n");
++ }
++ }
++
++ addr_dsntmp = addr_dsntmp->next;
++}
++
++/* ********** philb - end of mod */
++#endif
++
+ /* If any addresses failed, we must send a message to somebody, unless
+ af_ignore_error is set, in which case no action is taken. It is possible for
+ several messages to get sent if there are addresses with different
+diff -Naur exim-4.82_RC5.orig/src/EDITME exim-4.82_RC5/src/EDITME
+--- exim-4.82_RC5.orig/src/EDITME 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/EDITME 2013-10-27 21:47:32.000000000 +0100
+@@ -192,6 +192,8 @@
+ # least one type of lookup. You should consider whether you want to build
+ # the Exim monitor or not.
+
++# Support DSN
++SUPPORT_DSN=yes
+
+ #------------------------------------------------------------------------------
+ # These settings determine which individual router drivers are included in the
+diff -Naur exim-4.82_RC5.orig/src/exim.c exim-4.82_RC5/src/exim.c
+--- exim-4.82_RC5.orig/src/exim.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/exim.c 2013-10-27 21:47:32.000000000 +0100
+@@ -831,6 +831,9 @@
+ #ifdef EXPERIMENTAL_REDIS
+ fprintf(f, " Experimental_Redis");
+ #endif
++#ifdef SUPPORT_DSN
++ fprintf(f, " C&W_DSN_1.3");
++#endif
+ fprintf(f, "\n");
+
+ fprintf(f, "Lookups (built-in):");
+@@ -2653,6 +2656,16 @@
+ break;
+ }
+
++ #ifdef SUPPORT_DSN
++ /* -MCD: set the smtp_use_dsn flag; this indicates that the host
++ that exim is connected to supports the esmtp extension DSN */
++ else if (strcmp(argrest, "CD") == 0)
++ {
++ smtp_use_dsn = TRUE;
++ break;
++ }
++ #endif
++
+ /* -MCP: set the smtp_use_pipelining flag; this is useful only when
+ it preceded -MC (see above) */
+
+diff -Naur exim-4.82_RC5.orig/src/globals.c exim-4.82_RC5/src/globals.c
+--- exim-4.82_RC5.orig/src/globals.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/globals.c 2013-10-27 21:47:32.000000000 +0100
+@@ -124,6 +124,13 @@
+ uschar *local_scan_path = NULL;
+ #endif
+
++#ifdef SUPPORT_DSN
++BOOL dsn = TRUE;
++uschar *dsn_envid = NULL;
++int dsn_ret = 0;
++const pcre *regex_DSN = NULL;
++BOOL smtp_use_dsn = FALSE;
++#endif
+
+ #ifdef SUPPORT_TLS
+ BOOL gnutls_compat_mode = FALSE;
+@@ -341,6 +348,11 @@
+ NULL, /* authenticator */
+ NULL, /* auth_id */
+ NULL, /* auth_sndr */
++ #ifdef SUPPORT_DSN
++ NULL, /* dsn_orcpt */
++ 0, /* dsn_flags */
++ NULL, /* dsn_aware */
++ #endif
+ (uid_t)(-1), /* uid */
+ (gid_t)(-1), /* gid */
+ 0, /* flags */
+@@ -1096,6 +1108,9 @@
+ TRUE, /* verify_sender */
+ FALSE, /* uid_set */
+ FALSE, /* unseen */
++#ifdef SUPPORT_DSN
++ FALSE, /* dsn_process */
++#endif
+
+ self_freeze, /* self_code */
+ (uid_t)(-1), /* uid */
+@@ -1105,6 +1120,7 @@
+ NULL, /* transport instance */
+ NULL, /* pass_router */
+ NULL /* redirect_router */
++
+ };
+
+ uschar *router_name = NULL;
+diff -Naur exim-4.82_RC5.orig/src/globals.h exim-4.82_RC5/src/globals.h
+--- exim-4.82_RC5.orig/src/globals.h 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/globals.h 2013-10-27 21:47:32.000000000 +0100
+@@ -130,6 +130,13 @@
+ extern int (*receive_ferror)(void);
+ extern BOOL (*receive_smtp_buffered)(void);
+
++#ifdef SUPPORT_DSN
++extern BOOL dsn; /* FALSE if DSN not to be used */
++extern uschar *dsn_envid; /* DSN envid string */
++extern int dsn_ret; /* DSN ret type*/
++extern const pcre *regex_DSN; /* For recognizing DSN settings */
++extern BOOL smtp_use_dsn; /* Global for passed connections */
++#endif
+
+ /* For clearing, saving, restoring address expansion variables. We have to have
+ the size of this vector set explicitly, because it is referenced from more than
+diff -Naur exim-4.82_RC5.orig/src/local_scan.h exim-4.82_RC5/src/local_scan.h
+--- exim-4.82_RC5.orig/src/local_scan.h 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/local_scan.h 2013-10-27 21:47:32.000000000 +0100
+@@ -124,9 +124,13 @@
+ field is always NULL except for one_time aliases that had errors_to on the
+ routers that generated them. */
+
++/* Added the dsn attributes orcpt and dsn_flags for DSN support*/
++
+ typedef struct recipient_item {
+ uschar *address; /* the recipient address */
+ int pno; /* parent number for "one_time" alias, or -1 */
++ uschar *orcpt; /* DSN orcpt */
++ int dsn_flags; /* DSN flags */
+ uschar *errors_to; /* the errors_to address or NULL */
+ #ifdef EXPERIMENTAL_BRIGHTMAIL
+ uschar *bmi_optin;
+diff -Naur exim-4.82_RC5.orig/src/macros.h exim-4.82_RC5/src/macros.h
+--- exim-4.82_RC5.orig/src/macros.h 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/macros.h 2013-10-27 21:47:32.000000000 +0100
+@@ -778,6 +778,22 @@
+ #define topt_no_body 0x040 /* Omit body */
+ #define topt_escape_headers 0x080 /* Apply escape check to headers */
+
++ /* Flags for recipient_block, used in DSN support */
++
++ #define rf_onetime 0x01 /* A one-time alias */
++ #define rf_notify_never 0x02 /* NOTIFY= settings */
++ #define rf_notify_success 0x04
++ #define rf_notify_failure 0x08
++ #define rf_notify_delay 0x10
++
++ #define rf_dsnflags (rf_notify_never | rf_notify_success | \
++ rf_notify_failure | rf_notify_delay)
++
++ /* DSN RET types */
++
++ #define dsn_ret_full 1
++ #define dsn_ret_hdrs 2
++
+ /* Codes for the host_find_failed and host_all_ignored options. */
+
+ #define hff_freeze 0
+diff -Naur exim-4.82_RC5.orig/src/readconf.c exim-4.82_RC5/src/readconf.c
+--- exim-4.82_RC5.orig/src/readconf.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/readconf.c 2013-10-27 21:49:15.000000000 +0100
+@@ -229,6 +229,9 @@
+ /* This option is now a no-op, retained for compability */
+ { "drop_cr", opt_bool, &drop_cr },
+ /*********************************************************/
++#ifdef SUPPORT_DSN
++ { "dsn", opt_bool, &dsn },
++#endif
+ { "dsn_from", opt_stringptr, &dsn_from },
+ { "envelope_to_remove", opt_bool, &envelope_to_remove },
+ { "errors_copy", opt_stringptr, &errors_copy },
+diff -Naur exim-4.82_RC5.orig/src/receive.c exim-4.82_RC5/src/receive.c
+--- exim-4.82_RC5.orig/src/receive.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/receive.c 2013-10-27 21:47:32.000000000 +0100
+@@ -490,6 +490,8 @@
+ memcpy(recipients_list, oldlist, oldmax * sizeof(recipient_item));
+ }
+
++/* memset added by GC to blank dsn records, etc. */
++memset(&recipients_list[recipients_count], 0, sizeof(recipient_item));
+ recipients_list[recipients_count].address = recipient;
+ recipients_list[recipients_count].pno = pno;
+ #ifdef EXPERIMENTAL_BRIGHTMAIL
+diff -Naur exim-4.82_RC5.orig/src/route.c exim-4.82_RC5/src/route.c
+--- exim-4.82_RC5.orig/src/route.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/route.c 2013-10-27 21:47:32.000000000 +0100
+@@ -58,6 +58,10 @@
+ (void *)offsetof(router_instance, domains) },
+ { "driver", opt_stringptr|opt_public,
+ (void *)offsetof(router_instance, driver_name) },
++ #ifdef SUPPORT_DSN
++ { "dsn_process", opt_bool|opt_public,
++ (void *)offsetof(router_instance, dsn_process) },
++ #endif
+ { "errors_to", opt_stringptr|opt_public,
+ (void *)(offsetof(router_instance, errors_to)) },
+ { "expn", opt_bool|opt_public,
+@@ -270,6 +274,13 @@
+
+ if (r->pass_router_name != NULL)
+ set_router(r, r->pass_router_name, &(r->pass_router), TRUE);
++
++ #ifdef SUPPORT_DSN
++ if (r->dsn_process == FALSE)
++ DEBUG(D_route) debug_printf("%s router skipping DSN - add dsn_process to router\n", r->name);
++ if (r->dsn_process == TRUE)
++ DEBUG(D_route) debug_printf("%s router performing DSN \n", r->name);
++ #endif
+ }
+ }
+
+@@ -1412,7 +1423,10 @@
+
+ copyflag(new, addr, af_propagate);
+ new->p.address_data = addr->p.address_data;
+-
++#ifdef SUPPORT_DSN
++ new->dsn_flags = addr->dsn_flags;
++ new->dsn_orcpt = addr->dsn_orcpt;
++#endif
+
+ /* As it has turned out, we haven't set headers_add or headers_remove for the
+ * clone. Thinking about it, it isn't entirely clear whether they should be
+diff -Naur exim-4.82_RC5.orig/src/smtp_in.c exim-4.82_RC5/src/smtp_in.c
+--- exim-4.82_RC5.orig/src/smtp_in.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/smtp_in.c 2013-10-27 21:47:32.000000000 +0100
+@@ -213,6 +213,9 @@
+ #ifdef EXPERIMENTAL_PRDR
+ ENV_MAIL_OPT_PRDR,
+ #endif
++#ifdef SUPPORT_DSN
++ ENV_MAIL_OPT_RET, ENV_MAIL_OPT_ENVID,
++#endif
+ ENV_MAIL_OPT_NULL
+ };
+ typedef struct {
+@@ -228,6 +231,10 @@
+ #ifdef EXPERIMENTAL_PRDR
+ { US"PRDR", ENV_MAIL_OPT_PRDR, FALSE },
+ #endif
++#ifdef SUPPORT_DSN
++ { US"RET", ENV_MAIL_OPT_RET, FALSE },
++ { US"ENVID", ENV_MAIL_OPT_ENVID, FALSE },
++#endif
+ { US"NULL", ENV_MAIL_OPT_NULL, FALSE }
+ };
+
+@@ -1073,6 +1080,13 @@
+ sender_verified_list = NULL; /* No senders verified */
+ memset(sender_address_cache, 0, sizeof(sender_address_cache));
+ memset(sender_domain_cache, 0, sizeof(sender_domain_cache));
++
++#ifdef SUPPORT_DSN
++/* Reset the DSN flags */
++dsn_ret = 0;
++dsn_envid = NULL;
++#endif
++
+ authenticated_sender = NULL;
+ #ifdef EXPERIMENTAL_BRIGHTMAIL
+ bmi_run = 0;
+@@ -2679,6 +2693,10 @@
+ int ptr, size, rc;
+ int c, i;
+ auth_instance *au;
++#ifdef SUPPORT_DSN
++ uschar *orcpt = NULL;
++ int flags;
++#endif
+
+ switch(smtp_read_command(TRUE))
+ {
+@@ -3106,6 +3124,12 @@
+ s = string_cat(s, &size, &ptr, US"-8BITMIME\r\n", 11);
+ }
+
++ #ifdef SUPPORT_DSN
++ /* Advertise DSN support if configured to do so. */
++ if (dsn)
++ s = string_cat(s, &size, &ptr, US"250-DSN\r\n", 9);
++ #endif
++
+ /* Advertise ETRN if there's an ACL checking whether a host is
+ permitted to issue it; a check is made when any host actually tries. */
+
+@@ -3360,6 +3384,42 @@
+ arg_error = TRUE;
+ break;
+
++#ifdef SUPPORT_DSN
++
++ /* Handle the two DSN options, but only if configured to do so
++ * (which will have caused "DSN" to be given in the EHLO
++ * response). The code itself is included only if configured in
++ * at build time. */
++
++ case ENV_MAIL_OPT_RET:
++ /* Check if RET has already been set */
++ if (dsn_ret > 0) {
++ synprot_error(L_smtp_syntax_error, 501, NULL,
++ US"RET can be specified once only");
++ goto COMMAND_LOOP;
++ }
++ dsn_ret = (strcmpic(value, US"HDRS") == 0)? dsn_ret_hdrs :
++ (strcmpic(value, US"FULL") == 0)? dsn_ret_full : 0;
++ DEBUG(D_receive) debug_printf("DSN_RET: %d\n", dsn_ret);
++ /* Check for invalid invalid value, and exit with error */
++ if (dsn_ret == 0) {
++ synprot_error(L_smtp_syntax_error, 501, NULL,
++ US"Value for RET is invalid");
++ goto COMMAND_LOOP;
++ }
++ break;
++ case ENV_MAIL_OPT_ENVID:
++ /* Check if the dsn envid has been already set */
++ if (dsn_envid != NULL) {
++ synprot_error(L_smtp_syntax_error, 501, NULL,
++ US"ENVID can be specified once only");
++ goto COMMAND_LOOP;
++ }
++ dsn_envid = string_copy(value);
++ DEBUG(D_receive) debug_printf("DSN_ENVID: %s\n", dsn_envid);
++ break;
++#endif
++
+ /* Handle the AUTH extension. If the value given is not "<>" and either
+ the ACL says "yes" or there is no ACL but the sending host is
+ authenticated, we set it up as the authenticated sender. However, if the
+@@ -3633,6 +3693,89 @@
+ rcpt_fail_count++;
+ break;
+ }
++
++ #ifdef SUPPORT_DSN
++ /* Set the DSN flags orcpt and dsn_flags from the session*/
++ orcpt = NULL;
++ flags = 0;
++
++ if (esmtp) for(;;)
++ {
++ uschar *name, *value, *end;
++ int size;
++
++ if (!extract_option(&name, &value))
++ {
++ break;
++ }
++
++ if (strcmpic(name, US"ORCPT") == 0)
++ {
++ /* Check whether orcpt has been already set */
++ if (orcpt != NULL) {
++ synprot_error(L_smtp_syntax_error, 501, NULL,
++ US"ORCPT can be specified once only");
++ goto COMMAND_LOOP;
++ }
++ orcpt = string_copy(value);
++ DEBUG(D_receive) debug_printf("DSN orcpt: %s\n", orcpt);
++ }
++
++ else if (strcmpic(name, US"NOTIFY") == 0)
++ {
++ /* Check if the notify flags have been already set */
++ if (flags > 0)
++ {
++ synprot_error(L_smtp_syntax_error, 501, NULL,
++ US"NOTIFY can be specified once only");
++ goto COMMAND_LOOP;
++ }
++ if (strcmpic(value, US"NEVER") == 0) flags |= rf_notify_never; else
++ {
++ uschar *p = value;
++ while (*p != 0)
++ {
++ uschar *pp = p;
++ while (*pp != 0 && *pp != ',') pp++;
++ if (*pp == ',') *pp++ = 0;
++ if (strcmpic(p, US"SUCCESS") == 0) {
++ DEBUG(D_receive) debug_printf("GC: Setting notify success\n");
++ flags |= rf_notify_success;
++ }
++ else if (strcmpic(p, US"FAILURE") == 0) {
++ DEBUG(D_receive) debug_printf("GC: Setting notify failure\n");
++ flags |= rf_notify_failure;
++ }
++ else if (strcmpic(p, US"DELAY") == 0) {
++ DEBUG(D_receive) debug_printf("GC: Setting notify delay\n");
++ flags |= rf_notify_delay;
++ }
++ else
++ {
++ /* Catch any strange values */
++ synprot_error(L_smtp_syntax_error, 501, NULL,
++ US"Invalid value for NOTIFY parameter");
++ goto COMMAND_LOOP;
++ }
++ p = pp;
++ }
++ DEBUG(D_receive) debug_printf("DSN Flags: %x\n", flags);
++ }
++ }
++
++ /* Unknown option. Stick back the terminator characters and break
++ the loop. An error for a malformed address will occur. */
++
++ else
++ {
++ DEBUG(D_receive) debug_printf("Invalid dsn command: %s : %s\n", name, value);
++ name[-1] = ' ';
++ value[-1] = '=';
++ break;
++ }
++ }
++ #endif
++
+
+ /* Apply SMTP rewriting then extract the working address. Don't allow "<>"
+ as a recipient address */
+@@ -3747,6 +3890,24 @@
+ if (user_msg == NULL) smtp_printf("250 Accepted\r\n");
+ else smtp_user_msg(US"250", user_msg);
+ receive_add_recipient(recipient, -1);
++
++ #ifdef SUPPORT_DSN
++
++ /* Set the dsn flags in the recipients_list */
++ if (orcpt != NULL)
++ recipients_list[recipients_count-1].orcpt = orcpt;
++ else
++ recipients_list[recipients_count-1].orcpt = NULL;
++
++ if (flags != 0)
++ recipients_list[recipients_count-1].dsn_flags = flags;
++ else
++ recipients_list[recipients_count-1].dsn_flags = 0;
++ debug_printf("DSN-AJ(smtp-in): orcpt: %s flags: %d\n", recipients_list[recipients_count-1].orcpt, recipients_list[recipients_count-1].dsn_flags);
++
++
++ #endif
++
+ }
+
+ /* The recipient was discarded */
+diff -Naur exim-4.82_RC5.orig/src/spool_in.c exim-4.82_RC5/src/spool_in.c
+--- exim-4.82_RC5.orig/src/spool_in.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/spool_in.c 2013-10-27 21:47:32.000000000 +0100
+@@ -293,6 +293,13 @@
+ spam_score_int = NULL;
+ #endif
+
++#ifdef SUPPORT_DSN
++#ifndef COMPILE_UTILITY
++dsn_ret = 0;
++dsn_envid = NULL;
++#endif /* COMPILE_UTILITY */
++#endif
++
+ /* Generate the full name and open the file. If message_subdir is already
+ set, just look in the given directory. Otherwise, look in both the split
+ and unsplit directories, as for the data file above. */
+@@ -467,6 +474,19 @@
+ case 'd':
+ if (Ustrcmp(p, "eliver_firsttime") == 0)
+ deliver_firsttime = TRUE;
++ #ifdef SUPPORT_DSN
++ #ifndef COMPILE_UTILITY
++ /* Check if the dsn flags have been set in the header file */
++ else if (Ustrncmp(p, "sn_ret", 6) == 0)
++ {
++ dsn_ret= atoi(big_buffer + 8);
++ }
++ else if (Ustrncmp(p, "sn_envid", 8) == 0)
++ {
++ dsn_envid = string_copy(big_buffer + 11);
++ }
++ #endif /* COMPILE_UTILITY */
++ #endif
+ break;
+
+ case 'f':
+@@ -554,7 +574,7 @@
+ tls_in.sni = string_unprinting(string_copy(big_buffer + 9));
+ break;
+ #endif
+-
++
+ default: /* Present because some compilers complain if all */
+ break; /* possibilities are not covered. */
+ }
+@@ -604,6 +624,10 @@
+ {
+ int nn;
+ int pno = -1;
++ #ifdef SUPPORT_DSN
++ int dsn_flags = 0;
++ uschar *orcpt = NULL;
++ #endif
+ uschar *errors_to = NULL;
+ uschar *p;
+
+@@ -672,10 +696,19 @@
+ }
+
+ /* Handle current format Exim 4 spool files */
++ /* Spool file is modified if DSN is supported
++ Original was "address errors_to len(errors_to),pno
++ New for DSN support is now:
++ "address errors_to orcpt len(errors_to),len(orcpt),pno,dsn_flags */
+
+ else if (*p == '#')
+ {
+ int flags;
++
++ #ifndef COMPILE_UTILITY
++ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - Exim 4 standard format spoolfile\n");
++ #endif /* COMPILE_UTILITY */
++
+ (void)sscanf(CS p+1, "%d", &flags);
+
+ if ((flags & 0x01) != 0) /* one_time data exists */
+@@ -688,15 +721,82 @@
+ {
+ p -= len;
+ errors_to = string_copy(p);
++ }
++ }
++
++ *(--p) = 0; /* Terminate address */
++ }
++ #ifdef SUPPORT_DSN
++ else if (*p == '!') /* Handle Exim4 + DSN spool files */
++ {
++ int flags;
++ int temp_dsn_flags;
++
++ #ifndef COMPILE_UTILITY
++ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - C&W DSN format spoolfile\n");
++ #endif /* COMPILE_UTILITY */
++
++ sscanf(CS p+1, "%d,%d", &flags, &temp_dsn_flags);
++
++ if (((flags & 0x01) != 0) || (temp_dsn_flags > 0)) /* one_time data or dsn_flags exist */
++ {
++ int len;
++ int len_orcpt;
++
++ #ifndef COMPILE_UTILITY
++ DEBUG(D_deliver) debug_printf("**** spool_in dsn_flags = 0\n");
++ #endif /* COMPILE_UTILITY */
++
++ dsn_flags = 0;
++
++ while (isdigit(*(--p)) || *p == ',' || *p == '-');
++ sscanf(CS p+1, "%d,%d,%d,%d", &len, &len_orcpt, &pno, &dsn_flags);
++
++ *p = 0;
++ if (len_orcpt > 0)
++ {
++ p -= len_orcpt;
++ orcpt = string_copy(p);
+ }
++ *(--p) = 0; /* change the space to a NULL */
++
++ if (len > 0)
++ {
++ p -= len;
++ errors_to = string_copy(p);
++ }
+ }
+
+ *(--p) = 0; /* Terminate address */
+ }
++ #endif
++ #ifndef COMPILE_UTILITY
++ else
++ {
++ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - No additional fields\n");
++ }
++ #endif /* COMPILE_UTILITY */
++
++ #ifdef SUPPORT_DSN
++ #ifndef COMPILE_UTILITY
++ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - address: |%s| errorsto: |%s| orcpt: |%s| dsn_flags: %d\n",
++ big_buffer, errors_to, orcpt, dsn_flags);
++ #endif /* COMPILE_UTILITY */
++ #endif
++ #ifndef SUPPORT_DSN
++ #ifndef COMPILE_UTILITY
++ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - address: |%s| errorsto: |%s|\n",
++ big_buffer, errors_to);
++ #endif /* COMPILE_UTILITY */
++ #endif
+
+ recipients_list[recipients_count].address = string_copy(big_buffer);
+ recipients_list[recipients_count].pno = pno;
+ recipients_list[recipients_count].errors_to = errors_to;
++ #ifdef SUPPORT_DSN
++ recipients_list[recipients_count].orcpt = orcpt;
++ recipients_list[recipients_count].dsn_flags = dsn_flags;
++ #endif
+ }
+
+ /* The remainder of the spool header file contains the headers for the message,
+diff -Naur exim-4.82_RC5.orig/src/spool_out.c exim-4.82_RC5/src/spool_out.c
+--- exim-4.82_RC5.orig/src/spool_out.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/spool_out.c 2013-10-27 21:47:32.000000000 +0100
+@@ -234,6 +234,15 @@
+ if (tls_in.sni != NULL) fprintf(f, "-tls_sni %s\n", string_printing(tls_in.sni));
+ #endif
+
++#ifdef SUPPORT_DSN
++/* Write the dsn flags to the spool header file */
++DEBUG(D_deliver) debug_printf("DSN: Write SPOOL :-dsn_envid %s\n", dsn_envid);
++if (dsn_envid != NULL) fprintf(f, "-dsn_envid %s\n", dsn_envid);
++DEBUG(D_deliver) debug_printf("DSN: Write SPOOL :-dsn_ret %d\n", dsn_ret);
++if (dsn_ret != 0) fprintf(f, "-dsn_ret %d\n", dsn_ret);
++#endif
++
++
+ /* To complete the envelope, write out the tree of non-recipients, followed by
+ the list of recipients. These won't be disjoint the first time, when no
+ checking has been done. If a recipient is a "one-time" alias, it is followed by
+@@ -244,14 +253,36 @@
+ for (i = 0; i < recipients_count; i++)
+ {
+ recipient_item *r = recipients_list + i;
+- if (r->pno < 0 && r->errors_to == NULL)
++#ifdef SUPPORT_DSN
++DEBUG(D_deliver) debug_printf("DSN: Flags :%d\n", r->dsn_flags);
++#endif
++ if (r->pno < 0 && r->errors_to == NULL
++ #ifdef SUPPORT_DSN
++ && r->dsn_flags == 0
++ #endif
++ )
+ fprintf(f, "%s\n", r->address);
+ else
+ {
+ uschar *errors_to = (r->errors_to == NULL)? US"" : r->errors_to;
++ #ifdef SUPPORT_DSN
++ uschar *orcpt = (r->orcpt == NULL)? US"" : r->orcpt;
++ fprintf(f, "%s %s %s %d,%d,%d,%d!1\n", r->address, errors_to, orcpt,
++ Ustrlen(errors_to), Ustrlen(orcpt), r->pno, r->dsn_flags);
++ #else
+ fprintf(f, "%s %s %d,%d#1\n", r->address, errors_to,
+ Ustrlen(errors_to), r->pno);
++ #endif
+ }
++
++ #ifdef SUPPORT_DSN
++ DEBUG(D_deliver) debug_printf("DSN :**** SPOOL_OUT - address: |%s| errorsto: |%s| orcpt: |%s| dsn_flags: %d\n",
++ r->address, r->errors_to, r->orcpt, r->dsn_flags);
++ #endif
++ #ifndef SUPPORT_DSN
++ DEBUG(D_deliver) debug_printf("**** SPOOL_OUT - address: |%s| errorsto: |%s|\n",
++ r->address, r->errors_to);
++ #endif
+ }
+
+ /* Put a blank line before the headers */
+diff -Naur exim-4.82_RC5.orig/src/structs.h exim-4.82_RC5/src/structs.h
+--- exim-4.82_RC5.orig/src/structs.h 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/structs.h 2013-10-27 21:47:32.000000000 +0100
+@@ -282,7 +282,9 @@
+ BOOL verify_sender; /* Use this router when verifying a sender */
+ BOOL uid_set; /* Flag to indicate uid is set */
+ BOOL unseen; /* If TRUE carry on, even after success */
+-
++#ifdef SUPPORT_DSN
++ BOOL dsn_process; /* If TRUE, activate DSN for this router */
++#endif
+ int self_code; /* Encoded version of "self" */
+ uid_t uid; /* Fixed uid value */
+ gid_t gid; /* Fixed gid value */
+@@ -547,6 +549,12 @@
+ uschar *auth_id; /* auth "login" name used by transport */
+ uschar *auth_sndr; /* AUTH arg to SMTP MAIL, used by transport */
+
++ #ifdef SUPPORT_DSN
++ uschar *dsn_orcpt; /* DSN orcpt value */
++ int dsn_flags; /* DSN flags */
++ uschar *dsn_aware; /* DSN aware flag */
++ #endif
++
+ uid_t uid; /* uid for transporting */
+ gid_t gid; /* gid for transporting */
+
+diff -Naur exim-4.82_RC5.orig/src/transport.c exim-4.82_RC5/src/transport.c
+--- exim-4.82_RC5.orig/src/transport.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/transport.c 2013-10-27 21:47:32.000000000 +0100
+@@ -1802,6 +1802,11 @@
+
+ argv = child_exec_exim(CEE_RETURN_ARGV, TRUE, &i, FALSE, 0);
+
++ #ifdef SUPPORT_DSN
++ /* Call with the dsn flag */
++ if (smtp_use_dsn) argv[i++] = US"-MCD";
++ #endif
++
+ if (smtp_authenticated) argv[i++] = US"-MCA";
+
+ #ifdef SUPPORT_TLS
+diff -Naur exim-4.82_RC5.orig/src/transports/smtp.c exim-4.82_RC5/src/transports/smtp.c
+--- exim-4.82_RC5.orig/src/transports/smtp.c 2013-10-27 21:46:25.000000000 +0100
++++ exim-4.82_RC5/src/transports/smtp.c 2013-10-27 21:47:32.000000000 +0100
+@@ -242,6 +242,16 @@
+ #endif
+ };
+
++#ifdef SUPPORT_DSN
++/* some DSN flags for use later */
++
++static int rf_list[] = {rf_notify_never, rf_notify_success,
++ rf_notify_failure, rf_notify_delay };
++
++static uschar *rf_names[] = { "NEVER", "SUCCESS", "FAILURE", "DELAY" };
++#endif
++
++
+
+ /* Local statics */
+
+@@ -1079,6 +1089,27 @@
+ else if (new[0] != 0) local_authenticated_sender = new;
+ }
+
++#ifdef SUPPORT_DSN
++/* Add any DSN flags to the mail command */
++
++if (smtp_use_dsn)
++ {
++ uschar *p = buffer;
++ if (dsn_ret == dsn_ret_hdrs)
++ {
++ strcpy(p, " RET=HDRS");
++ while (*p) p++;
++ }
++ else if (dsn_ret == dsn_ret_full)
++ {
++ strcpy(p, " RET=FULL");
++ while (*p) p++;
++ }
++ if (dsn_envid != NULL)
++ string_format(p, sizeof(buffer) - (p-buffer), " ENVID=%s", dsn_envid);
++ }
++#endif
++
+ /* Add the authenticated sender address if present */
+
+ if ((smtp_authenticated || ob->authenticated_sender_force) &&
+@@ -1587,6 +1618,14 @@
+ {DEBUG(D_transport) debug_printf("PRDR usable\n");}
+ #endif
+
++ #ifdef SUPPORT_DSN
++ /* Note if the server supports DSN */
++ smtp_use_dsn = dsn &&
++ esmtp && pcre_exec(regex_DSN, NULL, CS buffer, (int)Ustrlen(CS buffer), 0,
++ PCRE_EOPT, NULL, 0) >= 0;
++ DEBUG(D_transport) debug_printf("use_dsn=%d\n", smtp_use_dsn);
++ #endif
++
+ /* Note if the response to EHLO specifies support for the AUTH extension.
+ If it has, check that this host is one we want to authenticate to, and do
+ the business. The host name and address must be available when the
+@@ -1746,18 +1785,66 @@
+ int count;
+ BOOL no_flush;
+
++ #ifdef SUPPORT_DSN
++ /* philb - set dsn_aware flag for this recipient */
++ if(smtp_use_dsn)
++ addr->dsn_aware = string_copy("Y");
++ else
++ addr->dsn_aware = string_copy("N");
++ #endif
++
+ if (addr->transport_return != PENDING_DEFER) continue;
+
+ address_count++;
+ no_flush = smtp_use_pipelining && (!mua_wrapper || addr->next != NULL);
+
++ #ifdef SUPPORT_DSN
++ /* Add any DSN flags to the rcpt command and add to the sent string */
++
++ p = buffer;
++ *p = 0;
++
++ if (smtp_use_dsn)
++ {
++ if ((addr->dsn_flags & rf_dsnflags) != 0)
++ {
++ int i;
++ BOOL first = TRUE;
++ strcpy(p, " NOTIFY=");
++ while (*p) p++;
++ for (i = 0; i < 4; i++)
++ {
++ if ((addr->dsn_flags & rf_list[i]) != 0)
++ {
++ if (!first) *p++ = ',';
++ first = FALSE;
++ strcpy(p, rf_names[i]);
++ while (*p) p++;
++ }
++ }
++ }
++
++ if (addr->dsn_orcpt != NULL)
++ string_format(p, sizeof(buffer) - (p-buffer), " ORCPT=%s",
++ addr->dsn_orcpt);
++ }
++
++ #endif
++
++
+ /* Now send the RCPT command, and process outstanding responses when
+ necessary. After a timeout on RCPT, we just end the function, leaving the
+ yield as OK, because this error can often mean that there is a problem with
+ just one address, so we don't want to delay the host. */
+
++ #ifdef SUPPORT_DSN
++ count = smtp_write_command(&outblock, no_flush, "RCPT TO:<%s>%s%s\r\n",
++ transport_rcpt_address(addr, tblock->rcpt_include_affixes), igquotstr, buffer);
++ #else
+ count = smtp_write_command(&outblock, no_flush, "RCPT TO:<%s>%s\r\n",
+ transport_rcpt_address(addr, tblock->rcpt_include_affixes), igquotstr);
++ #endif
++
+ if (count < 0) goto SEND_FAILED;
+ if (count > 0)
+ {
diff --git a/mail-mta/exim/files/exim_at.service b/mail-mta/exim/files/exim_at.service
new file mode 100644
index 00000000000..19c07a51b06
--- /dev/null
+++ b/mail-mta/exim/files/exim_at.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Exim Mail Daemon per-connection server
+
+[Service]
+ExecStart=-/usr/bin/exim -bs
+StandardInput=socket
+StandardError=syslog
diff --git a/mail-mta/exim/metadata.xml b/mail-mta/exim/metadata.xml
new file mode 100644
index 00000000000..c94ff4f98ee
--- /dev/null
+++ b/mail-mta/exim/metadata.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-mail</herd>
+ <maintainer>
+ <email>grobian@gentoo.org</email>
+ </maintainer>
+ <longdescription>
+ Exim is a message transfer agent (MTA) developed at the University of
+ Cambridge for use on Unix systems connected to the Internet. It is
+ freely available under the terms of the GNU General Public Licence. In
+ style it is similar to Smail 3, but its facilities are more general.
+ There is a great deal of flexibility in the way mail can be routed, and
+ there are extensive facilities for checking incoming mail. Exim can be
+ installed in place of sendmail, although the configuration of exim is
+ quite different to that of sendmail.
+ </longdescription>
+ <use>
+ <flag name='dcc'>Adds support for Distributed Checksum Clearinghouse
+ (DCC)</flag>
+ <flag name='dkim'>Adds support for DomainKeys Identified Mail
+ (DKIM)</flag>
+ <flag name='dnsdb'>Adds support for a DNS search for a record whose
+ domain name is the supplied query</flag>
+ <flag name='dovecot-sasl'>Adds support for Dovecot's
+ authentication</flag>
+ <flag name='dlfunc'>Install local_scan.h header to compile separate
+ dlfunc libraries</flag>
+ <flag name='dmarc'>Adds support for DMARC</flag>
+ <flag name='dsn'>Adds support for Delivery Status Notifications
+ (DSN)</flag>
+ <flag name='exiscan-acl'>Patch providing support for content
+ scanning</flag>
+ <flag name='lmtp'>Adds support for lmtp</flag>
+ <flag name='mbx'>Adds support for UW's mbx format</flag>
+ <flag name='spf'>Adds support for Sender Policy Framework</flag>
+ <flag name='srs'>Adds support for Sender Rewriting Scheme</flag>
+ <flag name='proxy'>Add support for being behind a proxy, such as HAProxy</flag>
+ <flag name='pkcs11'>Require pkcs11 support in <pkg>net-libs/gnutls</pkg> with USE=gnutls</flag>
+ <flag name='redis'>Adds support for querying <pkg>dev-db/redis</pkg></flag>
+ <flag name='prdr'>Adds support for Per-Recipient Data Response</flag>
+ <flag name='tpda'>Adds support for Transport Post-Delivery Actions</flag>
+ </use>
+ <upstream>
+ <bugs-to>http://bugs.exim.org/</bugs-to>
+ <!-- stupid DTD doesn't allow this
+ <vcs>http://git.exim.org/exim.git</vcs>
+ -->
+ </upstream>
+</pkgmetadata>
diff --git a/mail-mta/metadata.xml b/mail-mta/metadata.xml
new file mode 100644
index 00000000000..832ee68326f
--- /dev/null
+++ b/mail-mta/metadata.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<catmetadata>
+ <longdescription lang="en">
+ The mail-mta category contains mail transport agent packages.
+ </longdescription>
+ <longdescription lang="de">
+ Die Kategorie mail-mta enthält Mail Transport Agents wie z.B. Sendmail und Postfix.
+ </longdescription>
+ <longdescription lang="es">
+ La categoría mail-mta contiene los paquetes de los agentes de transporte
+ de correo electrónico.
+ </longdescription>
+ <longdescription lang="ja">
+ mail-mtaカテゴリーにはメール・トランスポート・エージェントのパッケージが
+ 含まれています。
+ </longdescription>
+ <longdescription lang="nl">
+ De mail-mta categorie bevat Mail Transport Agents, zoals sendmail &amp; postfix.
+ </longdescription>
+ <longdescription lang="sk">
+ Kategória mail-mta obsahuje serverové balíky pre prenos elektronickej pošty (MTA).
+ </longdescription>
+ <longdescription lang="vi">
+ Nhóm mail-mta chứa các mail server (Mail Transport Agent).
+ </longdescription>
+ <longdescription lang="it">
+ La categoria mail-mta contiene pacchetti di server per la posta elettronica
+ (Mail Transport Agent).
+ </longdescription>
+ <longdescription lang="pt">
+ A categoria mail-mta contém pacotes de servidor dos agentes de
+ transporte de correio eletrônico (Mail Transport Agent).
+ </longdescription>
+ <longdescription lang="pl">
+ Kategoria mail-mta zawiera serwery przekazywania poczty.
+ </longdescription>
+</catmetadata>
diff --git a/mail-mta/mini-qmail/Manifest b/mail-mta/mini-qmail/Manifest
new file mode 100644
index 00000000000..4ed5ab704f2
--- /dev/null
+++ b/mail-mta/mini-qmail/Manifest
@@ -0,0 +1,4 @@
+DIST genqmail-20080406.tar.bz2 10252 SHA256 501ca2120c7619569bd9ac3e0035cb0022bfd0cdc9c720b5c43c9e3a4eb07ce8
+DIST mini-qmail-kit-0.52.tar.gz 6174 SHA256 8796d7ba7a6b1ff49df371491e2cebb1dca81169fa3d98d730f9d717067cf6d6
+DIST netqmail-1.05.tar.gz 252264 SHA256 59788abf252e2da224542c1c8b727311335c61d990f24f4edf28f6eb5483f676
+DIST netqmail-1.06.tar.gz 260941 SHA256 8e7d98d15211fc9f9c28109e942e2268f42a6672d68df92a42f2afa90ff00532
diff --git a/mail-mta/mini-qmail/files/1.05-config-mini-help.patch b/mail-mta/mini-qmail/files/1.05-config-mini-help.patch
new file mode 100644
index 00000000000..1b217dc9636
--- /dev/null
+++ b/mail-mta/mini-qmail/files/1.05-config-mini-help.patch
@@ -0,0 +1,16 @@
+--- config-mini.sh.orig 2004-05-05 23:24:23.468285864 -0400
++++ config-mini.sh 2004-05-05 23:27:00.622394808 -0400
+@@ -1,7 +1,12 @@
+
+ case $# in
+ 0|1|2|3|4)
+- echo 'config-mini: usage: config-mini me defaultdom plusdom idhost qmqpserver ...' 1>&2
++ echo 'usage: config-mini me defaultdom plusdom idhost qmqpserver [more qmqp servers]' 1>&2
++ echo ' me - copied from the QMQP server'
++ echo ' plusdom - copied from the QMQP server'
++ echo ' defaultdom - copied from the QMQP server'
++ echo ' idhost - hostname of QMPQ client'
++ echo ' qmqpserver - list of QMQP servers IP addresses to send mail through'
+ exit 100
+ ;;
+ esac
diff --git a/mail-mta/mini-qmail/files/1.06-exit.patch b/mail-mta/mini-qmail/files/1.06-exit.patch
new file mode 100644
index 00000000000..e0e7dea0f32
--- /dev/null
+++ b/mail-mta/mini-qmail/files/1.06-exit.patch
@@ -0,0 +1,18 @@
+Index: netqmail-1.06/qmail-pw2u.c
+===================================================================
+--- netqmail-1.06.orig/qmail-pw2u.c
++++ netqmail-1.06/qmail-pw2u.c
+@@ -1,3 +1,4 @@
++#include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include "substdio.h"
+Index: netqmail-1.06/qmail-qmtpd.c
+===================================================================
+--- netqmail-1.06.orig/qmail-qmtpd.c
++++ netqmail-1.06/qmail-qmtpd.c
+@@ -1,3 +1,4 @@
++#include <unistd.h>
+ #include "stralloc.h"
+ #include "substdio.h"
+ #include "qmail.h"
diff --git a/mail-mta/mini-qmail/files/1.06-headers.patch b/mail-mta/mini-qmail/files/1.06-headers.patch
new file mode 100644
index 00000000000..566babfa629
--- /dev/null
+++ b/mail-mta/mini-qmail/files/1.06-headers.patch
@@ -0,0 +1,37 @@
+--- a/qmail-pw2u.c
++++ b/qmail-pw2u.c
+@@ -1,3 +1,4 @@
++#include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include "substdio.h"
+--- a/qmail-qmtpd.c
++++ b/qmail-qmtpd.c
+@@ -1,3 +1,4 @@
++#include <unistd.h>
+ #include "stralloc.h"
+ #include "substdio.h"
+ #include "qmail.h"
+--- a/readwrite.h
++++ b/readwrite.h
+@@ -1,7 +1,7 @@
+ #ifndef READWRITE_H
+ #define READWRITE_H
+
+-extern int read();
+-extern int write();
++#include <fcntl.h>
++#include <unistd.h>
+
+ #endif
+--- a/substdio.h
++++ b/substdio.h
+@@ -1,6 +1,8 @@
+ #ifndef SUBSTDIO_H
+ #define SUBSTDIO_H
+
++#include <unistd.h>
++
+ typedef struct substdio {
+ char *x;
+ int p;
diff --git a/mail-mta/mini-qmail/files/99qmail b/mail-mta/mini-qmail/files/99qmail
new file mode 100644
index 00000000000..469553953a1
--- /dev/null
+++ b/mail-mta/mini-qmail/files/99qmail
@@ -0,0 +1,3 @@
+PATH="/var/qmail/bin"
+ROOTPATH="/var/qmail/bin"
+CONFIG_PROTECT="/var/qmail/control"
diff --git a/mail-mta/mini-qmail/files/config-mini b/mail-mta/mini-qmail/files/config-mini
new file mode 100644
index 00000000000..009026e2c09
--- /dev/null
+++ b/mail-mta/mini-qmail/files/config-mini
@@ -0,0 +1,38 @@
+
+case $# in
+ 0|1|2|3|4)
+ echo 'config-mini: usage: config-mini me defaultdom plusdom idhost qmqpserver ...' 1>&2
+ exit 100
+ ;;
+ esac
+
+me="$1"; shift
+defaultdomain="$1"; shift
+plusdomain="$1"; shift
+idhost="$1"; shift
+
+echo Putting "$me" into control/me...
+echo "$me" > QMAIL/control/me
+chmod 644 QMAIL/control/me
+
+echo Putting "$defaultdomain" into control/defaultdomain...
+echo "$defaultdomain" > QMAIL/control/defaultdomain
+chmod 644 QMAIL/control/defaultdomain
+
+echo Putting "$plusdomain" into control/plusdomain...
+echo "$plusdomain" > QMAIL/control/plusdomain
+chmod 644 QMAIL/control/plusdomain
+
+echo Putting "$idhost" into control/idhost...
+echo "$idhost" > QMAIL/control/idhost
+chmod 644 QMAIL/control/idhost
+
+cp /dev/null QMAIL/control/qmqpservers
+for qmqpserver in "$@"
+ do
+ echo Putting "$qmqpserver" into control/qmqpservers...
+ echo "$qmqpserver" >> QMAIL/control/qmqpservers
+ chmod 644 QMAIL/control/qmqpservers
+ done
+
+exit 0
diff --git a/mail-mta/mini-qmail/metadata.xml b/mail-mta/mini-qmail/metadata.xml
new file mode 100644
index 00000000000..4f23b826fd0
--- /dev/null
+++ b/mail-mta/mini-qmail/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>qmail</herd>
+ <maintainer>
+ <email>vapier@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>
diff --git a/mail-mta/mini-qmail/mini-qmail-1.05-r1.ebuild b/mail-mta/mini-qmail/mini-qmail-1.05-r1.ebuild
new file mode 100644
index 00000000000..791503e0466
--- /dev/null
+++ b/mail-mta/mini-qmail/mini-qmail-1.05-r1.ebuild
@@ -0,0 +1,98 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs fixheadtails
+
+MINI_VER=0.52
+DESCRIPTION="a small null client that forwards mail via QMQP to a full qmail server"
+HOMEPAGE="http://www.qmail.org/ http://cr.yp.to/qmail/mini.html"
+SRC_URI="mirror://qmail/netqmail-${PV}.tar.gz
+ http://www.din.or.jp/~ushijima/mini-qmail-kit/mini-qmail-kit-${MINI_VER}.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="amd64 arm hppa ~mips ppc x86"
+IUSE=""
+
+DEPEND="sys-apps/groff"
+RDEPEND="
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ !mail-mta/opensmtpd
+ "
+
+S=${WORKDIR}/mini-qmail-kit-${MINI_VER}
+
+src_unpack() {
+ unpack netqmail-${PV}.tar.gz
+ unpack mini-qmail-kit-${MINI_VER}.tar.gz
+
+ cd "${S}"
+ epatch "${FILESDIR}"/${PV}-config-mini-help.patch
+ sed -i \
+ -e "/^qmail=/s:=.*:=${WORKDIR}/netqmail-${PV}/netqmail-${PV}:" \
+ Makefile.mini || die
+
+ cd "${WORKDIR}"/netqmail-${PV}
+ ./collate.sh || die "patching failed"
+
+ cd netqmail-${PV}
+ echo -n "$(tc-getCC) ${CFLAGS}" > "${S}"/conf-cc
+ echo -n "$(tc-getCC) ${LDFLAGS}" > "${S}"/conf-ld
+ ht_fix_file Makefile
+}
+
+src_compile() {
+ emake -f Makefile.mini || die "mini prep failed"
+ emake mini || die "make mini failed"
+}
+
+src_install() {
+ einfo "Setting up directory hierarchy ..."
+ keepdir /var/mini-qmail/control
+
+ dodoc INSTALL README
+
+ exeinto /var/mini-qmail/bin
+ doexe qmail-qmqpc forward qmail-inject \
+ sendmail predate datemail mailsubj \
+ qmail-showctl maildirmake maildir2mbox \
+ maildirwatch qail elq pinq \
+ || die "doexe failed"
+ dosym qmail-qmqpc /var/mini-qmail/bin/qmail-queue
+ newexe config-mini.sh config-mini
+ dosed "s:QMAIL:/var/mini-qmail/:g" /var/mini-qmail/bin/config-mini
+
+ doman qmail-qmqpc.8 forward.1 qmail-inject.8 \
+ mailsubj.1 qmail-showctl.8 maildirmake.1 \
+ maildir2mbox.1 maildirwatch.1 qmail-queue.8 \
+ qmail.7
+
+ einfo "Adding env.d entry for qmail"
+ doenvd "${FILESDIR}"/99qmail
+
+ einfo "Creating sendmail replacement ..."
+ diropts -m 755
+ dodir /usr/sbin /usr/lib
+ dosym /var/mini-qmail/bin/sendmail /usr/sbin/sendmail
+ dosym /var/mini-qmail/bin/sendmail /usr/lib/sendmail
+}
+
+pkg_postinst() {
+ elog "In order for mini-qmail to work, you need to setup"
+ elog "the QMQP server information."
+ elog
+ elog "You can setup the values in /var/mini-qmail/control yourself,"
+ elog "or use the utility /var/mini-qmail/bin/config-mini"
+ elog "To find out what values to put in what files, see the install"
+ elog "section of http://cr.yp.to/qmail/mini.html"
+}
diff --git a/mail-mta/mini-qmail/mini-qmail-1.05.ebuild b/mail-mta/mini-qmail/mini-qmail-1.05.ebuild
new file mode 100644
index 00000000000..1a48cf554c9
--- /dev/null
+++ b/mail-mta/mini-qmail/mini-qmail-1.05.ebuild
@@ -0,0 +1,106 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs fixheadtails user
+
+DESCRIPTION="a small null client that forwards mail via QMQP to a full qmail server"
+HOMEPAGE="http://www.qmail.org/ http://cr.yp.to/qmail/mini.html"
+SRC_URI="mirror://qmail/netqmail-${PV}.tar.gz
+ http://www.din.or.jp/~ushijima/mini-qmail-kit/mini-qmail-kit-0.52.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="amd64 arm hppa ~mips ppc x86"
+IUSE=""
+
+DEPEND="sys-apps/groff"
+RDEPEND="
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ !mail-mta/opensmtpd
+ "
+
+S=${WORKDIR}/netqmail-${PV}/netqmail-${PV}
+
+pkg_setup() {
+ # keep in sync with qmail pkg
+ enewgroup qmail 201
+ enewuser alias 200 -1 /var/qmail/alias 200
+ enewuser qmaild 201 -1 /var/qmail 200
+ enewuser qmaill 202 -1 /var/qmail 200
+ enewuser qmailp 203 -1 /var/qmail 200
+ enewuser qmailq 204 -1 /var/qmail 201
+ enewuser qmailr 205 -1 /var/qmail 201
+ enewuser qmails 206 -1 /var/qmail 201
+}
+
+src_unpack() {
+ unpack netqmail-${PV}.tar.gz
+ unpack mini-qmail-kit-0.52.tar.gz
+
+ cd netqmail-${PV}
+ ./collate.sh || die "patching failed"
+ mv "${WORKDIR}"/mini-qmail-kit-0.52/* "${S}"/
+
+ cd "${S}"
+ echo -n "$(tc-getCC) ${CFLAGS}" > "${S}"/conf-cc
+ echo -n "$(tc-getCC) ${LDFLAGS}" > "${S}"/conf-ld
+ ht_fix_file "${S}"/Makefile
+
+ epatch "${FILESDIR}"/${PV}-config-mini-help.patch
+}
+
+src_compile() {
+ emake it man || die
+}
+
+src_install() {
+ einfo "Setting up directory hierarchy ..."
+ keepdir /var/mini-qmail/control
+
+ dodoc FAQ UPGRADE SENDMAIL INSTALL* TEST* REMOVE* PIC* SECURITY
+ dodoc SYSDEPS TARGETS THANKS THOUGHTS TODO VERSION README*
+
+ exeinto /var/mini-qmail/bin
+ doexe qmail-qmqpc forward qmail-inject \
+ sendmail predate datemail mailsubj \
+ qmail-showctl maildirmake maildir2mbox \
+ maildirwatch qail elq pinq \
+ || die "doexe failed"
+ dosym qmail-qmqpc /var/mini-qmail/bin/qmail-queue
+ newexe config-mini.sh config-mini
+ dosed "s:QMAIL:/var/mini-qmail/:g" /var/mini-qmail/bin/config-mini
+
+ doman qmail-qmqpc.8 forward.1 qmail-inject.8 \
+ mailsubj.1 qmail-showctl.8 maildirmake.1 \
+ maildir2mbox.1 maildirwatch.1 qmail-queue.8 \
+ qmail.7
+
+ einfo "Adding env.d entry for qmail"
+ doenvd "${FILESDIR}"/99qmail
+
+ einfo "Creating sendmail replacement ..."
+ diropts -m 755
+ dodir /usr/sbin /usr/lib
+ dosym /var/mini-qmail/bin/sendmail /usr/sbin/sendmail
+ dosym /var/mini-qmail/bin/sendmail /usr/lib/sendmail
+}
+
+pkg_postinst() {
+ elog "In order for mini-qmail to work, you need to setup"
+ elog "the QMQP server information."
+ elog
+ elog "You can setup the values in /var/mini-qmail/control yourself,"
+ elog "or use the utility /var/mini-qmail/bin/config-mini"
+ elog "To find out what values to put in what files, see the install"
+ elog "section of http://cr.yp.to/qmail/mini.html"
+}
diff --git a/mail-mta/mini-qmail/mini-qmail-1.06.ebuild b/mail-mta/mini-qmail/mini-qmail-1.06.ebuild
new file mode 100644
index 00000000000..617a86baa44
--- /dev/null
+++ b/mail-mta/mini-qmail/mini-qmail-1.06.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+GENQMAIL_PV=20080406
+
+inherit eutils qmail
+
+DESCRIPTION="a small null client that forwards mail via QMQP to a full qmail server"
+HOMEPAGE="
+ http://netqmail.org
+ http://cr.yp.to/qmail/mini.html
+ http://qmail.org
+"
+SRC_URI="mirror://qmail/netqmail-${PV}.tar.gz
+ http://dev.gentoo.org/~hollow/distfiles/${GENQMAIL_F}"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~amd64 arm hppa ~mips ~ppc ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/maildrop
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ !mail-mta/opensmtpd
+ ${DEPEND}
+ "
+
+S="${WORKDIR}"/netqmail-${PV}
+
+src_unpack() {
+ genqmail_src_unpack
+
+ unpack netqmail-${PV}.tar.gz
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${PV}-headers.patch
+
+ qmail_src_postunpack
+}
+
+src_compile() {
+ qmail_src_compile
+}
+
+# make check is actually an install-check target, see bug #364955
+src_test() { :; }
+
+qmail_base_install_hook() {
+ dosym qmail-qmqpc "${QMAIL_HOME}"/bin/qmail-queue
+ exeinto "${QMAIL_HOME}"/bin
+ doexe "${FILESDIR}"/config-mini
+}
+
+src_install() {
+ qmail_base_install
+ qmail_man_install
+ qmail_sendmail_install
+}
diff --git a/mail-mta/msmtp/Manifest b/mail-mta/msmtp/Manifest
new file mode 100644
index 00000000000..0bffe9aabc5
--- /dev/null
+++ b/mail-mta/msmtp/Manifest
@@ -0,0 +1,5 @@
+DIST msmtp-1.4.31.tar.bz2 305770 SHA256 247af9a95fa22f506e85109fc4268a5d91ca03af9b17eebcc1e46b7cd64c225f SHA512 aec12bd9479342d826e7c838116c1771a17dc2b53c220c7fdf4d3fa4cb53eb76041bb64be7417637887e6f0109f65d97155e9c74d60633c280edb0613417a136 WHIRLPOOL a4c1413937786b3cf994b3d2227821e699f00c517915afea04f30064b48fdfb4ff8829c2ad9826f7c5776580c5ebc38e4dacafe53941c3d3615c1226c9619b14
+DIST msmtp-1.4.32.tar.bz2 303652 SHA256 2bf0c5c7e78f9905f48de235a75111a1a88238793043bbeae00360b22f1a5f88 SHA512 68886e1eec7a63044590cf65ec8f9a2b25c77abe2209f28d6f245141d3188f23f40f9e572165e5a446342c5867cc94cc44337caf4f4d3114227a021686966ff3 WHIRLPOOL 7a8d25f75a4b6b31b2d0d67c8818673279891c1bcd067c7d5c9b3c3541803161c9737f4b89d6ecdc32b11aa2c5c2cc2e1c896aeeb61483f519a76c88259a7dd0
+DIST msmtp-1.6.0.tar.xz 278068 SHA256 ab08d03a575c0de3726fdb68a5f333ae292e14188fe8cce1d1fbd826fa3278fb SHA512 be698d1cba42b5d64d1d01f6d9da808b07f44b14face239f9db279cdb937aecb0599352b45260c8656e59e8a66921ddacf9c5de9c6ca3409f87656b62bef138d WHIRLPOOL 57b042489433fc398de9538c68d2c756ae0aae685026cb8eb503f07c4b5d843aed82e23d848646ad96ab351b3628e47b963e027ab801c867311ee5fe964d3f62
+DIST msmtp-1.6.1.tar.xz 279324 SHA256 c45d47f2dc77484e3f74c0f66aef0d5d95de6c47ed71d9f926d86d546f8346f3 SHA512 ad36e46e137136c85b470c24180db89bbd9b12a362a8dcb2883fa66a1f9233bffa24b929935e0dd7557f820711eedb6e96c0674244725b559c5237ce4f2425ed WHIRLPOOL a949980f3b277d1a259098aed792d50393f18fdd03e378222d933fb4c5e88628533625c4149cc79105a74384e3d02ce3a5ef6093759634e3573bf93021c1208d
+DIST msmtp-1.6.2.tar.xz 280292 SHA256 2f6ecd7cbfadf548fd55205bd24cb63b84bcbb1185efed917dd7800595a48789 SHA512 74fb87cbf561e59059f7e5587167fb969348077b569d64dbdbfaa39820e6dc02968d77f3bc182fa714a198fa9eeebd80184b44961e2370be5660c8626b483854 WHIRLPOOL 08d54c744e32b2630566d8ef0fb56f960321882cb246e01edc3f56e27419097c5efad50ccc747c96aa6b9fc3ba08bc9ecd9a7c67e33337b9bc6dd7c33ca42111
diff --git a/mail-mta/msmtp/metadata.xml b/mail-mta/msmtp/metadata.xml
new file mode 100644
index 00000000000..1de9daedd0e
--- /dev/null
+++ b/mail-mta/msmtp/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-mail</herd>
+ <use>
+ <flag name="mta">Enable this to install as system-wide MTA</flag>
+ <flag name="libsecret">Enable libsecret support to store login credentials</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">msmtp</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/mail-mta/msmtp/msmtp-1.4.31-r1.ebuild b/mail-mta/msmtp/msmtp-1.4.31-r1.ebuild
new file mode 100644
index 00000000000..35d0672d47d
--- /dev/null
+++ b/mail-mta/msmtp/msmtp-1.4.31-r1.ebuild
@@ -0,0 +1,134 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit multilib python eutils
+
+DESCRIPTION="An SMTP client and SMTP plugin for mail user agents such as Mutt"
+HOMEPAGE="http://msmtp.sourceforge.net/"
+SRC_URI="mirror://sourceforge/msmtp/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 ia64 ppc ppc64 sparc x86 ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x86-macos"
+IUSE="doc gnome-keyring gnutls idn +mta nls sasl ssl vim-syntax"
+
+CDEPEND="
+ gnome-keyring? (
+ dev-python/gnome-keyring-python
+ gnome-base/libgnome-keyring
+ )
+ idn? ( net-dns/libidn )
+ nls? ( virtual/libintl )
+ sasl? ( virtual/gsasl )
+ ssl? (
+ gnutls? ( net-libs/gnutls )
+ !gnutls? ( dev-libs/openssl )
+ )"
+
+RDEPEND="${CDEPEND}
+ net-mail/mailbase
+ mta? ( !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta] )"
+
+DEPEND="${CDEPEND}
+ doc? ( virtual/texi2dvi )
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+
+REQUIRED_USE="gnutls? ( ssl )"
+
+src_prepare() {
+ # Use default Gentoo location for mail aliases
+ sed -i -e 's:/etc/aliases:/etc/mail/aliases:' scripts/find_alias/find_alias_for_msmtp.sh || die
+
+ python_convert_shebangs 2 scripts/msmtp-gnome-tool/msmtp-gnome-tool.py
+}
+
+src_configure() {
+ econf \
+ --disable-silent-rules \
+ $(use_with gnome-keyring ) \
+ $(use_with idn libidn) \
+ $(use_enable nls) \
+ $(use_with sasl libgsasl) \
+ $(use_with ssl ssl $(usex gnutls gnutls openssl))
+}
+
+src_compile() {
+ default
+
+ if use doc ; then
+ cd doc || die
+ emake html pdf
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc AUTHORS ChangeLog NEWS README THANKS doc/{Mutt+msmtp.txt,msmtprc*}
+
+ if use doc ; then
+ dohtml doc/msmtp.html
+ dodoc doc/msmtp.pdf
+ fi
+
+ if use gnome-keyring ; then
+ src_install_contrib msmtp-gnome-tool msmtp-gnome-tool.py README
+ fi
+
+ if use mta ; then
+ dodir /usr/sbin
+ dosym /usr/bin/msmtp /usr/sbin/sendmail
+ dosym /usr/bin/msmtp /usr/bin/sendmail
+ dosym /usr/bin/msmtp /usr/$(get_libdir)/sendmail
+ fi
+
+ if use vim-syntax ; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins scripts/vim/msmtp.vim
+ fi
+
+ insinto /etc
+ newins doc/msmtprc-system.example msmtprc
+
+ src_install_contrib find_alias find_alias_for_msmtp.sh
+ src_install_contrib msmtpqueue "*.sh" "README ChangeLog"
+ src_install_contrib msmtpq "msmtpq msmtp-queue" README.msmtpq
+ src_install_contrib set_sendmail set_sendmail.sh set_sendmail.conf
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ einfo "Please edit ${ROOT}etc/msmtprc before first use."
+ einfo "In addition, per user configuration files can be placed"
+ einfo "as '~/.msmtprc'. See the msmtprc-user.example file under"
+ einfo "/usr/share/doc/${PF}/ for an example."
+ fi
+}
+
+src_install_contrib() {
+ subdir="$1"
+ bins="$2"
+ docs="$3"
+ local dir=/usr/share/${PN}/$subdir
+ insinto ${dir}
+ exeinto ${dir}
+ for i in $bins ; do
+ doexe scripts/$subdir/$i
+ done
+ for i in $docs ; do
+ newdoc scripts/$subdir/$i $subdir.$i
+ done
+}
diff --git a/mail-mta/msmtp/msmtp-1.4.32.ebuild b/mail-mta/msmtp/msmtp-1.4.32.ebuild
new file mode 100644
index 00000000000..fd7f080a277
--- /dev/null
+++ b/mail-mta/msmtp/msmtp-1.4.32.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+inherit multilib python-single-r1 eutils
+
+DESCRIPTION="An SMTP client and SMTP plugin for mail user agents such as Mutt"
+HOMEPAGE="http://msmtp.sourceforge.net/"
+SRC_URI="mirror://sourceforge/msmtp/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x86-macos"
+IUSE="doc gnome-keyring gnutls idn +mta nls sasl ssl vim-syntax"
+REQUIRED_USE="gnome-keyring? ( ${PYTHON_REQUIRED_USE} )"
+
+CDEPEND="
+ gnome-keyring? (
+ ${PYTHON_DEPS}
+ dev-python/gnome-keyring-python
+ gnome-base/libgnome-keyring
+ )
+ idn? ( net-dns/libidn )
+ nls? ( virtual/libintl )
+ sasl? ( virtual/gsasl )
+ ssl? (
+ gnutls? ( net-libs/gnutls )
+ !gnutls? ( dev-libs/openssl )
+ )"
+
+RDEPEND="${CDEPEND}
+ net-mail/mailbase
+ mta? ( !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta] )"
+
+DEPEND="${CDEPEND}
+ doc? ( virtual/texi2dvi )
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+
+REQUIRED_USE="gnutls? ( ssl )"
+
+src_prepare() {
+ # Use default Gentoo location for mail aliases
+ sed -i -e 's:/etc/aliases:/etc/mail/aliases:' scripts/find_alias/find_alias_for_msmtp.sh || die
+
+ python_fix_shebang scripts/msmtp-gnome-tool/msmtp-gnome-tool.py
+}
+
+src_configure() {
+ econf \
+ --disable-silent-rules \
+ $(use_with gnome-keyring ) \
+ $(use_with idn libidn) \
+ $(use_enable nls) \
+ $(use_with sasl libgsasl) \
+ $(use_with ssl ssl $(usex gnutls gnutls openssl))
+}
+
+src_compile() {
+ default
+
+ if use doc ; then
+ cd doc || die
+ emake html pdf
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc AUTHORS ChangeLog NEWS README THANKS doc/{Mutt+msmtp.txt,msmtprc*}
+
+ if use doc ; then
+ dohtml doc/msmtp.html
+ dodoc doc/msmtp.pdf
+ fi
+
+ if use gnome-keyring ; then
+ src_install_contrib msmtp-gnome-tool msmtp-gnome-tool.py README
+ fi
+
+ if use mta ; then
+ dodir /usr/sbin
+ dosym /usr/bin/msmtp /usr/sbin/sendmail
+ dosym /usr/bin/msmtp /usr/bin/sendmail
+ dosym /usr/bin/msmtp /usr/$(get_libdir)/sendmail
+ fi
+
+ if use vim-syntax ; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins scripts/vim/msmtp.vim
+ fi
+
+ insinto /etc
+ newins doc/msmtprc-system.example msmtprc
+
+ src_install_contrib find_alias find_alias_for_msmtp.sh
+ src_install_contrib msmtpqueue "*.sh" "README ChangeLog"
+ src_install_contrib msmtpq "msmtpq msmtp-queue" README.msmtpq
+ src_install_contrib set_sendmail set_sendmail.sh set_sendmail.conf
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ einfo "Please edit ${ROOT}etc/msmtprc before first use."
+ einfo "In addition, per user configuration files can be placed"
+ einfo "as '~/.msmtprc'. See the msmtprc-user.example file under"
+ einfo "/usr/share/doc/${PF}/ for an example."
+ fi
+}
+
+src_install_contrib() {
+ subdir="$1"
+ bins="$2"
+ docs="$3"
+ local dir=/usr/share/${PN}/$subdir
+ insinto ${dir}
+ exeinto ${dir}
+ for i in $bins ; do
+ doexe scripts/$subdir/$i
+ done
+ for i in $docs ; do
+ newdoc scripts/$subdir/$i $subdir.$i
+ done
+}
diff --git a/mail-mta/msmtp/msmtp-1.6.0.ebuild b/mail-mta/msmtp/msmtp-1.6.0.ebuild
new file mode 100644
index 00000000000..1171d3895c6
--- /dev/null
+++ b/mail-mta/msmtp/msmtp-1.6.0.ebuild
@@ -0,0 +1,130 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit multilib
+
+DESCRIPTION="An SMTP client and SMTP plugin for mail user agents such as Mutt"
+HOMEPAGE="http://msmtp.sourceforge.net/"
+SRC_URI="mirror://sourceforge/msmtp/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x86-macos"
+IUSE="doc gnutls idn libsecret +mta nls sasl ssl vim-syntax"
+
+CDEPEND="
+ idn? ( net-dns/libidn )
+ libsecret? ( app-crypt/libsecret )
+ nls? ( virtual/libintl )
+ sasl? ( virtual/gsasl )
+ ssl? (
+ gnutls? ( net-libs/gnutls )
+ !gnutls? ( dev-libs/openssl )
+ )
+"
+
+RDEPEND="${CDEPEND}
+ net-mail/mailbase
+ mta? (
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ )
+"
+
+DEPEND="${CDEPEND}
+ doc? ( virtual/texi2dvi )
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig
+"
+
+REQUIRED_USE="gnutls? ( ssl )"
+
+DOCS="AUTHORS ChangeLog NEWS README THANKS doc/msmtprc*"
+
+src_prepare() {
+ # Use default Gentoo location for mail aliases
+ sed -i 's:/etc/aliases:/etc/mail/aliases:' scripts/find_alias/find_alias_for_msmtp.sh || die
+}
+
+src_configure() {
+ econf \
+ $(use_enable nls) \
+ $(use_with ssl ssl $(usex gnutls gnutls openssl)) \
+ $(use_with sasl libgsasl) \
+ $(use_with idn libidn) \
+ $(use_with libsecret )
+}
+
+src_compile() {
+ default
+
+ if use doc ; then
+ cd doc || die
+ emake html pdf
+ fi
+}
+
+src_install() {
+ default
+
+ if use doc ; then
+ dohtml doc/msmtp.html
+ dodoc doc/msmtp.pdf
+ fi
+
+ if use mta ; then
+ dodir /usr/sbin
+ dosym /usr/bin/msmtp /usr/sbin/sendmail
+ dosym /usr/bin/msmtp /usr/bin/sendmail
+ dosym /usr/bin/msmtp /usr/$(get_libdir)/sendmail
+ fi
+
+ if use vim-syntax ; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins scripts/vim/msmtp.vim
+ fi
+
+ insinto /etc
+ newins doc/msmtprc-system.example msmtprc
+
+ src_install_contrib find_alias find_alias_for_msmtp.sh
+ src_install_contrib msmtpqueue "*.sh" "README ChangeLog"
+ src_install_contrib msmtpq "msmtpq msmtp-queue" README.msmtpq
+ src_install_contrib set_sendmail set_sendmail.sh set_sendmail.conf
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ einfo "Please edit ${ROOT}etc/msmtprc before first use."
+ einfo "In addition, per user configuration files can be placed"
+ einfo "as '~/.msmtprc'. See the msmtprc-user.example file under"
+ einfo "/usr/share/doc/${PF}/ for an example."
+ fi
+}
+
+src_install_contrib() {
+ subdir="$1"
+ bins="$2"
+ docs="$3"
+ local dir=/usr/share/${PN}/$subdir
+ insinto ${dir}
+ exeinto ${dir}
+ for i in $bins ; do
+ doexe scripts/$subdir/$i
+ done
+ for i in $docs ; do
+ newdoc scripts/$subdir/$i $subdir.$i
+ done
+}
diff --git a/mail-mta/msmtp/msmtp-1.6.1.ebuild b/mail-mta/msmtp/msmtp-1.6.1.ebuild
new file mode 100644
index 00000000000..dc93ef2193b
--- /dev/null
+++ b/mail-mta/msmtp/msmtp-1.6.1.ebuild
@@ -0,0 +1,130 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit multilib
+
+DESCRIPTION="An SMTP client and SMTP plugin for mail user agents such as Mutt"
+HOMEPAGE="http://msmtp.sourceforge.net/"
+SRC_URI="mirror://sourceforge/msmtp/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 ia64 ppc ~ppc64 sparc x86 ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x86-macos"
+IUSE="doc gnutls idn libsecret +mta nls sasl ssl vim-syntax"
+
+CDEPEND="
+ idn? ( net-dns/libidn )
+ libsecret? ( app-crypt/libsecret )
+ nls? ( virtual/libintl )
+ sasl? ( virtual/gsasl )
+ ssl? (
+ gnutls? ( net-libs/gnutls )
+ !gnutls? ( dev-libs/openssl )
+ )
+"
+
+RDEPEND="${CDEPEND}
+ net-mail/mailbase
+ mta? (
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ )
+"
+
+DEPEND="${CDEPEND}
+ doc? ( virtual/texi2dvi )
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig
+"
+
+REQUIRED_USE="gnutls? ( ssl )"
+
+DOCS="AUTHORS ChangeLog NEWS README THANKS doc/msmtprc*"
+
+src_prepare() {
+ # Use default Gentoo location for mail aliases
+ sed -i 's:/etc/aliases:/etc/mail/aliases:' scripts/find_alias/find_alias_for_msmtp.sh || die
+}
+
+src_configure() {
+ econf \
+ $(use_enable nls) \
+ $(use_with ssl ssl $(usex gnutls gnutls openssl)) \
+ $(use_with sasl libgsasl) \
+ $(use_with idn libidn) \
+ $(use_with libsecret )
+}
+
+src_compile() {
+ default
+
+ if use doc ; then
+ cd doc || die
+ emake html pdf
+ fi
+}
+
+src_install() {
+ default
+
+ if use doc ; then
+ dohtml doc/msmtp.html
+ dodoc doc/msmtp.pdf
+ fi
+
+ if use mta ; then
+ dodir /usr/sbin
+ dosym /usr/bin/msmtp /usr/sbin/sendmail
+ dosym /usr/bin/msmtp /usr/bin/sendmail
+ dosym /usr/bin/msmtp /usr/$(get_libdir)/sendmail
+ fi
+
+ if use vim-syntax ; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins scripts/vim/msmtp.vim
+ fi
+
+ insinto /etc
+ newins doc/msmtprc-system.example msmtprc
+
+ src_install_contrib find_alias find_alias_for_msmtp.sh
+ src_install_contrib msmtpqueue "*.sh" "README ChangeLog"
+ src_install_contrib msmtpq "msmtpq msmtp-queue" README.msmtpq
+ src_install_contrib set_sendmail set_sendmail.sh set_sendmail.conf
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ einfo "Please edit ${ROOT}etc/msmtprc before first use."
+ einfo "In addition, per user configuration files can be placed"
+ einfo "as '~/.msmtprc'. See the msmtprc-user.example file under"
+ einfo "/usr/share/doc/${PF}/ for an example."
+ fi
+}
+
+src_install_contrib() {
+ subdir="$1"
+ bins="$2"
+ docs="$3"
+ local dir=/usr/share/${PN}/$subdir
+ insinto ${dir}
+ exeinto ${dir}
+ for i in $bins ; do
+ doexe scripts/$subdir/$i
+ done
+ for i in $docs ; do
+ newdoc scripts/$subdir/$i $subdir.$i
+ done
+}
diff --git a/mail-mta/msmtp/msmtp-1.6.2.ebuild b/mail-mta/msmtp/msmtp-1.6.2.ebuild
new file mode 100644
index 00000000000..1171d3895c6
--- /dev/null
+++ b/mail-mta/msmtp/msmtp-1.6.2.ebuild
@@ -0,0 +1,130 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit multilib
+
+DESCRIPTION="An SMTP client and SMTP plugin for mail user agents such as Mutt"
+HOMEPAGE="http://msmtp.sourceforge.net/"
+SRC_URI="mirror://sourceforge/msmtp/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x86-macos"
+IUSE="doc gnutls idn libsecret +mta nls sasl ssl vim-syntax"
+
+CDEPEND="
+ idn? ( net-dns/libidn )
+ libsecret? ( app-crypt/libsecret )
+ nls? ( virtual/libintl )
+ sasl? ( virtual/gsasl )
+ ssl? (
+ gnutls? ( net-libs/gnutls )
+ !gnutls? ( dev-libs/openssl )
+ )
+"
+
+RDEPEND="${CDEPEND}
+ net-mail/mailbase
+ mta? (
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ )
+"
+
+DEPEND="${CDEPEND}
+ doc? ( virtual/texi2dvi )
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig
+"
+
+REQUIRED_USE="gnutls? ( ssl )"
+
+DOCS="AUTHORS ChangeLog NEWS README THANKS doc/msmtprc*"
+
+src_prepare() {
+ # Use default Gentoo location for mail aliases
+ sed -i 's:/etc/aliases:/etc/mail/aliases:' scripts/find_alias/find_alias_for_msmtp.sh || die
+}
+
+src_configure() {
+ econf \
+ $(use_enable nls) \
+ $(use_with ssl ssl $(usex gnutls gnutls openssl)) \
+ $(use_with sasl libgsasl) \
+ $(use_with idn libidn) \
+ $(use_with libsecret )
+}
+
+src_compile() {
+ default
+
+ if use doc ; then
+ cd doc || die
+ emake html pdf
+ fi
+}
+
+src_install() {
+ default
+
+ if use doc ; then
+ dohtml doc/msmtp.html
+ dodoc doc/msmtp.pdf
+ fi
+
+ if use mta ; then
+ dodir /usr/sbin
+ dosym /usr/bin/msmtp /usr/sbin/sendmail
+ dosym /usr/bin/msmtp /usr/bin/sendmail
+ dosym /usr/bin/msmtp /usr/$(get_libdir)/sendmail
+ fi
+
+ if use vim-syntax ; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins scripts/vim/msmtp.vim
+ fi
+
+ insinto /etc
+ newins doc/msmtprc-system.example msmtprc
+
+ src_install_contrib find_alias find_alias_for_msmtp.sh
+ src_install_contrib msmtpqueue "*.sh" "README ChangeLog"
+ src_install_contrib msmtpq "msmtpq msmtp-queue" README.msmtpq
+ src_install_contrib set_sendmail set_sendmail.sh set_sendmail.conf
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ einfo "Please edit ${ROOT}etc/msmtprc before first use."
+ einfo "In addition, per user configuration files can be placed"
+ einfo "as '~/.msmtprc'. See the msmtprc-user.example file under"
+ einfo "/usr/share/doc/${PF}/ for an example."
+ fi
+}
+
+src_install_contrib() {
+ subdir="$1"
+ bins="$2"
+ docs="$3"
+ local dir=/usr/share/${PN}/$subdir
+ insinto ${dir}
+ exeinto ${dir}
+ for i in $bins ; do
+ doexe scripts/$subdir/$i
+ done
+ for i in $docs ; do
+ newdoc scripts/$subdir/$i $subdir.$i
+ done
+}
diff --git a/mail-mta/netqmail/Manifest b/mail-mta/netqmail/Manifest
new file mode 100644
index 00000000000..cedd87fa66e
--- /dev/null
+++ b/mail-mta/netqmail/Manifest
@@ -0,0 +1,7 @@
+DIST big-todo.103.patch 5546 SHA256 afa0a249e3271badd442f0bdae39997d9fe536157d8a0d62b6706f3dfcd11a72 SHA512 fe6e19a94fb7dbe51f7164e38a91d8edb636251569d44ace1e146fe5f607b240edafb2884daaac481ff3219142ab553cfd5b01786e0dfc4662ef07336b789975 WHIRLPOOL ac9c2ce18e8c3bda85287c998661f2192c986daaad197bd358e1966cb97b4dbe0146bc0e334a251fc0ec3e42a7caa3f9a479a8c2c8e7777c790cb8af078d5d13
+DIST genqmail-20080406.tar.bz2 10252 SHA256 501ca2120c7619569bd9ac3e0035cb0022bfd0cdc9c720b5c43c9e3a4eb07ce8 SHA512 744d0968307bfedebf0ca7bc0d5bd0780884326acaf5fea0a66fb91f8b0caf5ba52eb443c9cb2a7d6389622ca5c87100c3204ec3408aed8ef5fb1e7f80ff0d35 WHIRLPOOL b385cd2d5e88795f163a4f49dc81a2080d7076ec2016ee7d8154df4488effa7112caf0577c8dc8ff654665213aa4120a21de8223f3dd51056fa189546ace3cf5
+DIST netqmail-1.05-tls-smtpauth-20070417.patch 67942 SHA256 573de07d57ac6941a42dda645079213cf36fcbb7f3a8c254b8447709e5e5cd60 SHA512 ce5fb50ae9a7683b708eeb65c68a0db47c5817eb3fc14457c4f7c5746916ca2734c647a2369bf6f1240477ee818e3e7d7870aec3edbad2eaace179cba6267e41 WHIRLPOOL a5bf8ecfcd6f0b76d9c10a318d93aecbf7778e59a1a88432f38e051859fc926a7e2a688d55e8326d6c58c1690f453025eeb1dd64b9b603f37b132c18d22fbcd8
+DIST netqmail-1.06.tar.gz 260941 SHA256 8e7d98d15211fc9f9c28109e942e2268f42a6672d68df92a42f2afa90ff00532 SHA512 de40a6d8fac502bd785010434d99b99f2c0524e10aea3d0f2a0d35c70fce91e991eb1fb8f20a1276eb56d7e73130ea5e2c178f6075d138af47b28d9ca6e6046b WHIRLPOOL 167bd5c290f13bf7d39daae0a6245afa1bcf760b01fd7ffcc88676f02a9ed1013c545c9f87c4d6e05ee7b073c838ee1613f97cb75ae3eab65106e32040d74712
+DIST qmail-103.patch 2104 SHA256 4cad53c7a6628a600c74c36bfee327db5052ca24c222d4013e4dfcd7f427653d SHA512 b81062bb0b0023f474c0b6af40601926e1c04ad395de480d114809e48a8060c06d99bdbdeb6f44d9e24ae1acedabb094b979193d305371aed958f18fc6eee354 WHIRLPOOL 5785684b98b9d9732ed14aa1b53910746bd09aa93514e0e6ef3d74831c3df8ed0a55f257057488f34a3d462e485b7a4417ed255f66abaff6dd63d881b9230063
+DIST qmail-spp-0.42.tar.gz 18689 SHA256 1518e7e82d10fbbb8ecc520f51daf503edeb9c3a9fb935be65a8185e7b53808d SHA512 03449862886a0ca20fbadab4c94b34b55d185f8df3261bd68aea99e9ded9edfab4477c6b38a8e0295e9b38b0045615da8b1a906a458f28745eadd3c4d882bcbf WHIRLPOOL 2f8525bb264fbec4b057bad6d92968e29085fdf10b8538b8e572d81ea8793e74c07c6093d0cc2a34de00b629e797b048007b30e3845dce76829037fdb44f527c
+DIST vu555316.patch 617 SHA256 cc7b2876ecb183fe55c280404c1c825a6bd1f6ccc87db67e7cfc8bc6336f9b0f SHA512 5d7810360e5eaa8e8ee141fe92c765d9458aa12198a8d0ac702e0630e08d060ad4a1d33690d434f20f5aff79eb200cd8173bebc334c411e340c0198b5d8d1a65 WHIRLPOOL 2564d5622576b89918e247de5dd830011e8ef18a50fd03e6f48e98ebf4a53db2f4994eb0fb22a76c4cd0cbb35b457ac2a5507e05159130a72685866137c5ebc1
diff --git a/mail-mta/netqmail/files/1.06-exit.patch b/mail-mta/netqmail/files/1.06-exit.patch
new file mode 100644
index 00000000000..e0e7dea0f32
--- /dev/null
+++ b/mail-mta/netqmail/files/1.06-exit.patch
@@ -0,0 +1,18 @@
+Index: netqmail-1.06/qmail-pw2u.c
+===================================================================
+--- netqmail-1.06.orig/qmail-pw2u.c
++++ netqmail-1.06/qmail-pw2u.c
+@@ -1,3 +1,4 @@
++#include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include "substdio.h"
+Index: netqmail-1.06/qmail-qmtpd.c
+===================================================================
+--- netqmail-1.06.orig/qmail-qmtpd.c
++++ netqmail-1.06/qmail-qmtpd.c
+@@ -1,3 +1,4 @@
++#include <unistd.h>
+ #include "stralloc.h"
+ #include "substdio.h"
+ #include "qmail.h"
diff --git a/mail-mta/netqmail/files/1.06-fbsd-utmpx.patch b/mail-mta/netqmail/files/1.06-fbsd-utmpx.patch
new file mode 100644
index 00000000000..8500eb53e3e
--- /dev/null
+++ b/mail-mta/netqmail/files/1.06-fbsd-utmpx.patch
@@ -0,0 +1,64 @@
+--- qbiff.c.orig 2010-04-06 08:43:28.000000000 -0300
++++ qbiff.c 2010-04-06 08:44:35.000000000 -0300
+@@ -1,13 +1,6 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+-#include <utmp.h>
+-#ifndef UTMP_FILE
+-#ifdef _PATH_UTMP
+-#define UTMP_FILE _PATH_UTMP
+-#else
+-#define UTMP_FILE "/etc/utmp"
+-#endif
+-#endif
++#include <utmpx.h>
+ #include "readwrite.h"
+ #include "stralloc.h"
+ #include "substdio.h"
+@@ -21,15 +14,12 @@
+ #include "env.h"
+ #include "exit.h"
+
+-substdio ssutmp;
+-char bufutmp[sizeof(struct utmp) * 16];
+-int fdutmp;
+ substdio sstty;
+ char buftty[1024];
+ int fdtty;
+
+-struct utmp ut;
+-char line[sizeof(ut.ut_line) + 1];
++struct utmpx *ut;
++char line[sizeof(ut->ut_line) + 1];
+ stralloc woof = {0};
+ stralloc tofrom = {0};
+ stralloc text = {0};
+@@ -64,7 +54,7 @@
+ if (!(user = env_get("USER"))) _exit(0);
+ if (!(sender = env_get("SENDER"))) _exit(0);
+ if (!(userext = env_get("LOCAL"))) _exit(0);
+- if (str_len(user) > sizeof(ut.ut_name)) _exit(0);
++ if (str_len(user) > sizeof(ut->ut_user)) _exit(0);
+
+ if (!stralloc_copys(&tofrom,"*** TO <")) _exit(0);
+ if (!stralloc_cats(&tofrom,userext)) _exit(0);
+@@ -89,15 +79,11 @@
+ if (!stralloc_cat(&woof,&text)) _exit(0);
+ if (!stralloc_cats(&woof,"\015\n")) _exit(0);
+
+- fdutmp = open_read(UTMP_FILE);
+- if (fdutmp == -1) _exit(0);
+- substdio_fdbuf(&ssutmp,read,fdutmp,bufutmp,sizeof(bufutmp));
+-
+- while (substdio_get(&ssutmp,&ut,sizeof(ut)) == sizeof(ut))
+- if (!str_diffn(ut.ut_name,user,sizeof(ut.ut_name)))
++ while ((ut = getutxent()) != NULL)
++ if (ut->ut_type == USER_PROCESS && !str_diffn(ut->ut_user,user,sizeof(ut->ut_user)))
+ {
+- byte_copy(line,sizeof(ut.ut_line),ut.ut_line);
+- line[sizeof(ut.ut_line)] = 0;
++ byte_copy(line,sizeof(ut->ut_line),ut->ut_line);
++ line[sizeof(ut->ut_line)] = 0;
+ if (line[0] == '/') continue;
+ if (!line[0]) continue;
+ if (line[str_chr(line,'.')]) continue;
diff --git a/mail-mta/netqmail/files/1.06-readwrite.patch b/mail-mta/netqmail/files/1.06-readwrite.patch
new file mode 100644
index 00000000000..a2fbe5fe695
--- /dev/null
+++ b/mail-mta/netqmail/files/1.06-readwrite.patch
@@ -0,0 +1,13 @@
+diff --git a/readwrite.h b/readwrite.h
+index 2a64968..0a641a3 100644
+--- a/readwrite.h
++++ b/readwrite.h
+@@ -1,7 +1,4 @@
+ #ifndef READWRITE_H
+ #define READWRITE_H
+-
+-extern int read();
+-extern int write();
+-
++#include <unistd.h>
+ #endif
diff --git a/mail-mta/netqmail/files/genqmail-20080406-ldflags.patch b/mail-mta/netqmail/files/genqmail-20080406-ldflags.patch
new file mode 100644
index 00000000000..1eb334c259c
--- /dev/null
+++ b/mail-mta/netqmail/files/genqmail-20080406-ldflags.patch
@@ -0,0 +1,13 @@
+diff -Nuar genqmail-20080406.orig/spp/Makefile genqmail-20080406/spp/Makefile
+--- genqmail-20080406.orig/spp/Makefile 2008-04-06 15:44:14.000000000 +0000
++++ genqmail-20080406/spp/Makefile 2013-05-27 00:37:58.687763457 +0000
+@@ -14,7 +14,7 @@
+ rm -f $(TARGETS)
+
+ $(RESOLV_OBJS):
+- $(CC) $(CFLAGS) -o $@ $@.c -lresolv
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c -lresolv
+
+ $(SIMPLE_OBJS):
+- $(CC) $(CFLAGS) -o $@ $@.c
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c
diff --git a/mail-mta/netqmail/metadata.xml b/mail-mta/netqmail/metadata.xml
new file mode 100644
index 00000000000..55bfa8244d3
--- /dev/null
+++ b/mail-mta/netqmail/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>qmail</herd>
+ <use>
+ <flag name="authcram">Enable AUTHCRAM support</flag>
+ <flag name="gencertdaily">Generate SSL certificates daily instead of
+ hourly</flag>
+ <flag name="highvolume">Prepare netqmail for high volume servers</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">qmail-spp</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/mail-mta/netqmail/netqmail-1.06-r1.ebuild b/mail-mta/netqmail/netqmail-1.06-r1.ebuild
new file mode 100644
index 00000000000..ad69abadb77
--- /dev/null
+++ b/mail-mta/netqmail/netqmail-1.06-r1.ebuild
@@ -0,0 +1,162 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+GENQMAIL_PV=20080406
+QMAIL_SPP_PV=0.42
+
+QMAIL_TLS_PV=20070417
+QMAIL_TLS_F=${PN}-1.05-tls-smtpauth-${QMAIL_TLS_PV}.patch
+
+QMAIL_BIGTODO_PV=103
+QMAIL_BIGTODO_F=big-todo.${QMAIL_BIGTODO_PV}.patch
+
+QMAIL_LARGE_DNS='qmail-103.patch'
+
+inherit eutils qmail
+
+DESCRIPTION="qmail -- a secure, reliable, efficient, simple message transfer agent"
+HOMEPAGE="
+ http://netqmail.org
+ http://cr.yp.to/qmail.html
+ http://qmail.org
+"
+SRC_URI="mirror://qmail/${P}.tar.gz
+ http://dev.gentoo.org/~hollow/distfiles/${GENQMAIL_F}
+ http://www.ckdhr.com/ckd/${QMAIL_LARGE_DNS}
+ !vanilla? (
+ highvolume? ( mirror://qmail/${QMAIL_BIGTODO_F} )
+ qmail-spp? ( mirror://sourceforge/qmail-spp/${QMAIL_SPP_F} )
+ ssl? ( http://shupp.org/patches/${QMAIL_TLS_F} )
+ )
+"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="authcram gencertdaily highvolume qmail-spp ssl vanilla"
+REQUIRED_USE='vanilla? ( !ssl !qmail-spp !highvolume )'
+RESTRICT="test"
+
+DEPEND="
+ !mail-mta/qmail
+ net-mail/queue-repair
+ ssl? ( dev-libs/openssl )
+"
+RDEPEND="
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ >=sys-apps/ucspi-tcp-0.88-r17
+ ssl? ( >=sys-apps/ucspi-ssl-0.70-r1 )
+ virtual/daemontools
+ >=net-mail/dot-forward-0.71-r3
+ virtual/checkpassword
+ authcram? ( >=net-mail/cmd5checkpw-0.30 )
+ ${DEPEND}
+"
+
+pkg_setup() {
+ if [[ -n "${QMAIL_PATCH_DIR}" ]]; then
+ eerror
+ eerror "The QMAIL_PATCH_DIR variable for custom patches"
+ eerror "has been removed from ${PN}. If you need custom patches"
+ eerror "you should create a copy of this ebuild in an overlay."
+ eerror
+ die "QMAIL_PATCH_DIR is not supported anymore"
+ fi
+
+ qmail_create_users
+}
+
+src_unpack() {
+ genqmail_src_unpack
+ use qmail-spp && qmail_spp_src_unpack
+
+ unpack ${P}.tar.gz
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PV}-exit.patch
+ epatch "${FILESDIR}"/${PV}-readwrite.patch
+ epatch "${DISTDIR}"/${QMAIL_LARGE_DNS}
+
+ ht_fix_file Makefile*
+
+ if ! use vanilla; then
+ # This patch contains relative paths and needs to be cleaned up.
+ sed 's~^--- ../../~--- ~g' \
+ <"${DISTDIR}"/${QMAIL_TLS_F} \
+ >"${T}"/${QMAIL_TLS_F}
+ use ssl && epatch "${T}"/${QMAIL_TLS_F}
+ use highvolume && epatch "${DISTDIR}"/${QMAIL_BIGTODO_F}
+
+ if use qmail-spp; then
+ if use ssl; then
+ epatch "${QMAIL_SPP_S}"/qmail-spp-smtpauth-tls-20060105.diff
+ else
+ epatch "${QMAIL_SPP_S}"/netqmail-spp.diff
+ fi
+ fi
+ fi
+
+ qmail_src_postunpack
+
+ # Fix bug #33818 but for netqmail (Bug 137015)
+ if ! use authcram; then
+ einfo "Disabled CRAM_MD5 support"
+ sed -e 's,^#define CRAM_MD5$,/*&*/,' -i "${S}"/qmail-smtpd.c
+ else
+ einfo "Enabled CRAM_MD5 support"
+ fi
+}
+
+src_compile() {
+ qmail_src_compile
+ use qmail-spp && qmail_spp_src_compile
+}
+
+src_install() {
+ qmail_src_install
+}
+
+pkg_postinst() {
+ qmail_queue_setup
+ qmail_rootmail_fixup
+ qmail_tcprules_build
+
+ qmail_config_notice
+ qmail_supervise_config_notice
+ elog
+ elog "If you are looking for documentation, check those links:"
+ elog "http://www.gentoo.org/doc/en/qmail-howto.xml"
+ elog " -- qmail/vpopmail Virtual Mail Hosting System Guide"
+ elog "http://www.lifewithqmail.com/"
+ elog " -- Life with qmail"
+ elog
+}
+
+pkg_preinst() {
+ qmail_tcprules_fixup
+}
+
+pkg_config() {
+ # avoid some weird locale problems
+ export LC_ALL=C
+
+ qmail_config_fast
+ qmail_tcprules_config
+ qmail_tcprules_build
+
+ use ssl && qmail_ssl_generate
+}
diff --git a/mail-mta/netqmail/netqmail-1.06-r2.ebuild b/mail-mta/netqmail/netqmail-1.06-r2.ebuild
new file mode 100644
index 00000000000..eb638cf227e
--- /dev/null
+++ b/mail-mta/netqmail/netqmail-1.06-r2.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+GENQMAIL_PV=20080406
+QMAIL_SPP_PV=0.42
+
+QMAIL_TLS_PV=20070417
+QMAIL_TLS_F=${PN}-1.05-tls-smtpauth-${QMAIL_TLS_PV}.patch
+QMAIL_TLS_CVE=vu555316.patch
+
+QMAIL_BIGTODO_PV=103
+QMAIL_BIGTODO_F=big-todo.${QMAIL_BIGTODO_PV}.patch
+
+QMAIL_LARGE_DNS='qmail-103.patch'
+
+inherit eutils qmail
+
+DESCRIPTION="qmail -- a secure, reliable, efficient, simple message transfer agent"
+HOMEPAGE="
+ http://netqmail.org
+ http://cr.yp.to/qmail.html
+ http://qmail.org
+"
+SRC_URI="mirror://qmail/${P}.tar.gz
+ http://dev.gentoo.org/~hollow/distfiles/${GENQMAIL_F}
+ http://www.ckdhr.com/ckd/${QMAIL_LARGE_DNS}
+ http://inoa.net/qmail-tls/${QMAIL_TLS_CVE}
+ !vanilla? (
+ highvolume? ( mirror://qmail/${QMAIL_BIGTODO_F} )
+ qmail-spp? ( mirror://sourceforge/qmail-spp/${QMAIL_SPP_F} )
+ ssl? ( http://shupp.org/patches/${QMAIL_TLS_F} )
+ )
+"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="authcram gencertdaily highvolume qmail-spp ssl vanilla"
+REQUIRED_USE='vanilla? ( !ssl !qmail-spp !highvolume )'
+RESTRICT="test"
+
+DEPEND="
+ !mail-mta/qmail
+ net-mail/queue-repair
+ ssl? ( dev-libs/openssl )
+ sys-apps/groff
+"
+RDEPEND="
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ >=sys-apps/ucspi-tcp-0.88-r17
+ ssl? ( >=sys-apps/ucspi-ssl-0.70-r1 )
+ virtual/daemontools
+ >=net-mail/dot-forward-0.71-r3
+ virtual/checkpassword
+ authcram? ( >=net-mail/cmd5checkpw-0.30 )
+ ${DEPEND}
+"
+
+pkg_setup() {
+ if [[ -n "${QMAIL_PATCH_DIR}" ]]; then
+ eerror
+ eerror "The QMAIL_PATCH_DIR variable for custom patches"
+ eerror "has been removed from ${PN}. If you need custom patches"
+ eerror "you should create a copy of this ebuild in an overlay."
+ eerror
+ die "QMAIL_PATCH_DIR is not supported anymore"
+ fi
+
+ qmail_create_users
+}
+
+src_unpack() {
+ genqmail_src_unpack
+ use qmail-spp && qmail_spp_src_unpack
+
+ unpack ${P}.tar.gz
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PV}-exit.patch
+ epatch "${FILESDIR}"/${PV}-readwrite.patch
+ epatch "${DISTDIR}"/${QMAIL_LARGE_DNS}
+ epatch "${FILESDIR}"/${PV}-fbsd-utmpx.patch
+
+ ht_fix_file Makefile*
+
+ if ! use vanilla; then
+ # This patch contains relative paths and needs to be cleaned up.
+ sed 's~^--- ../../~--- ~g' \
+ <"${DISTDIR}"/${QMAIL_TLS_F} \
+ >"${T}"/${QMAIL_TLS_F}
+ use ssl && epatch "${T}"/${QMAIL_TLS_F}
+ use ssl && epatch "${DISTDIR}"/${QMAIL_TLS_CVE}
+ use highvolume && epatch "${DISTDIR}"/${QMAIL_BIGTODO_F}
+
+ if use qmail-spp; then
+ if use ssl; then
+ epatch "${QMAIL_SPP_S}"/qmail-spp-smtpauth-tls-20060105.diff
+ else
+ epatch "${QMAIL_SPP_S}"/netqmail-spp.diff
+ fi
+ cd "${WORKDIR}"
+ epatch "${FILESDIR}"/genqmail-20080406-ldflags.patch
+ cd -
+ fi
+ fi
+
+ qmail_src_postunpack
+
+ # Fix bug #33818 but for netqmail (Bug 137015)
+ if ! use authcram; then
+ einfo "Disabled CRAM_MD5 support"
+ sed -e 's,^#define CRAM_MD5$,/*&*/,' -i "${S}"/qmail-smtpd.c
+ else
+ einfo "Enabled CRAM_MD5 support"
+ fi
+}
+
+src_compile() {
+ qmail_src_compile
+ use qmail-spp && qmail_spp_src_compile
+}
+
+src_install() {
+ qmail_src_install
+}
+
+pkg_postinst() {
+ qmail_queue_setup
+ qmail_rootmail_fixup
+ qmail_tcprules_build
+
+ qmail_config_notice
+ qmail_supervise_config_notice
+ elog
+ elog "If you are looking for documentation, check those links:"
+ elog "http://www.gentoo.org/doc/en/qmail-howto.xml"
+ elog " -- qmail/vpopmail Virtual Mail Hosting System Guide"
+ elog "http://www.lifewithqmail.com/"
+ elog " -- Life with qmail"
+ elog
+}
+
+pkg_preinst() {
+ qmail_tcprules_fixup
+}
+
+pkg_config() {
+ # avoid some weird locale problems
+ export LC_ALL=C
+
+ qmail_config_fast
+ qmail_tcprules_config
+ qmail_tcprules_build
+
+ use ssl && qmail_ssl_generate
+}
diff --git a/mail-mta/netqmail/netqmail-1.06.ebuild b/mail-mta/netqmail/netqmail-1.06.ebuild
new file mode 100644
index 00000000000..aad54033e4d
--- /dev/null
+++ b/mail-mta/netqmail/netqmail-1.06.ebuild
@@ -0,0 +1,149 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+GENQMAIL_PV=20080406
+QMAIL_SPP_PV=0.42
+
+QMAIL_TLS_PV=20070417
+QMAIL_TLS_F=${PN}-1.05-tls-smtpauth-${QMAIL_TLS_PV}.patch
+
+QMAIL_BIGTODO_PV=103
+QMAIL_BIGTODO_F=big-todo.${QMAIL_BIGTODO_PV}.patch
+
+inherit eutils qmail
+
+DESCRIPTION="qmail -- a secure, reliable, efficient, simple message transfer agent"
+HOMEPAGE="
+ http://netqmail.org
+ http://cr.yp.to/qmail.html
+ http://qmail.org
+"
+SRC_URI="mirror://qmail/${P}.tar.gz
+ http://dev.gentoo.org/~hollow/distfiles/${GENQMAIL_F}
+ !vanilla? (
+ highvolume? ( mirror://qmail/${QMAIL_BIGTODO_F} )
+ qmail-spp? ( mirror://sourceforge/qmail-spp/${QMAIL_SPP_F} )
+ ssl? ( http://shupp.org/patches/${QMAIL_TLS_F} )
+ )
+"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="authcram gencertdaily highvolume qmail-spp ssl vanilla"
+RESTRICT="test"
+
+DEPEND="
+ !mail-mta/qmail
+ net-mail/queue-repair
+ ssl? ( dev-libs/openssl )
+"
+RDEPEND="
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp
+ >=sys-apps/ucspi-tcp-0.88-r17
+ ssl? ( >=sys-apps/ucspi-ssl-0.70-r1 )
+ virtual/daemontools
+ >=net-mail/dot-forward-0.71-r3
+ virtual/checkpassword
+ authcram? ( >=net-mail/cmd5checkpw-0.30 )
+ ${DEPEND}
+"
+
+pkg_setup() {
+ if [[ -n "${QMAIL_PATCH_DIR}" ]]; then
+ eerror
+ eerror "The QMAIL_PATCH_DIR variable for custom patches"
+ eerror "has been removed from ${PN}. If you need custom patches"
+ eerror "you should create a copy of this ebuild in an overlay."
+ eerror
+ die "QMAIL_PATCH_DIR is not supported anymore"
+ fi
+
+ qmail_create_users
+}
+
+src_unpack() {
+ genqmail_src_unpack
+ use qmail-spp && qmail_spp_src_unpack
+
+ unpack ${P}.tar.gz
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${PV}-exit.patch
+ epatch "${FILESDIR}"/${PV}-readwrite.patch
+
+ ht_fix_file Makefile*
+
+ if ! use vanilla; then
+ use ssl && epatch "${DISTDIR}"/${QMAIL_TLS_F}
+ use highvolume && epatch "${DISTDIR}"/${QMAIL_BIGTODO_F}
+
+ if use qmail-spp; then
+ if use ssl; then
+ epatch "${QMAIL_SPP_S}"/qmail-spp-smtpauth-tls-20060105.diff
+ else
+ epatch "${QMAIL_SPP_S}"/netqmail-spp.diff
+ fi
+ fi
+ fi
+
+ qmail_src_postunpack
+
+ # Fix bug #33818 but for netqmail (Bug 137015)
+ if ! use authcram; then
+ einfo "Disabled CRAM_MD5 support"
+ sed -e 's,^#define CRAM_MD5$,/*&*/,' -i "${S}"/qmail-smtpd.c
+ else
+ einfo "Enabled CRAM_MD5 support"
+ fi
+}
+
+src_compile() {
+ qmail_src_compile
+ use qmail-spp && qmail_spp_src_compile
+}
+
+src_install() {
+ qmail_src_install
+}
+
+pkg_postinst() {
+ qmail_queue_setup
+ qmail_rootmail_fixup
+ qmail_tcprules_build
+
+ qmail_config_notice
+ qmail_supervise_config_notice
+ elog
+ elog "If you are looking for documentation, check those links:"
+ elog "http://www.gentoo.org/doc/en/qmail-howto.xml"
+ elog " -- qmail/vpopmail Virtual Mail Hosting System Guide"
+ elog "http://www.lifewithqmail.com/"
+ elog " -- Life with qmail"
+ elog
+}
+
+pkg_preinst() {
+ qmail_tcprules_fixup
+}
+
+pkg_config() {
+ # avoid some weird locale problems
+ export LC_ALL=C
+
+ qmail_config_fast
+ qmail_tcprules_config
+ qmail_tcprules_build
+
+ use ssl && qmail_ssl_generate
+}
diff --git a/mail-mta/nullmailer/Manifest b/mail-mta/nullmailer/Manifest
new file mode 100644
index 00000000000..dab1022b886
--- /dev/null
+++ b/mail-mta/nullmailer/Manifest
@@ -0,0 +1,2 @@
+DIST nullmailer-1.13.tar.gz 205431 SHA256 3f8861ebb1b46cea0a1caf1e6236e1e0d2a5a91def19551b7cad12eab676277d SHA512 96dcb3ddecde77a73e5ca1afa5167d35f965d04999f02cc2ef60b54ea7eb7a006e5cf5678fc34a54d4be4f9fd71bd0f784a8671aca40c70dbc307666c548e1d7 WHIRLPOOL b041f7cc33a257fad11c5f4c9bf74f8d849d9c45f0dc19be28268462b9d029c07e1d5802698e647a4208d5f66cac2177a1d12e49a03caac51e0244c3f9a0599c
+DIST nullmailer-patches-1.13.tar.xz 8384 SHA256 8685dfbf23e9dc15269b1a0d14f700c4ef990cf49d4e6e830c0217289e8f4733 SHA512 393531e39a92b0978bccbcdf123e05b2cdad1ec8e600825cc24177ba414c1f615995c0344291ebb664f42b384a160c0359fec5ba3308cc14cbc9ceb8577d799c WHIRLPOOL 84f523be7963ceb7fbafd3f5632571e7bc12085b1b4bce5bb5c63871fd6c7ed1367a49ddf5ed66acad7055e28856b23fb1dcb59e60158fed26447128edd0a4fa
diff --git a/mail-mta/nullmailer/files/init.d-nullmailer-r4 b/mail-mta/nullmailer/files/init.d-nullmailer-r4
new file mode 100644
index 00000000000..a46948b5fcc
--- /dev/null
+++ b/mail-mta/nullmailer/files/init.d-nullmailer-r4
@@ -0,0 +1,51 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Id$
+
+command="/usr/sbin/nullmailer-send"
+
+start_stop_daemon_args="--chdir /var/nullmailer --user nullmail:nullmail"
+
+required_dirs="/var/nullmailer"
+pidfile="/run/nullmailer.pid"
+command_background="true"
+command_args="-s"
+
+depend() {
+ use net logger
+}
+
+checkconfig() {
+ local error=0
+ local f=/etc/nullmailer/me
+ if [ ! -s ${f} ]; then
+ eerror "${f} does not exist"
+ error=1
+ fi
+ f=/etc/nullmailer/defaultdomain
+ if [ ! -s ${f} ]; then
+ eerror "${f} does not exist"
+ error=1
+ fi
+ if [ ${error} -eq 1 ]; then
+ einfo "You need to run 'emerge --config nullmailer'!"
+ fi
+ if [ -e /service/nullmailer ]; then
+ eerror "Nullmailer is already running under svscan!"
+ error=2
+ fi
+ if [ ${error} -ne 0 ]; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+start_pre() {
+ checkconfig
+}
+
+stop_pre() {
+ checkconfig # to avoid init.d stopping svscan instance
+}
diff --git a/mail-mta/nullmailer/files/nullmailer-1.13-unistd.h.patch b/mail-mta/nullmailer/files/nullmailer-1.13-unistd.h.patch
new file mode 100644
index 00000000000..8199b9627f4
--- /dev/null
+++ b/mail-mta/nullmailer/files/nullmailer-1.13-unistd.h.patch
@@ -0,0 +1,28 @@
+From 5e9316c669e752fcd9058b28952919bccd967640 Mon Sep 17 00:00:00 2001
+From: "Anthony G. Basile" <blueness@gentoo.org>
+Date: Sat, 31 Jan 2015 23:55:48 +0000
+Subject: [PATCH] lib/fdbuf/fdbuf.h: include <unistd.h>
+
+class fdobuf in lib/fdbuf/fdobuf.h makes use of uid_t and gid_t,
+but these are defined in <unistd.h> according to POSIX. With libc's
+that adhere strictly to standards, like musl, this breaks the build.
+
+We add <unistd.h> to fdbuf.h which is included by fdbuf.h.
+
+Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
+---
+ lib/fdbuf/fdbuf.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/lib/fdbuf/fdbuf.h b/lib/fdbuf/fdbuf.h
+index 4b0e9cb..0054b01 100644
+--- a/lib/fdbuf/fdbuf.h
++++ b/lib/fdbuf/fdbuf.h
+@@ -20,6 +20,7 @@
+ #include "config.h"
+ #include <string.h>
+ #include <fcntl.h>
++#include <unistd.h>
+
+ #ifdef _REENTRANT
+ #include <pthread.h>
diff --git a/mail-mta/nullmailer/files/nullmailer.service b/mail-mta/nullmailer/files/nullmailer.service
new file mode 100644
index 00000000000..8aae6c996d1
--- /dev/null
+++ b/mail-mta/nullmailer/files/nullmailer.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Nullmailer relay-only MTA
+Requires=network.target
+After=local-fs.target syslog.target
+ConditionPathExists=/var/nullmailer/queue
+ConditionPathExists=/etc/nullmailer/defaultdomain
+ConditionPathExists=/etc/nullmailer/me
+
+[Service]
+WorkingDirectory=/var/nullmailer
+ExecStart=/usr/sbin/nullmailer-send -s
+User=nullmail
+Group=nullmail
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mail-mta/nullmailer/files/remotes.sample-1.13 b/mail-mta/nullmailer/files/remotes.sample-1.13
new file mode 100644
index 00000000000..34cc234a27e
--- /dev/null
+++ b/mail-mta/nullmailer/files/remotes.sample-1.13
@@ -0,0 +1,29 @@
+# Format is: HOST PROTOCOL [OPTIONS]
+# HOST = IP or DNS
+# PROTOCOL = smtp | qmtp
+# OPTIONS = [--port=NUMBER] [--user] [--pass] [--starttls | --ssl [--insecure] ]
+#
+# Examples:
+# A standard SMTP server:
+# somesendmailserver.domain.com smtp
+#
+# A qmail server with QMQP setup:
+# someqmailserver.domain.com qmqp
+#
+# A nonstandard SMTP server setup:
+# someotherserver.domain.com smtp --port=2525
+#
+# SMTP server supporting AUTH PLAIN
+# mailserver smtp --user=<user> --pass=<pass>
+#
+# SMTP server supporting AUTH LOGIN
+# mailserver smtp --user=<user> --pass=<pass> --auth-login
+#
+# SMTP server with smtps (legacy - use starttls instead)
+# mailserver smtp --user=<user> --pass=<pass> --port=465 --ssl
+#
+# SMTP server on submission port with starttls
+# mailserver smtp --user=<user> --pass=<pass> --port=587 --starttls
+#
+# SMTP server on submission port with starttls and self-signed certificate
+# mailserver smtp --user=<user> --pass=<pass> --port=587 --starttls --insecure
diff --git a/mail-mta/nullmailer/metadata.xml b/mail-mta/nullmailer/metadata.xml
new file mode 100644
index 00000000000..c20ce93ed71
--- /dev/null
+++ b/mail-mta/nullmailer/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-mail</herd>
+ <maintainer>
+ <email>robbat2@gentoo.org</email>
+ <name>Robin H. Johnson</name>
+ </maintainer>
+ <maintainer>
+ <email>jlec@gentoo.org</email>
+ <name>Justin Lecher</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/mail-mta/nullmailer/nullmailer-1.13-r5.ebuild b/mail-mta/nullmailer/nullmailer-1.13-r5.ebuild
new file mode 100644
index 00000000000..e2801de6682
--- /dev/null
+++ b/mail-mta/nullmailer/nullmailer-1.13-r5.ebuild
@@ -0,0 +1,168 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils flag-o-matic multilib systemd user
+
+MY_P="${P/_rc/RC}"
+
+DEBIAN_PV=1.11
+DEBIAN_PR="2"
+DEBIAN_P="${PN}-${DEBIAN_PV}"
+DEBIAN_PF="${DEBIAN_P/-/_}-${DEBIAN_PR}"
+DEBIAN_SRC="${DEBIAN_PF}.debian.tar.gz"
+
+DESCRIPTION="Simple relay-only local mail transport agent"
+HOMEPAGE="http://untroubled.org/nullmailer/"
+SRC_URI="
+ http://untroubled.org/${PN}/archive/${MY_P}.tar.gz
+ http://dev.gentoo.org/~jlec/distfiles/${PN}-patches-${PV}.tar.xz"
+# mirror://debian/pool/main/n/${PN}/${DEBIAN_SRC}"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="amd64 ppc x86"
+IUSE="ssl"
+
+DEPEND="
+ sys-apps/groff
+ ssl? ( net-libs/gnutls )"
+RDEPEND="
+ virtual/logger
+ virtual/shadow
+ ssl? ( net-libs/gnutls )
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !mail-mta/ssmtp"
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+ enewgroup nullmail 88
+ enewuser nullmail 88 -1 /var/nullmailer nullmail
+}
+
+src_prepare() {
+# sed -i -e 's/nullmailer-1.10/nullmailer-1.11/g' \
+# "${WORKDIR}"/debian/patches/*.diff || die
+# EPATCH_OPTS="-d ${S} -p1" \
+# epatch "${DISTDIR}"/${DEBIAN_SRC}
+ # why revert? Ask Robin when he is back!
+# EPATCH_OPTS="-d ${WORKDIR} -p0 -R" \
+# epatch "${WORKDIR}"/debian/patches/02_ipv6.diff
+ # this fixes the debian daemon/syslog to actually compile
+
+ # old debian patches from 1.11
+ # DO NOT APPLY patch 0009... It breaks
+ epatch "${WORKDIR}"/patches/000{1..8}*patch
+
+ epatch "${FILESDIR}"/${P}-unistd.h.patch
+
+ sed -i.orig \
+ -e '/^nullmailer_send_LDADD/s, =, = ../lib/cli++/libcli++.a,' \
+ "${S}"/src/Makefile.am || die "Sed failed"
+ sed -i.orig \
+ -e '/\$(localstatedir)\/trigger/d' \
+ "${S}"/Makefile.am || die "Sed failed"
+ sed \
+ -e "s:^AC_PROG_RANLIB:AC_CHECK_TOOL(AR, ar, false)\nAC_PROG_RANLIB:g" \
+ -i configure.in || die
+ sed -e "s/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/" -i configure.in || die
+ eautoreconf
+}
+
+src_configure() {
+ # Note that we pass a different directory below due to bugs in the makefile!
+ econf \
+ --localstatedir=/var \
+ $(use_enable ssl tls)
+}
+
+src_install () {
+ emake DESTDIR="${D}" localstatedir=/var/nullmailer install
+
+ dodoc AUTHORS BUGS HOWTO INSTALL ChangeLog NEWS README TODO
+
+ # A small bit of sample config
+ insinto /etc/nullmailer
+ newins "${FILESDIR}"/remotes.sample-${PV} remotes
+
+ # This contains passwords, so should be secure
+ fperms 0640 /etc/nullmailer/remotes
+ fowners root:nullmail /etc/nullmailer/remotes
+
+ # daemontools stuff
+ dodir /var/nullmailer/service{,/log}
+
+ insinto /var/nullmailer/service
+ newins scripts/nullmailer.run run
+ fperms 700 /var/nullmailer/service/run
+
+ insinto /var/nullmailer/service/log
+ newins scripts/nullmailer-log.run run
+ fperms 700 /var/nullmailer/service/log/run
+
+ # usability
+ dosym /usr/sbin/sendmail usr/$(get_libdir)/sendmail
+
+ # permissions stuff
+ keepdir /var/log/nullmailer /var/nullmailer/{tmp,queue}
+ fperms 770 /var/log/nullmailer /var/nullmailer/{tmp,queue}
+ fowners nullmail:nullmail /usr/sbin/nullmailer-queue /usr/bin/mailq
+ fperms 4711 /usr/sbin/nullmailer-queue /usr/bin/mailq
+
+ newinitd "${FILESDIR}"/init.d-nullmailer-r4 nullmailer
+ systemd_dounit "${FILESDIR}"/${PN}.service
+}
+
+pkg_postinst() {
+ if [ ! -e "${ROOT}"/var/nullmailer/trigger ]; then
+ mkfifo "${ROOT}"/var/nullmailer/trigger
+ fi
+ chown nullmail:nullmail \
+ "${ROOT}"/var/log/nullmailer "${ROOT}"/var/nullmailer/{tmp,queue,trigger} || die
+ chmod 770 "${ROOT}"/var/log/nullmailer "${ROOT}"/var/nullmailer/{tmp,queue} || die
+ chmod 660 "${ROOT}"/var/nullmailer/trigger || die
+
+ # This contains passwords, so should be secure
+ chmod 0640 "${ROOT}"/etc/nullmailer/remotes || die
+ chown root:nullmail "${ROOT}"/etc/nullmailer/remotes || die
+
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ elog "To create an initial setup, please do:"
+ elog "emerge --config =${CATEGORY}/${PF}"
+ fi
+ #echo
+ #elog "To start nullmailer at boot you may use either the nullmailer init.d"
+ #elog "script, or emerge sys-process/supervise-scripts, enable the"
+ #elog "svscan init.d script and create the following link:"
+ #elog "ln -fs /var/nullmailer/service /service/nullmailer"
+ #echo
+}
+
+pkg_postrm() {
+ if [[ -e "${ROOT}"/var/nullmailer/trigger ]]; then
+ rm "${ROOT}"/var/nullmailer/trigger || die
+ fi
+}
+
+pkg_config() {
+ if [ ! -s "${ROOT}"/etc/nullmailer/me ]; then
+ einfo "Setting /etc/nullmailer/me"
+ /bin/hostname --fqdn > "${ROOT}"/etc/nullmailer/me
+ fi
+ if [ ! -s "${ROOT}"/etc/nullmailer/defaultdomain ]; then
+ einfo "Setting /etc/nullmailer/defaultdomain"
+ /bin/hostname --domain > "${ROOT}"/etc/nullmailer/defaultdomain
+ fi
+}
diff --git a/mail-mta/opensmtpd/Manifest b/mail-mta/opensmtpd/Manifest
new file mode 100644
index 00000000000..b4fce70c880
--- /dev/null
+++ b/mail-mta/opensmtpd/Manifest
@@ -0,0 +1,2 @@
+DIST opensmtpd-201506112227p1.tar.gz 706259 SHA256 f938796d2655f554e695adff6a3f3bbc4b1326912327b98acc7e29f705b9cf63 SHA512 f1724c1f2233dc43f4e5db780e12cfbaa7237dfbd0f70b30237c5d7bf2eed370ef6ed1f3d674473fc34d42fca6bb13e3d1152f29d16e29c7c9f86db6071713fb WHIRLPOOL f7454975f256ef50d085774516805227c1dfc4129e57290dca4cb8484fd0b8e6df45a74c6f5c9704461d5f558f50cf3795700313d6394f8d9b61fe95dd8b692b
+DIST opensmtpd-5.7.1p1.tar.gz 708295 SHA256 67e9dd9682ca8c181e84e66c76245a4a8f6205834f915a2c021cdfeb22049e3a SHA512 df09c980b25a6e91a62f6de83b18e376f6c81a5bf0039fa91da90b2fe4d67bf4bc2dc6787b2d9aca0eb859cc149f980dd9c342516af5262231c97b133f804c1a WHIRLPOOL f864ceafcc323ef61faeeb379e696ea740e39761153fda28f03805fd6c3c3c41d4c61108bbe62fcb81afd2794f32b4deef094337536feecab6bc9cb717016f0a
diff --git a/mail-mta/opensmtpd/files/smtpd.initd b/mail-mta/opensmtpd/files/smtpd.initd
new file mode 100644
index 00000000000..995d36ed81e
--- /dev/null
+++ b/mail-mta/opensmtpd/files/smtpd.initd
@@ -0,0 +1,17 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+command="smtpd"
+start_stop_daemon_args="--pidfile=/run/smtpd.pid"
+description="SMTP daemon from OpenBSD"
+
+depend() {
+ need net
+}
+stop() {
+ ebegin "Stopping smtpd"
+ smtpctl stop
+ eend $?
+}
diff --git a/mail-mta/opensmtpd/files/smtpd.pam b/mail-mta/opensmtpd/files/smtpd.pam
new file mode 100644
index 00000000000..a85aeae1e8b
--- /dev/null
+++ b/mail-mta/opensmtpd/files/smtpd.pam
@@ -0,0 +1,4 @@
+auth required pam_nologin.so
+auth include system-auth
+account include system-auth
+session include system-auth
diff --git a/mail-mta/opensmtpd/files/smtpd.service b/mail-mta/opensmtpd/files/smtpd.service
new file mode 100644
index 00000000000..fd2a6501060
--- /dev/null
+++ b/mail-mta/opensmtpd/files/smtpd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=OpenSMTPD
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/smtpd
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mail-mta/opensmtpd/files/smtpd.socket b/mail-mta/opensmtpd/files/smtpd.socket
new file mode 100644
index 00000000000..fb42f855732
--- /dev/null
+++ b/mail-mta/opensmtpd/files/smtpd.socket
@@ -0,0 +1,8 @@
+[Unit]
+Description=OpenSMTPD Socket
+
+[Socket]
+ListenStream=/var/run/smtpd.sock
+
+[Install]
+WantedBy=sockets.target
diff --git a/mail-mta/opensmtpd/metadata.xml b/mail-mta/opensmtpd/metadata.xml
new file mode 100644
index 00000000000..23ffebf2e96
--- /dev/null
+++ b/mail-mta/opensmtpd/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<longdescription lang="en">
+OpenSMTPD is an implementation of the server-side SMTP protocol as defined by RFC 5321, with some additional standard extensions. It allows ordinary machines to exchange e-mails with other systems speaking the SMTP protocol.
+</longdescription>
+<maintainer>
+<email>zx2c4@gentoo.org</email>
+<name>Jason A. Donenfeld</name>
+</maintainer>
+<use>
+<flag name='mta'>Enable this to install as system-wide MTA</flag>
+</use>
+</pkgmetadata>
+
diff --git a/mail-mta/opensmtpd/opensmtpd-5.4.6.201506112227_p1.ebuild b/mail-mta/opensmtpd/opensmtpd-5.4.6.201506112227_p1.ebuild
new file mode 100644
index 00000000000..7b2cdccf3d6
--- /dev/null
+++ b/mail-mta/opensmtpd/opensmtpd-5.4.6.201506112227_p1.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit multilib user flag-o-matic eutils pam toolchain-funcs autotools systemd versionator
+
+DESCRIPTION="Lightweight but featured SMTP daemon from OpenBSD"
+HOMEPAGE="http://www.opensmtpd.org/"
+MY_P="${P}"
+if [ $(get_last_version_component_index) -eq 4 ]; then
+ MY_P="${PN}-$(get_version_component_range 4-)"
+fi
+SRC_URI="https://www.opensmtpd.org/archives/${MY_P/_}.tar.gz"
+
+LICENSE="ISC BSD BSD-1 BSD-2 BSD-4"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="pam +mta"
+
+DEPEND="dev-libs/openssl
+ sys-libs/zlib
+ pam? ( virtual/pam )
+ sys-libs/db
+ dev-libs/libevent
+ app-misc/ca-certificates
+ net-mail/mailbase
+ net-libs/libasr
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp[mta]
+"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${MY_P/_}
+
+src_prepare() {
+ epatch_user
+ eautoreconf
+}
+
+src_configure() {
+ tc-export AR
+ AR="$(which "$AR")" econf \
+ --with-privsep-user=smtpd \
+ --with-queue-user=smtpq \
+ --with-privsep-path=/var/empty \
+ --with-sock-dir=/var/run \
+ --sysconfdir=/etc/opensmtpd \
+ --with-ca-file=/etc/ssl/certs/ca-certificates.crt \
+ $(use_with pam)
+}
+
+src_install() {
+ default
+ newinitd "${FILESDIR}"/smtpd.initd smtpd
+ systemd_dounit "${FILESDIR}"/smtpd.{service,socket}
+ use pam && newpamd "${FILESDIR}"/smtpd.pam smtpd
+ if use mta ; then
+ dodir /usr/sbin
+ dosym /usr/sbin/smtpctl /usr/sbin/sendmail
+ dosym /usr/sbin/smtpctl /usr/bin/sendmail
+ dosym /usr/sbin/smtpctl /usr/$(get_libdir)/sendmail
+ fi
+}
+
+pkg_preinst() {
+ enewgroup smtpd 25
+ enewuser smtpd 25 -1 /var/empty smtpd
+ enewgroup smtpq 252
+ enewuser smtpq 252 -1 /var/empty smtpq
+}
+
+pkg_postinst() {
+ einfo
+ einfo "Plugins for SQLite, MySQL, PostgreSQL, LDAP, socketmaps,"
+ einfo "Redis, and many other useful addons and filters are"
+ einfo "available in the mail-filter/opensmtpd-extras package."
+ einfo
+}
diff --git a/mail-mta/opensmtpd/opensmtpd-5.7.1_p1-r1.ebuild b/mail-mta/opensmtpd/opensmtpd-5.7.1_p1-r1.ebuild
new file mode 100644
index 00000000000..fe35e0f7025
--- /dev/null
+++ b/mail-mta/opensmtpd/opensmtpd-5.7.1_p1-r1.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit multilib user flag-o-matic eutils pam toolchain-funcs autotools systemd versionator
+
+DESCRIPTION="Lightweight but featured SMTP daemon from OpenBSD"
+HOMEPAGE="http://www.opensmtpd.org/"
+MY_P="${P}"
+if [ $(get_last_version_component_index) -eq 4 ]; then
+ MY_P="${PN}-$(get_version_component_range 4-)"
+fi
+SRC_URI="https://www.opensmtpd.org/archives/${MY_P/_}.tar.gz"
+
+LICENSE="ISC BSD BSD-1 BSD-2 BSD-4"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="pam +mta"
+
+DEPEND="dev-libs/openssl:0
+ sys-libs/zlib
+ pam? ( virtual/pam )
+ sys-libs/db:=
+ dev-libs/libevent
+ app-misc/ca-certificates
+ net-mail/mailbase
+ net-libs/libasr
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp[mta]
+"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${MY_P/_}
+
+src_prepare() {
+ # Use /run instead of /var/run
+ sed -i -e '/pidfile_path/s:_PATH_VARRUN:"/run/":' openbsd-compat/pidfile.c || die
+
+ epatch_user
+ eautoreconf
+}
+
+src_configure() {
+ tc-export AR
+ AR="$(which "$AR")" econf \
+ --enable-table-db \
+ --with-privsep-user=smtpd \
+ --with-queue-user=smtpq \
+ --with-privsep-path=/var/empty \
+ --with-sock-dir=/run \
+ --sysconfdir=/etc/opensmtpd \
+ --with-ca-file=/etc/ssl/certs/ca-certificates.crt \
+ $(use_with pam)
+}
+
+src_install() {
+ default
+ newinitd "${FILESDIR}"/smtpd.initd smtpd
+ systemd_dounit "${FILESDIR}"/smtpd.{service,socket}
+ use pam && newpamd "${FILESDIR}"/smtpd.pam smtpd
+ if use mta ; then
+ dodir /usr/sbin
+ dosym /usr/sbin/smtpctl /usr/sbin/sendmail
+ dosym /usr/sbin/smtpctl /usr/bin/sendmail
+ dosym /usr/sbin/smtpctl /usr/$(get_libdir)/sendmail
+ fi
+}
+
+pkg_preinst() {
+ enewgroup smtpd 25
+ enewuser smtpd 25 -1 /var/empty smtpd
+ enewgroup smtpq 252
+ enewuser smtpq 252 -1 /var/empty smtpq
+}
+
+pkg_postinst() {
+ einfo
+ einfo "Plugins for SQLite, MySQL, PostgreSQL, LDAP, socketmaps,"
+ einfo "Redis, and many other useful addons and filters are"
+ einfo "available in the mail-filter/opensmtpd-extras package."
+ einfo
+}
diff --git a/mail-mta/opensmtpd/opensmtpd-5.7.1_p1.ebuild b/mail-mta/opensmtpd/opensmtpd-5.7.1_p1.ebuild
new file mode 100644
index 00000000000..263925d83a6
--- /dev/null
+++ b/mail-mta/opensmtpd/opensmtpd-5.7.1_p1.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit multilib user flag-o-matic eutils pam toolchain-funcs autotools systemd versionator
+
+DESCRIPTION="Lightweight but featured SMTP daemon from OpenBSD"
+HOMEPAGE="http://www.opensmtpd.org/"
+MY_P="${P}"
+if [ $(get_last_version_component_index) -eq 4 ]; then
+ MY_P="${PN}-$(get_version_component_range 4-)"
+fi
+SRC_URI="https://www.opensmtpd.org/archives/${MY_P/_}.tar.gz"
+
+LICENSE="ISC BSD BSD-1 BSD-2 BSD-4"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="pam +mta"
+
+DEPEND="dev-libs/openssl
+ sys-libs/zlib
+ pam? ( virtual/pam )
+ sys-libs/db
+ dev-libs/libevent
+ app-misc/ca-certificates
+ net-mail/mailbase
+ net-libs/libasr
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/ssmtp[mta]
+"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${MY_P/_}
+
+src_prepare() {
+ epatch_user
+ eautoreconf
+}
+
+src_configure() {
+ tc-export AR
+ AR="$(which "$AR")" econf \
+ --with-privsep-user=smtpd \
+ --with-queue-user=smtpq \
+ --with-privsep-path=/var/empty \
+ --with-sock-dir=/var/run \
+ --sysconfdir=/etc/opensmtpd \
+ --with-ca-file=/etc/ssl/certs/ca-certificates.crt \
+ $(use_with pam)
+}
+
+src_install() {
+ default
+ newinitd "${FILESDIR}"/smtpd.initd smtpd
+ systemd_dounit "${FILESDIR}"/smtpd.{service,socket}
+ use pam && newpamd "${FILESDIR}"/smtpd.pam smtpd
+ if use mta ; then
+ dodir /usr/sbin
+ dosym /usr/sbin/smtpctl /usr/sbin/sendmail
+ dosym /usr/sbin/smtpctl /usr/bin/sendmail
+ dosym /usr/sbin/smtpctl /usr/$(get_libdir)/sendmail
+ fi
+}
+
+pkg_preinst() {
+ enewgroup smtpd 25
+ enewuser smtpd 25 -1 /var/empty smtpd
+ enewgroup smtpq 252
+ enewuser smtpq 252 -1 /var/empty smtpq
+}
+
+pkg_postinst() {
+ einfo
+ einfo "Plugins for SQLite, MySQL, PostgreSQL, LDAP, socketmaps,"
+ einfo "Redis, and many other useful addons and filters are"
+ einfo "available in the mail-filter/opensmtpd-extras package."
+ einfo
+}
diff --git a/mail-mta/postfix/Manifest b/mail-mta/postfix/Manifest
new file mode 100644
index 00000000000..b35f2e0f725
--- /dev/null
+++ b/mail-mta/postfix/Manifest
@@ -0,0 +1,7 @@
+DIST postfix-2.10.8.tar.gz 3819748 SHA256 2fb5af2f1e0add13a9b20c58f8a84c0d76a7a3aa85719cb3e580617fc14d48e6 SHA512 72984e9cf9557f2f1050e12ca7033f9dadd15ae4e7d07b49df455eff8a9d3b8ebbc1cc56013bcf2918526f7764f6d3a7cc87c268041d157138d3e255c03fe5f1 WHIRLPOOL 35db7b5c090ab9e99c96634db821be5b3f1c7578281a1bd3efa4ff2427b5d6686a9eeea3d6db59ff8832fd5ab0af51c6c151e95810730943aa3cdd93134781cf
+DIST postfix-2.11.6.tar.gz 4030414 SHA256 77f35574c78cf5ac468061c38037c4f858ead7554e2314e7760c30328f08591e SHA512 8bb318b2e2e1611b764889f2c263e24fb81dc3cb324682a0debee0d7babb85560245962da9a528b69715425a5b5f8d0402e14652b32ad99b76f2860c0110064e WHIRLPOOL ac5ebabdfcc6af0dfb6b2c5aaee45626c254bcfc401bf4a84db1c536a9316434692d3884ab46019ea841120a7d0f66c1d3008d4b03d7053d2e94b9f7793de5fc
+DIST postfix-3.0.0.tar.gz 4239248 SHA256 c2f2f10aa3e6b7090ba979e9c515e42b3140c5c1c17a33d58787569df7ae0955 SHA512 ba5b67a8f03c6fe6bbb62e2aad981a6f3ba8266ea2fa93abfa5d31cdb20b2d5a47fc373f401b247ca2cb5a19e654f86b2a65fe906c102d729e472b6c5ff1cd7a WHIRLPOOL 1510a17f3376d77eb503b3adf47639f6466a38e20a06ebf7ae0ec6849dc2ea332377c82af816f298a2719bccc4917d14132ee9e11c14cbafa3ea53ec40056f50
+DIST postfix-3.0.1.tar.gz 4265677 SHA256 cd2bd6447fe3368bb1a39f482f8dd1eec87c63067a0eb75f9aec8e4eadd21328 SHA512 17916f6dc7113589b011dbf6a6bb54cb9f6d0d5f176fb3c877d4a5a09ac62c4faf088bf1eba0b41c6d2b9d55660fd4c52d4ba2a01f82db3679322756b6da6f37 WHIRLPOOL 3e0f28350a42428b7deae460d2312c90f84f82aaa7755207e1eba04ee7c3b276eaddbd8c8b705a38923ad29625a36aa06c80849ecc9201f4aa99e44811913790
+DIST postfix-3.0.2.tar.gz 4239235 SHA256 68256314202f5f0f24022d64f7ac664d28fa1394d07c84a37c3fc7a2d040be80 SHA512 b097ff5cb1707361af568bbcf8b9d264dfefe7a9fd5c2fb4ce731a2ff6a632c3341ace43afe7f1600f2096592535cf9a300322f78c92000e752e0df7d3c39021 WHIRLPOOL 3fd230321577c0226926701a17803b038a281b46abe884899ca38ea18c5fd9c13ef90900e5fdd17db20ecf8dc63b373cb9f378f1402660be2908192900cba47a
+DIST postfix-3.1-20150721.tar.gz 4301268 SHA256 51c79e2a1da14a6c9dcf244b6053349f820a9aa76cd23f7b68bf85d74858f7b7 SHA512 1716691320f6d35031ba5db8c90ea62269b0865d523905196b077518c2976ed4c1833fd2451ff59132658e92402e044c9d0da2fdee65a70ff8b0f8caf3ad0472 WHIRLPOOL 38e4d299740e1f72f9860c92097b2e8811b789b5f4b70015a18881e40ac3751ca75d591969a56e9bab505bcb4336fdc163264803528edd91bef0d9562db425b4
+DIST postfix-vda-v13-2.10.0.patch 55701 SHA256 6208021eb0b37ac6482e334e538ed5700cc22c4d4dd66ed9e975ae5f20bf935f SHA512 0b4b53a8cd28abf56eee3b2ed63ca1814251b60816e6ca1143249d25fd6ef7f905bec3134125ac6e851af685db8aae878012113693261529ae2ddbcf1bd93e62 WHIRLPOOL d98b7d2177b8b69738086880fd08c336fa60b99ff7413624e628fd5f17be2064f2ccaa37c047d3013ed41c0ff1bcb76e7962f8390c4179f28ab11733dd3b59d3
diff --git a/mail-mta/postfix/files/postfix-2.11.1-db6.patch b/mail-mta/postfix/files/postfix-2.11.1-db6.patch
new file mode 100644
index 00000000000..5f5cad406b0
--- /dev/null
+++ b/mail-mta/postfix/files/postfix-2.11.1-db6.patch
@@ -0,0 +1,12 @@
+--- src/util/dict_db.c 2012-01-25 00:41:08.000000000 +0000
++++ src/util/dict_db.c 2014-06-25 18:56:10.000000000 +0000
+@@ -693,7 +688,8 @@
+ msg_fatal("set DB cache size %d: %m", dict_db_cache_size);
+ if (type == DB_HASH && db->set_h_nelem(db, DICT_DB_NELM) != 0)
+ msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
+-#if DB_VERSION_MAJOR == 5 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0)
++#if DB_VERSION_MAJOR == 6 || DB_VERSION_MAJOR == 5 || \
++ (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0)
+ if ((errno = db->open(db, 0, db_path, 0, type, db_flags, 0644)) != 0)
+ FREE_RETURN(dict_surrogate(class, path, open_flags, dict_flags,
+ "open database %s: %m", db_path));
diff --git a/mail-mta/postfix/files/postfix-linux4.patch b/mail-mta/postfix/files/postfix-linux4.patch
new file mode 100644
index 00000000000..a28ad52627b
--- /dev/null
+++ b/mail-mta/postfix/files/postfix-linux4.patch
@@ -0,0 +1,27 @@
+--- a/makedefs
++++ b/makedefs
+@@ -500,7 +500,12 @@ EOF
+ : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
+ : ${PLUGIN_LD="${CC-gcc} -shared"}
+ ;;
+- Linux.3*) SYSTYPE=LINUX3
++ Linux.[34]*)
++ case "$RELEASE" in
++ 3.*) SYSTYPE=LINUX3;;
++ 4.*) SYSTYPE=LINUX4;;
++ *) error "Unknown Linux version: `uname -r`.";;
++ esac
+ case "$CCARGS" in
+ *-DNO_DB*) ;;
+ *-DHAS_DB*) ;;
+--- a/src/util/sys_defs.h
++++ b/src/util/sys_defs.h
+@@ -756,7 +756,7 @@ extern int initgroups(const char *, int);
+ /*
+ * LINUX.
+ */
+-#if defined(LINUX2) || defined(LINUX3)
++#if defined(LINUX2) || defined(LINUX3) || defined(LINUX4)
+ #define SUPPORTED
+ #include <sys/types.h>
+ #define UINT32_TYPE unsigned int
diff --git a/mail-mta/postfix/files/postfix.rc6.2.7 b/mail-mta/postfix/files/postfix.rc6.2.7
new file mode 100644
index 00000000000..d37981d092a
--- /dev/null
+++ b/mail-mta/postfix/files/postfix.rc6.2.7
@@ -0,0 +1,86 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload abort flush"
+
+description_reload="Re-read configuration files. Running processes terminate at their earliest convenience."
+description_abort="Stop the Postfix mail system abruptly. Running processes are signaled to stop immediately."
+description_flush="Force delivery: attempt to deliver every message in the deferred mail queue."
+
+# Please read http://www.postfix.org/MULTI_INSTANCE_README.html for multi instance support
+CONF_DIR="/etc/postfix"
+CONF_OPT="${SVCNAME##*.}"
+if [ -n ${CONF_OPT} -a ${SVCNAME} != "postfix" ]; then
+ CONF_DIR="${CONF_DIR}.${CONF_OPT}"
+fi
+if [ "${CONF_DIR}" = "/etc/postfix" ]; then
+ CONF_PARAM=""
+ CONF_MESSAGE=""
+else
+ CONF_PARAM="-c ${CONF_DIR}"
+ CONF_MESSAGE="(${CONF_DIR})"
+fi
+
+depend() {
+ use logger dns ypbind amavisd antivirus postfix_greylist net saslauthd
+ if [ "${SVCNAME}" = "postfix" ]; then
+ provide mta
+ fi
+}
+
+start() {
+ if [ ! -z "${CONF_PARAM}" ]; then
+ einfo "Please consider updating your config for postmulti support."
+ fi
+ ebegin "Starting postfix ${CONF_MESSAGE}"
+ if [ ! -d ${CONF_DIR} ]; then
+ eend 1 "${CONF_DIR} does not exist"
+ return 1
+ fi
+ /usr/sbin/postfix ${CONF_PARAM} start >/dev/null 2>&1
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping postfix ${CONF_MESSAGE}"
+ /usr/sbin/postfix ${CONF_PARAM} stop >/dev/null 2>&1
+ eend
+}
+
+status() {
+ local _retval
+ einfon ""
+ /usr/sbin/postfix ${CONF_PARAM} status
+ _retval=$?
+ if [ x${_retval} = 'x0' ]; then
+ mark_service_started "${SVCNAME}"
+ eend 0
+ else
+ mark_service_stopped "${SVCNAME}"
+ eend 3
+ fi
+}
+
+reload() {
+ ebegin "Reloading postfix ${CONF_MESSAGE}"
+ /usr/sbin/postfix ${CONF_PARAM} reload >/dev/null 2>&1
+ eend $?
+}
+
+abort() {
+ ebegin "Aborting postfix ${CONF_MESSAGE}"
+
+ if service_started "${SVCNAME}"; then
+ mark_service_stopped "${SVCNAME}"
+ fi
+ /usr/sbin/postfix ${CONF_PARAM} abort >/dev/null 2>&1
+ eend $?
+}
+
+flush() {
+ ebegin "Flushing postfix ${CONF_MESSAGE}"
+ /usr/sbin/postfix ${CONF_PARAM} flush >/dev/null 2>&1
+ eend $?
+}
diff --git a/mail-mta/postfix/files/postfix.service b/mail-mta/postfix/files/postfix.service
new file mode 100644
index 00000000000..d3d4804138b
--- /dev/null
+++ b/mail-mta/postfix/files/postfix.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Postfix Mail Transport Agent
+After=network.target
+
+[Service]
+Type=forking
+ExecStartPre=-/usr/bin/newaliases
+ExecStart=/usr/sbin/postfix start
+ExecStop=/usr/sbin/postfix stop
+ExecReload=/usr/sbin/postfix reload
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mail-mta/postfix/files/smtp.pass b/mail-mta/postfix/files/smtp.pass
new file mode 100644
index 00000000000..cfa2d0525ae
--- /dev/null
+++ b/mail-mta/postfix/files/smtp.pass
@@ -0,0 +1,3 @@
+# $Id$
+#
+# remotehost user:password
diff --git a/mail-mta/postfix/files/smtp.sasl b/mail-mta/postfix/files/smtp.sasl
new file mode 100644
index 00000000000..e29b040c18f
--- /dev/null
+++ b/mail-mta/postfix/files/smtp.sasl
@@ -0,0 +1,3 @@
+# $Id$
+pwcheck_method:saslauthd
+mech_list: PLAIN
diff --git a/mail-mta/postfix/metadata.xml b/mail-mta/postfix/metadata.xml
new file mode 100644
index 00000000000..c942b73874e
--- /dev/null
+++ b/mail-mta/postfix/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-mail</herd>
+ <use>
+ <flag name='dovecot-sasl'>Enable <pkg>net-mail/dovecot</pkg> protocol
+ version 1 (server only) SASL implementation</flag>
+ <flag name='eai'>Add support for SMTPUTF8</flag>
+ <flag name='ldap-bind'>Add support for binding to LDAP backend
+ using <pkg>dev-libs/cyrus-sasl</pkg></flag>
+ <flag name='memcached'>Add support for using <pkg>net-misc/memcached</pkg>
+ for lookup tables</flag>
+ <flag name='lmdb'>Add support for using <pkg>dev-db/lmdb</pkg>
+ for lookup tables</flag>
+ <flag name='vda'>Add support for virtual delivery agent quota
+ enforcing</flag>
+ </use>
+</pkgmetadata>
diff --git a/mail-mta/postfix/postfix-2.10.8.ebuild b/mail-mta/postfix/postfix-2.10.8.ebuild
new file mode 100644
index 00000000000..a18ee74d5af
--- /dev/null
+++ b/mail-mta/postfix/postfix-2.10.8.ebuild
@@ -0,0 +1,315 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils multilib ssl-cert toolchain-funcs flag-o-matic pam user versionator systemd
+
+MY_PV="${PV/_pre/-}"
+MY_SRC="${PN}-${MY_PV}"
+MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official"
+VDA_PV="2.10.0"
+VDA_P="${PN}-vda-v13-${VDA_PV}"
+RC_VER="2.7"
+
+DESCRIPTION="A fast and secure drop-in replacement for sendmail"
+HOMEPAGE="http://www.postfix.org/"
+SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
+ vda? ( http://vda.sourceforge.net/VDA/${VDA_P}.patch ) "
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="~mips ~s390"
+IUSE="+berkdb cdb doc dovecot-sasl hardened ldap ldap-bind memcached mbox mysql nis pam postgres sasl selinux sqlite ssl vda"
+
+DEPEND=">=dev-libs/libpcre-3.4
+ dev-lang/perl
+ berkdb? ( >=sys-libs/db-3.2:* )
+ cdb? ( || ( >=dev-db/tinycdb-0.76 >=dev-db/cdb-0.75-r1 ) )
+ ldap? ( net-nds/openldap )
+ ldap-bind? ( net-nds/openldap[sasl] )
+ mysql? ( virtual/mysql )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql:* )
+ sasl? ( >=dev-libs/cyrus-sasl-2 )
+ sqlite? ( dev-db/sqlite:3 )
+ ssl? ( >=dev-libs/openssl-0.9.6g:* )"
+
+RDEPEND="${DEPEND}
+ dovecot-sasl? ( net-mail/dovecot )
+ memcached? ( net-misc/memcached )
+ net-mail/mailbase
+ selinux? ( sec-policy/selinux-postfix )
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ !net-mail/fastforward"
+
+REQUIRED_USE="ldap-bind? ( ldap sasl )"
+
+S="${WORKDIR}/${MY_SRC}"
+
+pkg_setup() {
+ # Add postfix, postdrop user/group (bug #77565)
+ enewgroup postfix 207
+ enewgroup postdrop 208
+ enewuser postfix 207 -1 /var/spool/postfix postfix,mail
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-2.11.1-db6.patch"
+ if use vda; then
+ epatch "${DISTDIR}"/${VDA_P}.patch
+ fi
+
+ sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
+ src/util/sys_defs.h || die "sed failed"
+
+ # change default paths to better comply with portage standard paths
+ sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
+}
+
+src_configure() {
+ # Make sure LDFLAGS get passed down to the executables.
+ local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -lpcre -lcrypt -lpthread"
+
+ use pam && mylibs="${mylibs} -lpam"
+
+ if use ldap; then
+ mycc="${mycc} -DHAS_LDAP"
+ mylibs="${mylibs} -lldap -llber"
+ fi
+
+ if use mysql; then
+ mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
+ mylibs="${mylibs} $(mysql_config --libs)"
+ fi
+
+ if use postgres; then
+ mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
+ mylibs="${mylibs} -lpq -L$(pg_config --libdir)"
+ fi
+
+ if use sqlite; then
+ mycc="${mycc} -DHAS_SQLITE"
+ mylibs="${mylibs} -lsqlite3"
+ fi
+
+ if use ssl; then
+ mycc="${mycc} -DUSE_TLS"
+ mylibs="${mylibs} -lssl -lcrypto"
+ fi
+
+ # broken. and "in other words, not supported" by upstream.
+ # Use inet_protocols setting in main.cf
+ #if ! use ipv6; then
+ # mycc="${mycc} -DNO_IPV6"
+ #fi
+
+ if use sasl; then
+ if use dovecot-sasl; then
+ # Set dovecot as default.
+ mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
+ fi
+ if use ldap-bind; then
+ mycc="${mycc} -DUSE_LDAP_SASL"
+ fi
+ mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
+ mylibs="${mylibs} -lsasl2"
+ elif use dovecot-sasl; then
+ mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
+ fi
+
+ if ! use nis; then
+ sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" \
+ src/util/sys_defs.h || die "sed failed"
+ fi
+
+ if ! use berkdb; then
+ mycc="${mycc} -DNO_DB"
+ if use cdb; then
+ # change default hash format from Berkeley DB to cdb
+ sed -i -e "s/hash/cdb/" src/util/sys_defs.h || die
+ fi
+ fi
+
+ if use cdb; then
+ mycc="${mycc} -DHAS_CDB -I/usr/include/cdb"
+ CDB_LIBS=""
+ # Tinycdb is preferred.
+ if has_version dev-db/tinycdb ; then
+ einfo "Building with dev-db/tinycdb"
+ CDB_LIBS="-lcdb"
+ else
+ einfo "Building with dev-db/cdb"
+ CDB_PATH="/usr/$(get_libdir)"
+ for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
+ CDB_LIBS="${CDB_LIBS} ${CDB_PATH}/${i}"
+ done
+ fi
+ mylibs="${mylibs} ${CDB_LIBS}"
+ fi
+
+ # Robin H. Johnson <robbat2@gentoo.org> 17/Nov/2006
+ # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
+ mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
+ filter-lfs-flags
+
+ # Workaround for bug #76512
+ if use hardened; then
+ [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
+ fi
+
+ # Remove annoying C++ comment style warnings - bug #378099
+ append-flags -Wno-comment
+
+ sed -i -e "/^RANLIB/s/ranlib/$(tc-getRANLIB)/g" "${S}"/makedefs
+ sed -i -e "/^AR/s/ar/$(tc-getAR)/g" "${S}"/makedefs
+ emake DEBUG="" CC="$(tc-getCC)" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" makefiles
+}
+
+src_install () {
+ local myconf
+ use doc && myconf="readme_directory=\"/usr/share/doc/${PF}/readme\" \
+ html_directory=\"/usr/share/doc/${PF}/html\""
+
+ /bin/sh postfix-install \
+ -non-interactive \
+ install_root="${D}" \
+ config_directory="/etc/postfix" \
+ manpage_directory="/usr/share/man" \
+ command_directory="/usr/sbin" \
+ mailq_path="/usr/bin/mailq" \
+ newaliases_path="/usr/bin/newaliases" \
+ sendmail_path="/usr/sbin/sendmail" \
+ ${myconf} \
+ || die "postfix-install failed"
+
+ # Fix spool removal on upgrade
+ rm -Rf "${D}"/var
+ keepdir /var/spool/postfix
+
+ # Install rmail for UUCP, closes bug #19127
+ dobin auxiliary/rmail/rmail
+
+ # Provide another link for legacy FSH
+ dosym /usr/sbin/sendmail /usr/$(get_libdir)/sendmail
+
+ # Install qshape tool
+ dobin auxiliary/qshape/qshape.pl
+ doman man/man1/qshape.1
+
+ # Performance tuning tools and their manuals
+ dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
+ doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
+
+ # Set proper permissions on required files/directories
+ dodir /var/lib/postfix
+ keepdir /var/lib/postfix
+ fowners -R postfix:postfix /var/lib/postfix
+ fperms 0750 /var/lib/postfix
+ fowners root:postdrop /usr/sbin/post{drop,queue}
+ fperms 02711 /usr/sbin/post{drop,queue}
+
+ keepdir /etc/postfix
+ if use mbox; then
+ mypostconf="mail_spool_directory=/var/spool/mail"
+ else
+ mypostconf="home_mailbox=.maildir/"
+ fi
+ "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix \
+ -e ${mypostconf} || die "postconf failed"
+
+ insinto /etc/postfix
+ newins "${FILESDIR}"/smtp.pass saslpass
+ fperms 600 /etc/postfix/saslpass
+
+ newinitd "${FILESDIR}"/postfix.rc6.${RC_VER} postfix
+ # do not start mysql/postgres unnecessarily - bug #359913
+ use mysql || sed -i -e "s/mysql //" "${D}/etc/init.d/postfix"
+ use postgres || sed -i -e "s/postgresql //" "${D}/etc/init.d/postfix"
+
+ dodoc *README COMPATIBILITY HISTORY PORTING RELEASE_NOTES*
+ mv "${D}"/etc/postfix/{*.default,makedefs.out} "${D}"/usr/share/doc/${PF}/
+ use doc && mv "${S}"/examples "${D}"/usr/share/doc/${PF}/
+
+ pamd_mimic_system smtp auth account
+
+ if use sasl; then
+ insinto /etc/sasl2
+ newins "${FILESDIR}"/smtp.sasl smtpd.conf
+ fi
+
+ # header files
+ insinto /usr/include/postfix
+ doins include/*.h
+
+ # Remove unnecessary files
+ rm -f "${D}"/etc/postfix/{*LICENSE,access,aliases,canonical,generic}
+ rm -f "${D}"/etc/postfix/{header_checks,relocated,transport,virtual}
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+}
+
+pkg_preinst() {
+ # Postfix 2.9.
+ # default for inet_protocols changed from ipv4 to all in postfix-2.9.
+ # check inet_protocols setting in main.cf and modify if necessary to prevent
+ # performance loss with useless DNS lookups and useless connection attempts.
+ [[ -d ${ROOT}/etc/postfix ]] && {
+ if [[ "$(${D}/usr/sbin/postconf -dh inet_protocols)" != "ipv4" ]]; then
+ if [[ ! -n "$(${D}/usr/sbin/postconf -c ${ROOT}/etc/postfix -n inet_protocols)" ]];
+ then
+ ewarn "\nCOMPATIBILITY: adding inet_protocols=ipv4 to main.cf."
+ ewarn "That will keep the same behaviour as previous postfix versions."
+ ewarn "Specify inet_protocols explicitly if you want to enable IPv6.\n"
+ else
+ # delete inet_protocols setting. there is already one in /etc/postfix
+ sed -i -e /inet_protocols/d "${D}"/etc/postfix/main.cf || die
+ fi
+ fi
+ }
+}
+
+pkg_postinst() {
+ # Do not install server.{key,pem) SSL certificates if they already exist
+ if use ssl && [[ ! -f "${ROOT}"/etc/ssl/postfix/server.key \
+ && ! -f "${ROOT}"/etc/ssl/postfix/server.pem ]] ; then
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
+ install_cert /etc/ssl/postfix/server
+ chown postfix:mail "${ROOT}"/etc/ssl/postfix/server.{key,pem}
+ fi
+
+ if [[ ! -e /etc/mail/aliases.db ]] ; then
+ ewarn
+ ewarn "You must edit /etc/mail/aliases to suit your needs"
+ ewarn "and then run /usr/bin/newaliases. Postfix will not"
+ ewarn "work correctly without it."
+ ewarn
+ fi
+
+ if [[ $(get_version_component_range 2 ${REPLACING_VERSIONS}) -lt 9 ]]; then
+ elog "If you are using old style postfix instances by symlinking"
+ elog "startup scripts in ${ROOT}etc/init.d, please consider"
+ elog "upgrading your config for postmulti support. For more info:"
+ elog "http://www.postfix.org/MULTI_INSTANCE_README.html"
+ if ! use berkdb; then
+ ewarn "\nPostfix is installed without BerkeleyDB support."
+ ewarn "Please turn on berkdb USE flag if you need hash or"
+ ewarn "btree table lookups.\n"
+ fi
+ ewarn "Postfix daemons now live under /usr/libexec/postfix"
+ ewarn "Please adjust your main.cf accordingly by running"
+ ewarn "etc-update/dispatch-conf or similar and accepting the new"
+ ewarn "daemon_directory setting."
+ fi
+}
diff --git a/mail-mta/postfix/postfix-2.11.6.ebuild b/mail-mta/postfix/postfix-2.11.6.ebuild
new file mode 100644
index 00000000000..af0dc781069
--- /dev/null
+++ b/mail-mta/postfix/postfix-2.11.6.ebuild
@@ -0,0 +1,324 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic multilib pam ssl-cert systemd toolchain-funcs user versionator
+
+MY_PV="${PV/_pre/-}"
+MY_SRC="${PN}-${MY_PV}"
+MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official"
+VDA_PV="2.10.0"
+VDA_P="${PN}-vda-v13-${VDA_PV}"
+RC_VER="2.7"
+
+DESCRIPTION="A fast and secure drop-in replacement for sendmail"
+HOMEPAGE="http://www.postfix.org/"
+SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
+ vda? ( http://vda.sourceforge.net/VDA/${VDA_P}.patch ) "
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="+berkdb cdb doc dovecot-sasl hardened ldap ldap-bind lmdb memcached mbox mysql nis pam postgres sasl selinux sqlite ssl vda"
+
+DEPEND=">=dev-libs/libpcre-3.4
+ dev-lang/perl
+ berkdb? ( >=sys-libs/db-3.2:* )
+ cdb? ( || ( >=dev-db/tinycdb-0.76 >=dev-db/cdb-0.75-r1 ) )
+ ldap? ( net-nds/openldap )
+ ldap-bind? ( net-nds/openldap[sasl] )
+ lmdb? ( >=dev-db/lmdb-0.9.11 )
+ mysql? ( virtual/mysql )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql:* )
+ sasl? ( >=dev-libs/cyrus-sasl-2 )
+ sqlite? ( dev-db/sqlite:3 )
+ ssl? ( >=dev-libs/openssl-0.9.6g:* )"
+
+RDEPEND="${DEPEND}
+ dovecot-sasl? ( net-mail/dovecot )
+ memcached? ( net-misc/memcached )
+ net-mail/mailbase
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ !net-mail/fastforward
+ selinux? ( sec-policy/selinux-postfix )"
+
+REQUIRED_USE="ldap-bind? ( ldap sasl )"
+
+S="${WORKDIR}/${MY_SRC}"
+
+pkg_setup() {
+ # Add postfix, postdrop user/group (bug #77565)
+ enewgroup postfix 207
+ enewgroup postdrop 208
+ enewuser postfix 207 -1 /var/spool/postfix postfix,mail
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-2.11.1-db6.patch"
+ if use vda; then
+ epatch "${DISTDIR}"/${VDA_P}.patch
+ fi
+
+ sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
+ src/util/sys_defs.h || die "sed failed"
+
+ # change default paths to better comply with portage standard paths
+ sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
+
+ epatch_user
+}
+
+src_configure() {
+ # Make sure LDFLAGS get passed down to the executables.
+ local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -lpcre -lcrypt -lpthread"
+
+ use pam && mylibs="${mylibs} -lpam"
+
+ if use ldap; then
+ mycc="${mycc} -DHAS_LDAP"
+ mylibs="${mylibs} -lldap -llber"
+ fi
+
+ if use mysql; then
+ mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
+ mylibs="${mylibs} $(mysql_config --libs)"
+ fi
+
+ if use postgres; then
+ mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
+ mylibs="${mylibs} -lpq -L$(pg_config --libdir)"
+ fi
+
+ if use sqlite; then
+ mycc="${mycc} -DHAS_SQLITE"
+ mylibs="${mylibs} -lsqlite3"
+ fi
+
+ if use ssl; then
+ mycc="${mycc} -DUSE_TLS"
+ mylibs="${mylibs} -lssl -lcrypto"
+ fi
+
+ if use lmdb; then
+ mycc="${mycc} -DHAS_LMDB"
+ mylibs="${mylibs} -llmdb"
+ fi
+
+ # broken. and "in other words, not supported" by upstream.
+ # Use inet_protocols setting in main.cf
+ #if ! use ipv6; then
+ # mycc="${mycc} -DNO_IPV6"
+ #fi
+
+ if use sasl; then
+ if use dovecot-sasl; then
+ # Set dovecot as default.
+ mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
+ fi
+ if use ldap-bind; then
+ mycc="${mycc} -DUSE_LDAP_SASL"
+ fi
+ mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
+ mylibs="${mylibs} -lsasl2"
+ elif use dovecot-sasl; then
+ mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
+ fi
+
+ if ! use nis; then
+ mycc="${mycc} -DNO_NIS"
+ fi
+
+ if ! use berkdb; then
+ mycc="${mycc} -DNO_DB"
+ if use cdb; then
+ # change default hash format from Berkeley DB to cdb
+ mycc="${mycc} -DDEF_DB_TYPE=\\\"cdb\\\""
+ fi
+ fi
+
+ if use cdb; then
+ mycc="${mycc} -DHAS_CDB -I/usr/include/cdb"
+ CDB_LIBS=""
+ # Tinycdb is preferred.
+ if has_version dev-db/tinycdb ; then
+ einfo "Building with dev-db/tinycdb"
+ CDB_LIBS="-lcdb"
+ else
+ einfo "Building with dev-db/cdb"
+ CDB_PATH="/usr/$(get_libdir)"
+ for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
+ CDB_LIBS="${CDB_LIBS} ${CDB_PATH}/${i}"
+ done
+ fi
+ mylibs="${mylibs} ${CDB_LIBS}"
+ fi
+
+ # Robin H. Johnson <robbat2@gentoo.org> 17/Nov/2006
+ # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
+ mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
+ filter-lfs-flags
+
+ # Workaround for bug #76512
+ if use hardened; then
+ [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
+ fi
+
+ # Remove annoying C++ comment style warnings - bug #378099
+ append-flags -Wno-comment
+
+ sed -i -e "/^RANLIB/s/ranlib/$(tc-getRANLIB)/g" "${S}"/makedefs
+ sed -i -e "/^AR/s/ar/$(tc-getAR)/g" "${S}"/makedefs
+ emake DEBUG="" CC="$(tc-getCC)" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" makefiles
+}
+
+src_install () {
+ local myconf
+ use doc && myconf="readme_directory=\"/usr/share/doc/${PF}/readme\" \
+ html_directory=\"/usr/share/doc/${PF}/html\""
+
+ /bin/sh postfix-install \
+ -non-interactive \
+ install_root="${D}" \
+ config_directory="/etc/postfix" \
+ manpage_directory="/usr/share/man" \
+ command_directory="/usr/sbin" \
+ mailq_path="/usr/bin/mailq" \
+ newaliases_path="/usr/bin/newaliases" \
+ sendmail_path="/usr/sbin/sendmail" \
+ ${myconf} \
+ || die "postfix-install failed"
+
+ # Fix spool removal on upgrade
+ rm -Rf "${D}"/var
+ keepdir /var/spool/postfix
+
+ # Install rmail for UUCP, closes bug #19127
+ dobin auxiliary/rmail/rmail
+
+ # Provide another link for legacy FSH
+ dosym /usr/sbin/sendmail /usr/$(get_libdir)/sendmail
+
+ # Install qshape tool and posttls-finger
+ dobin auxiliary/qshape/qshape.pl
+ doman man/man1/qshape.1
+ dobin bin/posttls-finger
+ doman man/man1/posttls-finger.1
+
+ # Performance tuning tools and their manuals
+ dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
+ doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
+
+ # Set proper permissions on required files/directories
+ dodir /var/lib/postfix
+ keepdir /var/lib/postfix
+ fowners -R postfix:postfix /var/lib/postfix
+ fperms 0750 /var/lib/postfix
+ fowners root:postdrop /usr/sbin/post{drop,queue}
+ fperms 02711 /usr/sbin/post{drop,queue}
+
+ keepdir /etc/postfix
+ if use mbox; then
+ mypostconf="mail_spool_directory=/var/spool/mail"
+ else
+ mypostconf="home_mailbox=.maildir/"
+ fi
+ "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix \
+ -e ${mypostconf} || die "postconf failed"
+
+ insinto /etc/postfix
+ newins "${FILESDIR}"/smtp.pass saslpass
+ fperms 600 /etc/postfix/saslpass
+
+ newinitd "${FILESDIR}"/postfix.rc6.${RC_VER} postfix
+ # do not start mysql/postgres unnecessarily - bug #359913
+ use mysql || sed -i -e "s/mysql //" "${D}/etc/init.d/postfix"
+ use postgres || sed -i -e "s/postgresql //" "${D}/etc/init.d/postfix"
+
+ dodoc *README COMPATIBILITY HISTORY PORTING RELEASE_NOTES*
+ mv "${D}"/etc/postfix/{*.default,makedefs.out} "${D}"/usr/share/doc/${PF}/
+ use doc && mv "${S}"/examples "${D}"/usr/share/doc/${PF}/
+
+ pamd_mimic_system smtp auth account
+
+ if use sasl; then
+ insinto /etc/sasl2
+ newins "${FILESDIR}"/smtp.sasl smtpd.conf
+ fi
+
+ # header files
+ insinto /usr/include/postfix
+ doins include/*.h
+
+ # Remove unnecessary files
+ rm -f "${D}"/etc/postfix/{*LICENSE,access,aliases,canonical,generic}
+ rm -f "${D}"/etc/postfix/{header_checks,relocated,transport,virtual}
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+}
+
+pkg_preinst() {
+ # Postfix 2.9.
+ # default for inet_protocols changed from ipv4 to all in postfix-2.9.
+ # check inet_protocols setting in main.cf and modify if necessary to prevent
+ # performance loss with useless DNS lookups and useless connection attempts.
+ [[ -d ${ROOT}/etc/postfix ]] && {
+ if [[ "$(${D}/usr/sbin/postconf -dh inet_protocols)" != "ipv4" ]]; then
+ if [[ ! -n "$(${D}/usr/sbin/postconf -c ${ROOT}/etc/postfix -n inet_protocols)" ]];
+ then
+ ewarn "\nCOMPATIBILITY: adding inet_protocols=ipv4 to main.cf."
+ ewarn "That will keep the same behaviour as previous postfix versions."
+ ewarn "Specify inet_protocols explicitly if you want to enable IPv6.\n"
+ else
+ # delete inet_protocols setting. there is already one in /etc/postfix
+ sed -i -e /inet_protocols/d "${D}"/etc/postfix/main.cf || die
+ fi
+ fi
+ }
+}
+
+pkg_postinst() {
+ # Do not install server.{key,pem) SSL certificates if they already exist
+ if use ssl && [[ ! -f "${ROOT}"/etc/ssl/postfix/server.key \
+ && ! -f "${ROOT}"/etc/ssl/postfix/server.pem ]] ; then
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
+ install_cert /etc/ssl/postfix/server
+ chown postfix:mail "${ROOT}"/etc/ssl/postfix/server.{key,pem}
+ fi
+
+ if [[ ! -e /etc/mail/aliases.db ]] ; then
+ ewarn
+ ewarn "You must edit /etc/mail/aliases to suit your needs"
+ ewarn "and then run /usr/bin/newaliases. Postfix will not"
+ ewarn "work correctly without it."
+ ewarn
+ fi
+
+ if [[ $(get_version_component_range 2 ${REPLACING_VERSIONS}) -lt 9 ]]; then
+ elog "If you are using old style postfix instances by symlinking"
+ elog "startup scripts in ${ROOT}etc/init.d, please consider"
+ elog "upgrading your config for postmulti support. For more info:"
+ elog "http://www.postfix.org/MULTI_INSTANCE_README.html"
+ if ! use berkdb; then
+ ewarn "\nPostfix is installed without BerkeleyDB support."
+ ewarn "Please turn on berkdb USE flag if you need hash or"
+ ewarn "btree table lookups.\n"
+ fi
+ ewarn "Postfix daemons now live under /usr/libexec/postfix"
+ ewarn "Please adjust your main.cf accordingly by running"
+ ewarn "etc-update/dispatch-conf or similar and accepting the new"
+ ewarn "daemon_directory setting."
+ fi
+}
diff --git a/mail-mta/postfix/postfix-3.0.0.ebuild b/mail-mta/postfix/postfix-3.0.0.ebuild
new file mode 100644
index 00000000000..438bfc8c6ac
--- /dev/null
+++ b/mail-mta/postfix/postfix-3.0.0.ebuild
@@ -0,0 +1,313 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic multilib pam ssl-cert systemd toolchain-funcs user versionator
+
+MY_PV="${PV/_rc/-RC}"
+MY_SRC="${PN}-${MY_PV}"
+MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official"
+VDA_PV="2.10.0"
+VDA_P="${PN}-vda-v13-${VDA_PV}"
+RC_VER="2.7"
+
+DESCRIPTION="A fast and secure drop-in replacement for sendmail"
+HOMEPAGE="http://www.postfix.org/"
+SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
+ vda? ( http://vda.sourceforge.net/VDA/${VDA_P}.patch ) "
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 ~sh sparc x86 ~x86-fbsd"
+IUSE="+berkdb cdb doc dovecot-sasl +eai hardened ldap ldap-bind lmdb memcached mbox mysql nis pam postgres sasl selinux sqlite ssl vda"
+
+DEPEND=">=dev-libs/libpcre-3.4
+ dev-lang/perl
+ berkdb? ( >=sys-libs/db-3.2:* )
+ cdb? ( || ( >=dev-db/tinycdb-0.76 >=dev-db/cdb-0.75-r1 ) )
+ eai? ( dev-libs/icu:= )
+ ldap? ( net-nds/openldap )
+ ldap-bind? ( net-nds/openldap[sasl] )
+ lmdb? ( >=dev-db/lmdb-0.9.11 )
+ mysql? ( virtual/mysql )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql:* )
+ sasl? ( >=dev-libs/cyrus-sasl-2 )
+ sqlite? ( dev-db/sqlite:3 )
+ ssl? ( >=dev-libs/openssl-0.9.6g:* )"
+
+RDEPEND="${DEPEND}
+ dovecot-sasl? ( net-mail/dovecot )
+ memcached? ( net-misc/memcached )
+ net-mail/mailbase
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ !net-mail/fastforward
+ selinux? ( sec-policy/selinux-postfix )"
+
+# No vda support for postfix-3.0
+REQUIRED_USE="ldap-bind? ( ldap sasl )
+ !vda"
+
+S="${WORKDIR}/${MY_SRC}"
+
+pkg_setup() {
+ # Add postfix, postdrop user/group (bug #77565)
+ enewgroup postfix 207
+ enewgroup postdrop 208
+ enewuser postfix 207 -1 /var/spool/postfix postfix,mail
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-linux4.patch"
+ if use vda; then
+ epatch "${DISTDIR}"/${VDA_P}.patch
+ fi
+
+ sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
+ src/util/sys_defs.h || die "sed failed"
+
+ # change default paths to better comply with portage standard paths
+ sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
+
+ epatch_user
+}
+
+src_configure() {
+ for name in CDB LDAP LMDB MYSQL PCRE PGSQL SDBM SQLITE
+ do
+ local AUXLIBS_${name}=""
+ done
+
+ # Make sure LDFLAGS get passed down to the executables.
+ local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -ldl"
+ AUXLIBS_PCRE="$(pcre-config --libs)"
+
+ use pam && mylibs="${mylibs} -lpam"
+
+ if use ldap; then
+ mycc="${mycc} -DHAS_LDAP"
+ AUXLIBS_LDAP="-lldap -llber"
+ fi
+
+ if use mysql; then
+ mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
+ AUXLIBS_MYSQL="$(mysql_config --libs)"
+ fi
+
+ if use postgres; then
+ mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
+ AUXLIBS_PGSQL="-L$(pg_config --libdir) -lpq"
+ fi
+
+ if use sqlite; then
+ mycc="${mycc} -DHAS_SQLITE"
+ AUXLIBS_SQLITE="-lsqlite3 -lpthread"
+ fi
+
+ if use ssl; then
+ mycc="${mycc} -DUSE_TLS"
+ mylibs="${mylibs} -lssl -lcrypto"
+ fi
+
+ if use lmdb; then
+ mycc="${mycc} -DHAS_LMDB"
+ AUXLIBS_LMDB="-llmdb -lpthread"
+ fi
+
+ if ! use eai; then
+ mycc="${mycc} -DNO_EAI"
+ fi
+
+ # broken. and "in other words, not supported" by upstream.
+ # Use inet_protocols setting in main.cf
+ #if ! use ipv6; then
+ # mycc="${mycc} -DNO_IPV6"
+ #fi
+
+ if use sasl; then
+ if use dovecot-sasl; then
+ # Set dovecot as default.
+ mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
+ fi
+ if use ldap-bind; then
+ mycc="${mycc} -DUSE_LDAP_SASL"
+ fi
+ mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
+ mylibs="${mylibs} -lsasl2"
+ elif use dovecot-sasl; then
+ mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
+ fi
+
+ if ! use nis; then
+ mycc="${mycc} -DNO_NIS"
+ fi
+
+ if ! use berkdb; then
+ mycc="${mycc} -DNO_DB"
+ if use cdb; then
+ # change default hash format from Berkeley DB to cdb
+ mycc="${mycc} -DDEF_DB_TYPE=\\\"cdb\\\""
+ fi
+ fi
+
+ if use cdb; then
+ mycc="${mycc} -DHAS_CDB -I/usr/include/cdb"
+ # Tinycdb is preferred.
+ if has_version dev-db/tinycdb ; then
+ einfo "Building with dev-db/tinycdb"
+ AUXLIBS_CDB="-lcdb"
+ else
+ einfo "Building with dev-db/cdb"
+ CDB_PATH="/usr/$(get_libdir)"
+ for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
+ AUXLIBS_CDB="${AUXLIBS_CDB} ${CDB_PATH}/${i}"
+ done
+ fi
+ fi
+
+ # Robin H. Johnson <robbat2@gentoo.org> 17/Nov/2006
+ # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
+ mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
+ filter-lfs-flags
+
+ # Workaround for bug #76512
+ if use hardened; then
+ [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
+ fi
+
+ # Remove annoying C++ comment style warnings - bug #378099
+ append-flags -Wno-comment
+
+ sed -i -e "/^RANLIB/s/ranlib/$(tc-getRANLIB)/g" "${S}"/makedefs
+ sed -i -e "/^AR/s/ar/$(tc-getAR)/g" "${S}"/makedefs
+
+ emake makefiles shared=yes dynamicmaps=no \
+ shlib_directory="/usr/$(get_libdir)/postfix/MAIL_VERSION" \
+ DEBUG="" CC="$(tc-getCC)" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" \
+ AUXLIBS_CDB="${AUXLIBS_CDB}" AUXLIBS_LDAP="${AUXLIBS_LDAP}" \
+ AUXLIBS_LMDB="${AUXLIBS_LMDB}" AUXLIBS_MYSQL="${AUXLIBS_MYSQL}" \
+ AUXLIBS_PCRE="${AUXLIBS_PCRE}" AUXLIBS_PGSQL="${AUXLIBS_PGSQL}" \
+ AUXLIBS_SQLITE="${AUXLIBS_SQLITE}"
+}
+
+src_install () {
+ local myconf
+ use doc && myconf="readme_directory=\"/usr/share/doc/${PF}/readme\" \
+ html_directory=\"/usr/share/doc/${PF}/html\""
+
+ LD_LIBRARY_PATH="${S}/lib" \
+ /bin/sh postfix-install \
+ -non-interactive \
+ install_root="${D}" \
+ config_directory="/etc/postfix" \
+ manpage_directory="/usr/share/man" \
+ command_directory="/usr/sbin" \
+ mailq_path="/usr/bin/mailq" \
+ newaliases_path="/usr/bin/newaliases" \
+ sendmail_path="/usr/sbin/sendmail" \
+ ${myconf} \
+ || die "postfix-install failed"
+
+ # Fix spool removal on upgrade
+ rm -Rf "${D}"/var
+ keepdir /var/spool/postfix
+
+ # Install rmail for UUCP, closes bug #19127
+ dobin auxiliary/rmail/rmail
+
+ # Provide another link for legacy FSH
+ dosym /usr/sbin/sendmail /usr/$(get_libdir)/sendmail
+
+ # Install qshape tool and posttls-finger
+ dobin auxiliary/qshape/qshape.pl
+ doman man/man1/qshape.1
+ dobin bin/posttls-finger
+ doman man/man1/posttls-finger.1
+
+ # Performance tuning tools and their manuals
+ dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
+ doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
+
+ # Set proper permissions on required files/directories
+ dodir /var/lib/postfix
+ keepdir /var/lib/postfix
+ fowners -R postfix:postfix /var/lib/postfix
+ fperms 0750 /var/lib/postfix
+ fowners root:postdrop /usr/sbin/post{drop,queue}
+ fperms 02711 /usr/sbin/post{drop,queue}
+
+ keepdir /etc/postfix
+ if use mbox; then
+ mypostconf="mail_spool_directory=/var/spool/mail"
+ else
+ mypostconf="home_mailbox=.maildir/"
+ fi
+ LD_LIBRARY_PATH="${S}/lib" \
+ "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix \
+ -e ${mypostconf} || die "postconf failed"
+
+ insinto /etc/postfix
+ newins "${FILESDIR}"/smtp.pass saslpass
+ fperms 600 /etc/postfix/saslpass
+
+ newinitd "${FILESDIR}"/postfix.rc6.${RC_VER} postfix
+ # do not start mysql/postgres unnecessarily - bug #359913
+ use mysql || sed -i -e "s/mysql //" "${D}/etc/init.d/postfix"
+ use postgres || sed -i -e "s/postgresql //" "${D}/etc/init.d/postfix"
+
+ dodoc *README COMPATIBILITY HISTORY PORTING RELEASE_NOTES*
+ mv "${D}"/etc/postfix/{*.default,makedefs.out,*.proto} "${D}"/usr/share/doc/${PF}/
+ use doc && mv "${S}"/examples "${D}"/usr/share/doc/${PF}/
+
+ pamd_mimic_system smtp auth account
+
+ if use sasl; then
+ insinto /etc/sasl2
+ newins "${FILESDIR}"/smtp.sasl smtpd.conf
+ fi
+
+ # header files
+ insinto /usr/include/postfix
+ doins include/*.h
+
+ # Remove unnecessary files
+ rm -f "${D}"/etc/postfix/{*LICENSE,access,aliases,canonical,generic}
+ rm -f "${D}"/etc/postfix/{header_checks,relocated,transport,virtual}
+
+ if has_version mail-mta/postfix; then
+ # let the sysadmin decide when to change the compatibility_level
+ sed -i -e /^compatibility_level/"s/^/#/" "${D}"/etc/postfix/main.cf || die
+ fi
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+}
+
+pkg_postinst() {
+ # Do not install server.{key,pem) SSL certificates if they already exist
+ if use ssl && [[ ! -f "${ROOT}"/etc/ssl/postfix/server.key \
+ && ! -f "${ROOT}"/etc/ssl/postfix/server.pem ]] ; then
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
+ install_cert /etc/ssl/postfix/server
+ chown postfix:mail "${ROOT}"/etc/ssl/postfix/server.{key,pem}
+ fi
+
+ if [[ ! -e /etc/mail/aliases.db ]] ; then
+ ewarn
+ ewarn "You must edit /etc/mail/aliases to suit your needs"
+ ewarn "and then run /usr/bin/newaliases. Postfix will not"
+ ewarn "work correctly without it."
+ ewarn
+ fi
+}
diff --git a/mail-mta/postfix/postfix-3.0.1-r1.ebuild b/mail-mta/postfix/postfix-3.0.1-r1.ebuild
new file mode 100644
index 00000000000..a997332631d
--- /dev/null
+++ b/mail-mta/postfix/postfix-3.0.1-r1.ebuild
@@ -0,0 +1,313 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic multilib pam ssl-cert systemd toolchain-funcs user versionator
+
+MY_PV="${PV/_rc/-RC}"
+MY_SRC="${PN}-${MY_PV}"
+MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official"
+VDA_PV="2.10.0"
+VDA_P="${PN}-vda-v13-${VDA_PV}"
+RC_VER="2.7"
+
+DESCRIPTION="A fast and secure drop-in replacement for sendmail"
+HOMEPAGE="http://www.postfix.org/"
+SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
+ vda? ( http://vda.sourceforge.net/VDA/${VDA_P}.patch ) "
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~hppa ia64 ppc ~ppc64 ~sh sparc x86 ~x86-fbsd"
+IUSE="+berkdb cdb doc dovecot-sasl +eai hardened ldap ldap-bind lmdb memcached mbox mysql nis pam postgres sasl selinux sqlite ssl vda"
+
+DEPEND=">=dev-libs/libpcre-3.4
+ dev-lang/perl
+ berkdb? ( >=sys-libs/db-3.2:* )
+ cdb? ( || ( >=dev-db/tinycdb-0.76 >=dev-db/cdb-0.75-r1 ) )
+ eai? ( dev-libs/icu:= )
+ ldap? ( net-nds/openldap )
+ ldap-bind? ( net-nds/openldap[sasl] )
+ lmdb? ( >=dev-db/lmdb-0.9.11 )
+ mysql? ( virtual/mysql )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql:* )
+ sasl? ( >=dev-libs/cyrus-sasl-2 )
+ sqlite? ( dev-db/sqlite:3 )
+ ssl? ( >=dev-libs/openssl-0.9.6g:* )"
+
+RDEPEND="${DEPEND}
+ dovecot-sasl? ( net-mail/dovecot )
+ memcached? ( net-misc/memcached )
+ net-mail/mailbase
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ !net-mail/fastforward
+ selinux? ( sec-policy/selinux-postfix )"
+
+# No vda support for postfix-3.0
+REQUIRED_USE="ldap-bind? ( ldap sasl )
+ !vda"
+
+S="${WORKDIR}/${MY_SRC}"
+
+pkg_setup() {
+ # Add postfix, postdrop user/group (bug #77565)
+ enewgroup postfix 207
+ enewgroup postdrop 208
+ enewuser postfix 207 -1 /var/spool/postfix postfix,mail
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-linux4.patch"
+ if use vda; then
+ epatch "${DISTDIR}"/${VDA_P}.patch
+ fi
+
+ sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
+ src/util/sys_defs.h || die "sed failed"
+
+ # change default paths to better comply with portage standard paths
+ sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
+
+ epatch_user
+}
+
+src_configure() {
+ for name in CDB LDAP LMDB MYSQL PCRE PGSQL SDBM SQLITE
+ do
+ local AUXLIBS_${name}=""
+ done
+
+ # Make sure LDFLAGS get passed down to the executables.
+ local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -ldl"
+ AUXLIBS_PCRE="$(pcre-config --libs)"
+
+ use pam && mylibs="${mylibs} -lpam"
+
+ if use ldap; then
+ mycc="${mycc} -DHAS_LDAP"
+ AUXLIBS_LDAP="-lldap -llber"
+ fi
+
+ if use mysql; then
+ mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
+ AUXLIBS_MYSQL="$(mysql_config --libs)"
+ fi
+
+ if use postgres; then
+ mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
+ AUXLIBS_PGSQL="-L$(pg_config --libdir) -lpq"
+ fi
+
+ if use sqlite; then
+ mycc="${mycc} -DHAS_SQLITE"
+ AUXLIBS_SQLITE="-lsqlite3 -lpthread"
+ fi
+
+ if use ssl; then
+ mycc="${mycc} -DUSE_TLS"
+ mylibs="${mylibs} -lssl -lcrypto"
+ fi
+
+ if use lmdb; then
+ mycc="${mycc} -DHAS_LMDB"
+ AUXLIBS_LMDB="-llmdb -lpthread"
+ fi
+
+ if ! use eai; then
+ mycc="${mycc} -DNO_EAI"
+ fi
+
+ # broken. and "in other words, not supported" by upstream.
+ # Use inet_protocols setting in main.cf
+ #if ! use ipv6; then
+ # mycc="${mycc} -DNO_IPV6"
+ #fi
+
+ if use sasl; then
+ if use dovecot-sasl; then
+ # Set dovecot as default.
+ mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
+ fi
+ if use ldap-bind; then
+ mycc="${mycc} -DUSE_LDAP_SASL"
+ fi
+ mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
+ mylibs="${mylibs} -lsasl2"
+ elif use dovecot-sasl; then
+ mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
+ fi
+
+ if ! use nis; then
+ mycc="${mycc} -DNO_NIS"
+ fi
+
+ if ! use berkdb; then
+ mycc="${mycc} -DNO_DB"
+ if use cdb; then
+ # change default hash format from Berkeley DB to cdb
+ mycc="${mycc} -DDEF_DB_TYPE=\\\"cdb\\\""
+ fi
+ fi
+
+ if use cdb; then
+ mycc="${mycc} -DHAS_CDB -I/usr/include/cdb"
+ # Tinycdb is preferred.
+ if has_version dev-db/tinycdb ; then
+ einfo "Building with dev-db/tinycdb"
+ AUXLIBS_CDB="-lcdb"
+ else
+ einfo "Building with dev-db/cdb"
+ CDB_PATH="/usr/$(get_libdir)"
+ for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
+ AUXLIBS_CDB="${AUXLIBS_CDB} ${CDB_PATH}/${i}"
+ done
+ fi
+ fi
+
+ # Robin H. Johnson <robbat2@gentoo.org> 17/Nov/2006
+ # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
+ mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
+ filter-lfs-flags
+
+ # Workaround for bug #76512
+ if use hardened; then
+ [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
+ fi
+
+ # Remove annoying C++ comment style warnings - bug #378099
+ append-flags -Wno-comment
+
+ sed -i -e "/^RANLIB/s/ranlib/$(tc-getRANLIB)/g" "${S}"/makedefs
+ sed -i -e "/^AR/s/ar/$(tc-getAR)/g" "${S}"/makedefs
+
+ emake makefiles shared=yes dynamicmaps=no \
+ shlib_directory="/usr/$(get_libdir)/postfix/MAIL_VERSION" \
+ DEBUG="" CC="$(tc-getCC)" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" \
+ AUXLIBS_CDB="${AUXLIBS_CDB}" AUXLIBS_LDAP="${AUXLIBS_LDAP}" \
+ AUXLIBS_LMDB="${AUXLIBS_LMDB}" AUXLIBS_MYSQL="${AUXLIBS_MYSQL}" \
+ AUXLIBS_PCRE="${AUXLIBS_PCRE}" AUXLIBS_PGSQL="${AUXLIBS_PGSQL}" \
+ AUXLIBS_SQLITE="${AUXLIBS_SQLITE}"
+}
+
+src_install () {
+ local myconf
+ use doc && myconf="readme_directory=\"/usr/share/doc/${PF}/readme\" \
+ html_directory=\"/usr/share/doc/${PF}/html\""
+
+ LD_LIBRARY_PATH="${S}/lib" \
+ /bin/sh postfix-install \
+ -non-interactive \
+ install_root="${D}" \
+ config_directory="/etc/postfix" \
+ manpage_directory="/usr/share/man" \
+ command_directory="/usr/sbin" \
+ mailq_path="/usr/bin/mailq" \
+ newaliases_path="/usr/bin/newaliases" \
+ sendmail_path="/usr/sbin/sendmail" \
+ ${myconf} \
+ || die "postfix-install failed"
+
+ # Fix spool removal on upgrade
+ rm -Rf "${D}"/var
+ keepdir /var/spool/postfix
+
+ # Install rmail for UUCP, closes bug #19127
+ dobin auxiliary/rmail/rmail
+
+ # Provide another link for legacy FSH
+ dosym /usr/sbin/sendmail /usr/$(get_libdir)/sendmail
+
+ # Install qshape tool and posttls-finger
+ dobin auxiliary/qshape/qshape.pl
+ doman man/man1/qshape.1
+ dobin bin/posttls-finger
+ doman man/man1/posttls-finger.1
+
+ # Performance tuning tools and their manuals
+ dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
+ doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
+
+ # Set proper permissions on required files/directories
+ dodir /var/lib/postfix
+ keepdir /var/lib/postfix
+ fowners -R postfix:postfix /var/lib/postfix
+ fperms 0750 /var/lib/postfix
+ fowners root:postdrop /usr/sbin/post{drop,queue}
+ fperms 02711 /usr/sbin/post{drop,queue}
+
+ keepdir /etc/postfix
+ if use mbox; then
+ mypostconf="mail_spool_directory=/var/spool/mail"
+ else
+ mypostconf="home_mailbox=.maildir/"
+ fi
+ LD_LIBRARY_PATH="${S}/lib" \
+ "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix \
+ -e ${mypostconf} || die "postconf failed"
+
+ insinto /etc/postfix
+ newins "${FILESDIR}"/smtp.pass saslpass
+ fperms 600 /etc/postfix/saslpass
+
+ newinitd "${FILESDIR}"/postfix.rc6.${RC_VER} postfix
+ # do not start mysql/postgres unnecessarily - bug #359913
+ use mysql || sed -i -e "s/mysql //" "${D}/etc/init.d/postfix"
+ use postgres || sed -i -e "s/postgresql //" "${D}/etc/init.d/postfix"
+
+ dodoc *README COMPATIBILITY HISTORY PORTING RELEASE_NOTES*
+ mv "${D}"/etc/postfix/{*.default,makedefs.out,*.proto} "${D}"/usr/share/doc/${PF}/
+ use doc && mv "${S}"/examples "${D}"/usr/share/doc/${PF}/
+
+ pamd_mimic_system smtp auth account
+
+ if use sasl; then
+ insinto /etc/sasl2
+ newins "${FILESDIR}"/smtp.sasl smtpd.conf
+ fi
+
+ # header files
+ insinto /usr/include/postfix
+ doins include/*.h
+
+ # Remove unnecessary files
+ rm -f "${D}"/etc/postfix/{*LICENSE,access,aliases,canonical,generic}
+ rm -f "${D}"/etc/postfix/{header_checks,relocated,transport,virtual}
+
+ if has_version mail-mta/postfix; then
+ # let the sysadmin decide when to change the compatibility_level
+ sed -i -e /^compatibility_level/"s/^/#/" "${D}"/etc/postfix/main.cf || die
+ fi
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+}
+
+pkg_postinst() {
+ # Do not install server.{key,pem) SSL certificates if they already exist
+ if use ssl && [[ ! -f "${ROOT}"/etc/ssl/postfix/server.key \
+ && ! -f "${ROOT}"/etc/ssl/postfix/server.pem ]] ; then
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
+ install_cert /etc/ssl/postfix/server
+ chown postfix:mail "${ROOT}"/etc/ssl/postfix/server.{key,pem}
+ fi
+
+ if [[ ! -e /etc/mail/aliases.db ]] ; then
+ ewarn
+ ewarn "You must edit /etc/mail/aliases to suit your needs"
+ ewarn "and then run /usr/bin/newaliases. Postfix will not"
+ ewarn "work correctly without it."
+ ewarn
+ fi
+}
diff --git a/mail-mta/postfix/postfix-3.0.2.ebuild b/mail-mta/postfix/postfix-3.0.2.ebuild
new file mode 100644
index 00000000000..d3b6b157905
--- /dev/null
+++ b/mail-mta/postfix/postfix-3.0.2.ebuild
@@ -0,0 +1,317 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic multilib pam ssl-cert systemd toolchain-funcs user versionator
+
+MY_PV="${PV/_rc/-RC}"
+MY_SRC="${PN}-${MY_PV}"
+MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official"
+VDA_PV="2.10.0"
+VDA_P="${PN}-vda-v13-${VDA_PV}"
+RC_VER="2.7"
+
+DESCRIPTION="A fast and secure drop-in replacement for sendmail"
+HOMEPAGE="http://www.postfix.org/"
+SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
+ vda? ( http://vda.sourceforge.net/VDA/${VDA_P}.patch ) "
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="+berkdb cdb doc dovecot-sasl +eai hardened ldap ldap-bind lmdb memcached mbox mysql nis pam postgres sasl selinux sqlite ssl vda"
+
+DEPEND=">=dev-libs/libpcre-3.4
+ dev-lang/perl
+ berkdb? ( >=sys-libs/db-3.2:* )
+ cdb? ( || ( >=dev-db/tinycdb-0.76 >=dev-db/cdb-0.75-r1 ) )
+ eai? ( dev-libs/icu:= )
+ ldap? ( net-nds/openldap )
+ ldap-bind? ( net-nds/openldap[sasl] )
+ lmdb? ( >=dev-db/lmdb-0.9.11 )
+ mysql? ( virtual/mysql )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql:* )
+ sasl? ( >=dev-libs/cyrus-sasl-2 )
+ sqlite? ( dev-db/sqlite:3 )
+ ssl? ( >=dev-libs/openssl-0.9.6g:* )"
+
+RDEPEND="${DEPEND}
+ dovecot-sasl? ( net-mail/dovecot )
+ memcached? ( net-misc/memcached )
+ net-mail/mailbase
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ !net-mail/fastforward
+ selinux? ( sec-policy/selinux-postfix )"
+
+# No vda support for postfix-3.0
+REQUIRED_USE="ldap-bind? ( ldap sasl )
+ !vda"
+
+S="${WORKDIR}/${MY_SRC}"
+
+pkg_setup() {
+ # Add postfix, postdrop user/group (bug #77565)
+ enewgroup postfix 207
+ enewgroup postdrop 208
+ enewuser postfix 207 -1 /var/spool/postfix postfix,mail
+}
+
+src_prepare() {
+ if use vda; then
+ epatch "${DISTDIR}"/${VDA_P}.patch
+ fi
+
+ sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
+ src/util/sys_defs.h || die "sed failed"
+
+ # change default paths to better comply with portage standard paths
+ sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
+
+ sed -i -e "/readme_directory\/CONNECTION_CACHE_README/ i\
+ \$readme_directory\/COMPATIBILITY_README:f:root:-:644" conf/postfix-files
+ sed -i -e "/html_directory\/CONNECTION_CACHE_README/ i\
+ \$html_directory\/COMPATIBILITY_README.html:f:root:-:644" conf/postfix-files
+
+ epatch_user
+}
+
+src_configure() {
+ for name in CDB LDAP LMDB MYSQL PCRE PGSQL SDBM SQLITE
+ do
+ local AUXLIBS_${name}=""
+ done
+
+ # Make sure LDFLAGS get passed down to the executables.
+ local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -ldl"
+ AUXLIBS_PCRE="$(pcre-config --libs)"
+
+ use pam && mylibs="${mylibs} -lpam"
+
+ if use ldap; then
+ mycc="${mycc} -DHAS_LDAP"
+ AUXLIBS_LDAP="-lldap -llber"
+ fi
+
+ if use mysql; then
+ mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
+ AUXLIBS_MYSQL="$(mysql_config --libs)"
+ fi
+
+ if use postgres; then
+ mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
+ AUXLIBS_PGSQL="-L$(pg_config --libdir) -lpq"
+ fi
+
+ if use sqlite; then
+ mycc="${mycc} -DHAS_SQLITE"
+ AUXLIBS_SQLITE="-lsqlite3 -lpthread"
+ fi
+
+ if use ssl; then
+ mycc="${mycc} -DUSE_TLS"
+ mylibs="${mylibs} -lssl -lcrypto"
+ fi
+
+ if use lmdb; then
+ mycc="${mycc} -DHAS_LMDB"
+ AUXLIBS_LMDB="-llmdb -lpthread"
+ fi
+
+ if ! use eai; then
+ mycc="${mycc} -DNO_EAI"
+ fi
+
+ # broken. and "in other words, not supported" by upstream.
+ # Use inet_protocols setting in main.cf
+ #if ! use ipv6; then
+ # mycc="${mycc} -DNO_IPV6"
+ #fi
+
+ if use sasl; then
+ if use dovecot-sasl; then
+ # Set dovecot as default.
+ mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
+ fi
+ if use ldap-bind; then
+ mycc="${mycc} -DUSE_LDAP_SASL"
+ fi
+ mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
+ mylibs="${mylibs} -lsasl2"
+ elif use dovecot-sasl; then
+ mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
+ fi
+
+ if ! use nis; then
+ mycc="${mycc} -DNO_NIS"
+ fi
+
+ if ! use berkdb; then
+ mycc="${mycc} -DNO_DB"
+ if use cdb; then
+ # change default hash format from Berkeley DB to cdb
+ mycc="${mycc} -DDEF_DB_TYPE=\\\"cdb\\\""
+ fi
+ fi
+
+ if use cdb; then
+ mycc="${mycc} -DHAS_CDB -I/usr/include/cdb"
+ # Tinycdb is preferred.
+ if has_version dev-db/tinycdb ; then
+ einfo "Building with dev-db/tinycdb"
+ AUXLIBS_CDB="-lcdb"
+ else
+ einfo "Building with dev-db/cdb"
+ CDB_PATH="/usr/$(get_libdir)"
+ for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
+ AUXLIBS_CDB="${AUXLIBS_CDB} ${CDB_PATH}/${i}"
+ done
+ fi
+ fi
+
+ # Robin H. Johnson <robbat2@gentoo.org> 17/Nov/2006
+ # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
+ mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
+ filter-lfs-flags
+
+ # Workaround for bug #76512
+ if use hardened; then
+ [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
+ fi
+
+ # Remove annoying C++ comment style warnings - bug #378099
+ append-flags -Wno-comment
+
+ sed -i -e "/^RANLIB/s/ranlib/$(tc-getRANLIB)/g" "${S}"/makedefs
+ sed -i -e "/^AR/s/ar/$(tc-getAR)/g" "${S}"/makedefs
+
+ emake makefiles shared=yes dynamicmaps=no \
+ shlib_directory="/usr/$(get_libdir)/postfix/MAIL_VERSION" \
+ DEBUG="" CC="$(tc-getCC)" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" \
+ AUXLIBS_CDB="${AUXLIBS_CDB}" AUXLIBS_LDAP="${AUXLIBS_LDAP}" \
+ AUXLIBS_LMDB="${AUXLIBS_LMDB}" AUXLIBS_MYSQL="${AUXLIBS_MYSQL}" \
+ AUXLIBS_PCRE="${AUXLIBS_PCRE}" AUXLIBS_PGSQL="${AUXLIBS_PGSQL}" \
+ AUXLIBS_SQLITE="${AUXLIBS_SQLITE}"
+}
+
+src_install () {
+ local myconf
+ use doc && myconf="readme_directory=\"/usr/share/doc/${PF}/readme\" \
+ html_directory=\"/usr/share/doc/${PF}/html\""
+
+ LD_LIBRARY_PATH="${S}/lib" \
+ /bin/sh postfix-install \
+ -non-interactive \
+ install_root="${D}" \
+ config_directory="/etc/postfix" \
+ manpage_directory="/usr/share/man" \
+ command_directory="/usr/sbin" \
+ mailq_path="/usr/bin/mailq" \
+ newaliases_path="/usr/bin/newaliases" \
+ sendmail_path="/usr/sbin/sendmail" \
+ ${myconf} \
+ || die "postfix-install failed"
+
+ # Fix spool removal on upgrade
+ rm -Rf "${D}"/var
+ keepdir /var/spool/postfix
+
+ # Install rmail for UUCP, closes bug #19127
+ dobin auxiliary/rmail/rmail
+
+ # Provide another link for legacy FSH
+ dosym /usr/sbin/sendmail /usr/$(get_libdir)/sendmail
+
+ # Install qshape tool and posttls-finger
+ dobin auxiliary/qshape/qshape.pl
+ doman man/man1/qshape.1
+ dobin bin/posttls-finger
+ doman man/man1/posttls-finger.1
+
+ # Performance tuning tools and their manuals
+ dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
+ doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
+
+ # Set proper permissions on required files/directories
+ dodir /var/lib/postfix
+ keepdir /var/lib/postfix
+ fowners -R postfix:postfix /var/lib/postfix
+ fperms 0750 /var/lib/postfix
+ fowners root:postdrop /usr/sbin/post{drop,queue}
+ fperms 02711 /usr/sbin/post{drop,queue}
+
+ keepdir /etc/postfix
+ if use mbox; then
+ mypostconf="mail_spool_directory=/var/spool/mail"
+ else
+ mypostconf="home_mailbox=.maildir/"
+ fi
+ LD_LIBRARY_PATH="${S}/lib" \
+ "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix \
+ -e ${mypostconf} || die "postconf failed"
+
+ insinto /etc/postfix
+ newins "${FILESDIR}"/smtp.pass saslpass
+ fperms 600 /etc/postfix/saslpass
+
+ newinitd "${FILESDIR}"/postfix.rc6.${RC_VER} postfix
+ # do not start mysql/postgres unnecessarily - bug #359913
+ use mysql || sed -i -e "s/mysql //" "${D}/etc/init.d/postfix"
+ use postgres || sed -i -e "s/postgresql //" "${D}/etc/init.d/postfix"
+
+ dodoc *README COMPATIBILITY HISTORY PORTING RELEASE_NOTES*
+ mv "${D}"/etc/postfix/{*.default,makedefs.out,*.proto} "${D}"/usr/share/doc/${PF}/
+ use doc && mv "${S}"/examples "${D}"/usr/share/doc/${PF}/
+
+ pamd_mimic_system smtp auth account
+
+ if use sasl; then
+ insinto /etc/sasl2
+ newins "${FILESDIR}"/smtp.sasl smtpd.conf
+ fi
+
+ # header files
+ insinto /usr/include/postfix
+ doins include/*.h
+
+ # Remove unnecessary files
+ rm -f "${D}"/etc/postfix/{*LICENSE,access,aliases,canonical,generic}
+ rm -f "${D}"/etc/postfix/{header_checks,relocated,transport,virtual}
+
+ if has_version mail-mta/postfix; then
+ # let the sysadmin decide when to change the compatibility_level
+ sed -i -e /^compatibility_level/"s/^/#/" "${D}"/etc/postfix/main.cf || die
+ fi
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+}
+
+pkg_postinst() {
+ # Do not install server.{key,pem) SSL certificates if they already exist
+ if use ssl && [[ ! -f "${ROOT}"/etc/ssl/postfix/server.key \
+ && ! -f "${ROOT}"/etc/ssl/postfix/server.pem ]] ; then
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
+ install_cert /etc/ssl/postfix/server
+ chown postfix:mail "${ROOT}"/etc/ssl/postfix/server.{key,pem}
+ fi
+
+ if [[ ! -e /etc/mail/aliases.db ]] ; then
+ ewarn
+ ewarn "You must edit /etc/mail/aliases to suit your needs"
+ ewarn "and then run /usr/bin/newaliases. Postfix will not"
+ ewarn "work correctly without it."
+ ewarn
+ fi
+}
diff --git a/mail-mta/postfix/postfix-3.1_pre20150721.ebuild b/mail-mta/postfix/postfix-3.1_pre20150721.ebuild
new file mode 100644
index 00000000000..cbbcfdc6452
--- /dev/null
+++ b/mail-mta/postfix/postfix-3.1_pre20150721.ebuild
@@ -0,0 +1,312 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic multilib pam ssl-cert systemd toolchain-funcs user versionator
+
+MY_PV="${PV/_pre/-}"
+MY_SRC="${PN}-${MY_PV}"
+MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/experimental"
+VDA_PV="2.10.0"
+VDA_P="${PN}-vda-v13-${VDA_PV}"
+RC_VER="2.7"
+
+DESCRIPTION="A fast and secure drop-in replacement for sendmail"
+HOMEPAGE="http://www.postfix.org/"
+SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
+ vda? ( http://vda.sourceforge.net/VDA/${VDA_P}.patch ) "
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="+berkdb cdb doc dovecot-sasl +eai hardened ldap ldap-bind lmdb memcached mbox mysql nis pam postgres sasl selinux sqlite ssl vda"
+
+DEPEND=">=dev-libs/libpcre-3.4
+ dev-lang/perl
+ berkdb? ( >=sys-libs/db-3.2:* )
+ cdb? ( || ( >=dev-db/tinycdb-0.76 >=dev-db/cdb-0.75-r1 ) )
+ eai? ( dev-libs/icu:= )
+ ldap? ( net-nds/openldap )
+ ldap-bind? ( net-nds/openldap[sasl] )
+ lmdb? ( >=dev-db/lmdb-0.9.11 )
+ mysql? ( virtual/mysql )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql:* )
+ sasl? ( >=dev-libs/cyrus-sasl-2 )
+ sqlite? ( dev-db/sqlite:3 )
+ ssl? ( >=dev-libs/openssl-0.9.6g:* )"
+
+RDEPEND="${DEPEND}
+ dovecot-sasl? ( net-mail/dovecot )
+ memcached? ( net-misc/memcached )
+ net-mail/mailbase
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]
+ !net-mail/fastforward
+ selinux? ( sec-policy/selinux-postfix )"
+
+# No vda support for postfix-3.0
+REQUIRED_USE="ldap-bind? ( ldap sasl )
+ !vda"
+
+S="${WORKDIR}/${MY_SRC}"
+
+pkg_setup() {
+ # Add postfix, postdrop user/group (bug #77565)
+ enewgroup postfix 207
+ enewgroup postdrop 208
+ enewuser postfix 207 -1 /var/spool/postfix postfix,mail
+}
+
+src_prepare() {
+ if use vda; then
+ epatch "${DISTDIR}"/${VDA_P}.patch
+ fi
+
+ sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
+ src/util/sys_defs.h || die "sed failed"
+
+ # change default paths to better comply with portage standard paths
+ sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
+
+ epatch_user
+}
+
+src_configure() {
+ for name in CDB LDAP LMDB MYSQL PCRE PGSQL SDBM SQLITE
+ do
+ local AUXLIBS_${name}=""
+ done
+
+ # Make sure LDFLAGS get passed down to the executables.
+ local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -ldl"
+ AUXLIBS_PCRE="$(pcre-config --libs)"
+
+ use pam && mylibs="${mylibs} -lpam"
+
+ if use ldap; then
+ mycc="${mycc} -DHAS_LDAP"
+ AUXLIBS_LDAP="-lldap -llber"
+ fi
+
+ if use mysql; then
+ mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
+ AUXLIBS_MYSQL="$(mysql_config --libs)"
+ fi
+
+ if use postgres; then
+ mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
+ AUXLIBS_PGSQL="-L$(pg_config --libdir) -lpq"
+ fi
+
+ if use sqlite; then
+ mycc="${mycc} -DHAS_SQLITE"
+ AUXLIBS_SQLITE="-lsqlite3 -lpthread"
+ fi
+
+ if use ssl; then
+ mycc="${mycc} -DUSE_TLS"
+ mylibs="${mylibs} -lssl -lcrypto"
+ fi
+
+ if use lmdb; then
+ mycc="${mycc} -DHAS_LMDB"
+ AUXLIBS_LMDB="-llmdb -lpthread"
+ fi
+
+ if ! use eai; then
+ mycc="${mycc} -DNO_EAI"
+ fi
+
+ # broken. and "in other words, not supported" by upstream.
+ # Use inet_protocols setting in main.cf
+ #if ! use ipv6; then
+ # mycc="${mycc} -DNO_IPV6"
+ #fi
+
+ if use sasl; then
+ if use dovecot-sasl; then
+ # Set dovecot as default.
+ mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
+ fi
+ if use ldap-bind; then
+ mycc="${mycc} -DUSE_LDAP_SASL"
+ fi
+ mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
+ mylibs="${mylibs} -lsasl2"
+ elif use dovecot-sasl; then
+ mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
+ fi
+
+ if ! use nis; then
+ mycc="${mycc} -DNO_NIS"
+ fi
+
+ if ! use berkdb; then
+ mycc="${mycc} -DNO_DB"
+ if use cdb; then
+ # change default hash format from Berkeley DB to cdb
+ mycc="${mycc} -DDEF_DB_TYPE=\\\"cdb\\\""
+ fi
+ fi
+
+ if use cdb; then
+ mycc="${mycc} -DHAS_CDB -I/usr/include/cdb"
+ # Tinycdb is preferred.
+ if has_version dev-db/tinycdb ; then
+ einfo "Building with dev-db/tinycdb"
+ AUXLIBS_CDB="-lcdb"
+ else
+ einfo "Building with dev-db/cdb"
+ CDB_PATH="/usr/$(get_libdir)"
+ for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
+ AUXLIBS_CDB="${AUXLIBS_CDB} ${CDB_PATH}/${i}"
+ done
+ fi
+ fi
+
+ # Robin H. Johnson <robbat2@gentoo.org> 17/Nov/2006
+ # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
+ mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
+ filter-lfs-flags
+
+ # Workaround for bug #76512
+ if use hardened; then
+ [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
+ fi
+
+ # Remove annoying C++ comment style warnings - bug #378099
+ append-flags -Wno-comment
+
+ sed -i -e "/^RANLIB/s/ranlib/$(tc-getRANLIB)/g" "${S}"/makedefs
+ sed -i -e "/^AR/s/ar/$(tc-getAR)/g" "${S}"/makedefs
+
+ emake makefiles shared=yes dynamicmaps=no pie=yes \
+ shlib_directory="/usr/$(get_libdir)/postfix/MAIL_VERSION" \
+ DEBUG="" CC="$(tc-getCC)" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" \
+ AUXLIBS_CDB="${AUXLIBS_CDB}" AUXLIBS_LDAP="${AUXLIBS_LDAP}" \
+ AUXLIBS_LMDB="${AUXLIBS_LMDB}" AUXLIBS_MYSQL="${AUXLIBS_MYSQL}" \
+ AUXLIBS_PCRE="${AUXLIBS_PCRE}" AUXLIBS_PGSQL="${AUXLIBS_PGSQL}" \
+ AUXLIBS_SQLITE="${AUXLIBS_SQLITE}"
+}
+
+src_install () {
+ local myconf
+ use doc && myconf="readme_directory=\"/usr/share/doc/${PF}/readme\" \
+ html_directory=\"/usr/share/doc/${PF}/html\""
+
+ LD_LIBRARY_PATH="${S}/lib" \
+ /bin/sh postfix-install \
+ -non-interactive \
+ install_root="${D}" \
+ config_directory="/etc/postfix" \
+ manpage_directory="/usr/share/man" \
+ command_directory="/usr/sbin" \
+ mailq_path="/usr/bin/mailq" \
+ newaliases_path="/usr/bin/newaliases" \
+ sendmail_path="/usr/sbin/sendmail" \
+ ${myconf} \
+ || die "postfix-install failed"
+
+ # Fix spool removal on upgrade
+ rm -Rf "${D}"/var
+ keepdir /var/spool/postfix
+
+ # Install rmail for UUCP, closes bug #19127
+ dobin auxiliary/rmail/rmail
+
+ # Provide another link for legacy FSH
+ dosym /usr/sbin/sendmail /usr/$(get_libdir)/sendmail
+
+ # Install qshape tool and posttls-finger
+ dobin auxiliary/qshape/qshape.pl
+ doman man/man1/qshape.1
+ dobin bin/posttls-finger
+ doman man/man1/posttls-finger.1
+
+ # Performance tuning tools and their manuals
+ dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
+ doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
+
+ # Set proper permissions on required files/directories
+ dodir /var/lib/postfix
+ keepdir /var/lib/postfix
+ fowners -R postfix:postfix /var/lib/postfix
+ fperms 0750 /var/lib/postfix
+ fowners root:postdrop /usr/sbin/post{drop,queue}
+ fperms 02711 /usr/sbin/post{drop,queue}
+
+ keepdir /etc/postfix
+ if use mbox; then
+ mypostconf="mail_spool_directory=/var/spool/mail"
+ else
+ mypostconf="home_mailbox=.maildir/"
+ fi
+ LD_LIBRARY_PATH="${S}/lib" \
+ "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix \
+ -e ${mypostconf} || die "postconf failed"
+
+ insinto /etc/postfix
+ newins "${FILESDIR}"/smtp.pass saslpass
+ fperms 600 /etc/postfix/saslpass
+
+ newinitd "${FILESDIR}"/postfix.rc6.${RC_VER} postfix
+ # do not start mysql/postgres unnecessarily - bug #359913
+ use mysql || sed -i -e "s/mysql //" "${D}/etc/init.d/postfix"
+ use postgres || sed -i -e "s/postgresql //" "${D}/etc/init.d/postfix"
+
+ dodoc *README COMPATIBILITY HISTORY PORTING RELEASE_NOTES*
+ mv "${D}"/etc/postfix/{*.default,*.proto} "${D}"/usr/share/doc/${PF}/
+ use doc && mv "${S}"/examples "${D}"/usr/share/doc/${PF}/
+
+ pamd_mimic_system smtp auth account
+
+ if use sasl; then
+ insinto /etc/sasl2
+ newins "${FILESDIR}"/smtp.sasl smtpd.conf
+ fi
+
+ # header files
+ insinto /usr/include/postfix
+ doins include/*.h
+
+ # Remove unnecessary files
+ rm -f "${D}"/etc/postfix/{*LICENSE,access,aliases,canonical,generic}
+ rm -f "${D}"/etc/postfix/{header_checks,relocated,transport,virtual}
+
+ if has_version mail-mta/postfix; then
+ # let the sysadmin decide when to change the compatibility_level
+ sed -i -e /^compatibility_level/"s/^/#/" "${D}"/etc/postfix/main.cf || die
+ fi
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+}
+
+pkg_postinst() {
+ # Do not install server.{key,pem) SSL certificates if they already exist
+ if use ssl && [[ ! -f "${ROOT}"/etc/ssl/postfix/server.key \
+ && ! -f "${ROOT}"/etc/ssl/postfix/server.pem ]] ; then
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
+ install_cert /etc/ssl/postfix/server
+ chown postfix:mail "${ROOT}"/etc/ssl/postfix/server.{key,pem}
+ fi
+
+ if [[ ! -e /etc/mail/aliases.db ]] ; then
+ ewarn
+ ewarn "You must edit /etc/mail/aliases to suit your needs"
+ ewarn "and then run /usr/bin/newaliases. Postfix will not"
+ ewarn "work correctly without it."
+ ewarn
+ fi
+}
diff --git a/mail-mta/qmail-ldap/Manifest b/mail-mta/qmail-ldap/Manifest
new file mode 100644
index 00000000000..80258855764
--- /dev/null
+++ b/mail-mta/qmail-ldap/Manifest
@@ -0,0 +1,7 @@
+DIST genqmail-20080406.tar.bz2 10252 SHA256 501ca2120c7619569bd9ac3e0035cb0022bfd0cdc9c720b5c43c9e3a4eb07ce8
+DIST qmail-1.03.tar.gz 220668 SHA256 21ed6c562cbb55092a66197c35c8222b84115d1acab0854fdb1ad1f301626f88
+DIST qmail-ldap-1.03-20060201-controls20060401d.patch 195962 SHA256 49b4418d620af20bb2f3a1b3a9413b51c831bfe7c9ea153f0aef3d5dc76a3577
+DIST qmail-ldap-1.03-20060201.patch.gz 270788 SHA256 92ba895df1957109ad856cc1d1554ece4d25d59017e77127dd52d76afd05525a
+DIST qmail-ldap-1.03-queue-custom-error.patch 2472 SHA256 77536616109591ef5f4bc0f309879167a14b3d6ce4778ff3f2dcaee9a424c25a
+DIST qmail-ldap-1.03-spp-0.42.patch 13618 SHA256 0f673a5944347d5e46c7beffd5d9fa760cecb2e61a3291c3392ffa6777cee8c8
+DIST qmail-spp-0.42.tar.gz 18689 SHA256 1518e7e82d10fbbb8ecc520f51daf503edeb9c3a9fb935be65a8185e7b53808d
diff --git a/mail-mta/qmail-ldap/files/1.03-warnings.patch b/mail-mta/qmail-ldap/files/1.03-warnings.patch
new file mode 100644
index 00000000000..324d4b35730
--- /dev/null
+++ b/mail-mta/qmail-ldap/files/1.03-warnings.patch
@@ -0,0 +1,55 @@
+Files qmail-1.03.orig/auth_imap and qmail-1.03/auth_imap differ
+Files qmail-1.03.orig/auth_pop and qmail-1.03/auth_pop differ
+Files qmail-1.03.orig/auth_smtp and qmail-1.03/auth_smtp differ
+diff -NurpP qmail-1.03.orig/control.c qmail-1.03/control.c
+--- qmail-1.03.orig/control.c 2008-04-06 19:06:15.683511000 +0000
++++ qmail-1.03/control.c 2008-04-06 19:15:47.923622781 +0000
+@@ -1,3 +1,6 @@
++#define _GNU_SOURCE 1
++#include <string.h>
++
+ #include <unistd.h>
+ #include "readwrite.h"
+ #include "open.h"
+@@ -10,10 +13,6 @@
+ #include "scan.h"
+ #include "limit.h"
+
+-#if defined(USE_CONTROLDB) || defined(SECUREBIND_SASL) || defined(SECUREBIND_SSL) || defined(SECUREBIND_TLS) || defined(SECUREBIND_ALL)
+-#include <string.h>
+-#endif
+-
+ #ifdef USE_CONTROLDB
+ #include <syslog.h>
+
+@@ -48,7 +47,6 @@ int control_ldap_search(const char *fn,
+
+ #if defined(SECUREBIND_SASL) || defined(SECUREBIND_SSL) || defined(SECUREBIND_TLS) || defined(SECUREBIND_ALL)
+ #include <malloc.h>
+-#include <string.h>
+ #include <malloc.h>
+
+ #include "subfd.h"
+Files qmail-1.03.orig/control.o and qmail-1.03/control.o differ
+Files qmail-1.03.orig/pbsadd and qmail-1.03/pbsadd differ
+Files qmail-1.03.orig/pbscheck and qmail-1.03/pbscheck differ
+Files qmail-1.03.orig/pbsdbd and qmail-1.03/pbsdbd differ
+Files qmail-1.03.orig/qmail-forward and qmail-1.03/qmail-forward differ
+Files qmail-1.03.orig/qmail-group and qmail-1.03/qmail-group differ
+Files qmail-1.03.orig/qmail-inject and qmail-1.03/qmail-inject differ
+Files qmail-1.03.orig/qmail-ldaplookup and qmail-1.03/qmail-ldaplookup differ
+Files qmail-1.03.orig/qmail-lspawn and qmail-1.03/qmail-lspawn differ
+Files qmail-1.03.orig/qmail-newmrh and qmail-1.03/qmail-newmrh differ
+Files qmail-1.03.orig/qmail-pw2u and qmail-1.03/qmail-pw2u differ
+Files qmail-1.03.orig/qmail-qmqpc and qmail-1.03/qmail-qmqpc differ
+Files qmail-1.03.orig/qmail-qmtpd and qmail-1.03/qmail-qmtpd differ
+Files qmail-1.03.orig/qmail-queue and qmail-1.03/qmail-queue differ
+Files qmail-1.03.orig/qmail-quotawarn and qmail-1.03/qmail-quotawarn differ
+Files qmail-1.03.orig/qmail-remote and qmail-1.03/qmail-remote differ
+Files qmail-1.03.orig/qmail-reply and qmail-1.03/qmail-reply differ
+Files qmail-1.03.orig/qmail-secretary and qmail-1.03/qmail-secretary differ
+Files qmail-1.03.orig/qmail-send and qmail-1.03/qmail-send differ
+Files qmail-1.03.orig/qmail-showctl and qmail-1.03/qmail-showctl differ
+Files qmail-1.03.orig/qmail-smtpd and qmail-1.03/qmail-smtpd differ
+Files qmail-1.03.orig/qmail-todo and qmail-1.03/qmail-todo differ
+Files qmail-1.03.orig/qmail-verify and qmail-1.03/qmail-verify differ
diff --git a/mail-mta/qmail-ldap/files/samples.ldif b/mail-mta/qmail-ldap/files/samples.ldif
new file mode 100644
index 00000000000..c1a77c4d97c
--- /dev/null
+++ b/mail-mta/qmail-ldap/files/samples.ldif
@@ -0,0 +1,32 @@
+#ldapauth, better to use this than your rootdn for security reasons
+dn: uid=ldapauth,ou=People,dc=yhourhost,dc=net
+uid: ldapauth
+cn: ldapuath
+objectClass: account
+objectClass: posixAccount
+objectClass: top
+objectClass: shadowAccount
+shadowLastChange: 12116
+loginShell: /bin/true
+uidNumber: 11184
+gidNumber: 2110
+homeDirectory: /var/qmail/maildirs/
+gecos: ldap authorization,,,
+userPassword: libcrypt_format
+
+#sample user dn
+dn: uid=denverj ,ou=people,dc=yourhost,dc=net
+objectClass: top
+objectClass: inetOrgPerson
+objectClass: qmailUser
+objectClass: person
+cn: John Denver
+givenName: denverj
+sn: denverj
+uid: denverj
+mail: denverj@yourhost.net
+mailMessageStore: /var/qmail/maildirs/denverj/Maildir/
+nohomeDirectory: /var/qmail/maildirs/denverj/
+mailAlternateAddress: denverj@alias.host.net
+userPassword: libcrypt_format
+
diff --git a/mail-mta/qmail-ldap/metadata.xml b/mail-mta/qmail-ldap/metadata.xml
new file mode 100644
index 00000000000..76f44a9e596
--- /dev/null
+++ b/mail-mta/qmail-ldap/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>qmail</herd>
+ <use>
+ <flag name="cluster">Enable this if you want to have cluster support in
+ qmail-ldap</flag>
+ <flag name="gencertdaily">Generate SSL certificates daily instead of
+ hourly</flag>
+ <flag name="highvolume">Prepare qmail for high volume servers</flag>
+ <flag name="rfc2307">Add support for RFC2307 compliant uid/gid
+ attributes</flag>
+ <flag name="rfc822">Add support for RFC822 compliant mail
+ attributes</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">qmail-spp</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/mail-mta/qmail-ldap/qmail-ldap-1.03-r8.ebuild b/mail-mta/qmail-ldap/qmail-ldap-1.03-r8.ebuild
new file mode 100644
index 00000000000..eaa93338c92
--- /dev/null
+++ b/mail-mta/qmail-ldap/qmail-ldap-1.03-r8.ebuild
@@ -0,0 +1,226 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+GENQMAIL_PV=20080406
+QMAIL_SPP_PV=0.42
+
+QMAIL_LDAP_PV=20060201
+QMAIL_LDAP_F=${P}-${QMAIL_LDAP_PV}.patch.gz
+
+QMAIL_LDAP_SPP_F=${P}-spp-${QMAIL_SPP_PV}.patch
+
+QMAIL_LDAP_CONTROLS_PV=20060401d
+QMAIL_LDAP_CONTROLS_F=${P}-${QMAIL_LDAP_PV}-controls${QMAIL_LDAP_CONTROLS_PV}.patch
+
+inherit eutils qmail
+
+DESCRIPTION="qmail -- a secure, reliable, efficient, simple message transfer agent"
+HOMEPAGE="
+ http://www.qmail-ldap.org
+ http://cr.yp.to/qmail.html
+ http://qmail.org
+"
+SRC_URI="mirror://qmail/qmail-${PV}.tar.gz
+ http://dev.gentoo.org/~hollow/distfiles/${GENQMAIL_F}
+ http://www.nrg4u.com/qmail/${QMAIL_LDAP_F}
+ mirror://gentoo/${QMAIL_LDAP_CONTROLS_F}
+ mirror://gentoo/${P}-queue-custom-error.patch
+ !vanilla? (
+ qmail-spp? (
+ mirror://sourceforge/qmail-spp/${QMAIL_SPP_F}
+ mirror://gentoo/${QMAIL_LDAP_SPP_F}
+ )
+ )
+"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="cluster debug gencertdaily highvolume qmail-spp rfc2307 rfc822 ssl vanilla zlib"
+RESTRICT="test"
+
+DEPEND="
+ !mail-mta/qmail
+ net-nds/openldap
+ net-mail/queue-repair
+ ssl? ( dev-libs/openssl )
+"
+RDEPEND="
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ !mail-mta/ssmtp
+ >=sys-apps/ucspi-tcp-0.88-r17
+ ssl? ( >=sys-apps/ucspi-ssl-0.70-r1 )
+ virtual/daemontools
+ >=net-mail/dot-forward-0.71-r3
+ ${DEPEND}
+"
+
+S="${WORKDIR}"/qmail-${PV}
+
+pkg_setup() {
+ if [[ -n "${QMAIL_PATCH_DIR}" ]]; then
+ eerror
+ eerror "The QMAIL_PATCH_DIR variable for custom patches"
+ eerror "has been removed from ${PN}. If you need custom patches"
+ eerror "you should create a copy of this ebuild in an overlay."
+ eerror
+ die "QMAIL_PATCH_DIR is not supported anymore"
+ fi
+
+ qmail_create_users
+}
+
+src_unpack() {
+ genqmail_src_unpack
+ use qmail-spp && qmail_spp_src_unpack
+
+ unpack qmail-${PV}.tar.gz
+
+ cd "${S}"
+
+ # main ldap patch
+ # includes: netqmail-1.05, EXTTODO, BIGTODO, TLS/SMTPAUTH, 0.0.0.0 fix
+ epatch "${DISTDIR}"/${QMAIL_LDAP_F}
+
+ # QmailLDAP/Controls patch
+ # includes: RFC2307/822 fixes
+ epatch "${DISTDIR}"/${QMAIL_LDAP_CONTROLS_F}
+ epatch "${FILESDIR}"/${PV}-warnings.patch
+
+ # fix libraries for controls patch
+ sed -i -e 's|NEWLDAPPROGLIBS=.*|& str.a|' Makefile
+
+ ht_fix_file Makefile*
+
+ if ! use vanilla; then
+ # Add custom bounce messages to qmail-queue
+ epatch "${DISTDIR}"/${P}-queue-custom-error.patch
+
+ # qmail-spp patch
+ use qmail-spp && epatch "${DISTDIR}"/${QMAIL_LDAP_SPP_F}
+ fi
+
+ # makefile options
+ local INCLUDES="-I/usr/include"
+ local LDAPLIBS="-L/usr/lib -lldap -llber"
+ local LDAPFLAGS="-DALTQUEUE -DEXTERNAL_TODO -DDASH_EXT -DSMTPEXECCHECK"
+ local CONTROLDB="-DUSE_CONTROLDB -DQLDAP_BAILOUT"
+ local SECUREBIND= RFCFLAGS=
+
+ use cluster && LDAPFLAGS="${LDAPFLAGS} -DQLDAP_CLUSTER"
+ use highvolume && LDAPFLAGS="${LDAPFLAGS} -DBIGTODO"
+ use zlib && LDAPFLAGS="${LDAPFLAGS} -DDATA_COMPRESS -D QMQP_COMPRESS"
+
+ use rfc2307 && RFCFLAGS="${RFCFLAGS} -DUSE_RFC2307"
+ use rfc822 && RFCFLAGS="${RFCFLAGS} -DUSE_RFC822"
+
+ use ssl && SECUREBIND="-DSECUREBIND_TLS -DSECUREBIND_SSL"
+
+ # a lot of sed magic to get Makefile right
+ local EXP=
+
+ EXP="${EXP} s|^#LDAPINCLUDES=.*|LDAPINCLUDES=${INCLUDES}|;"
+ EXP="${EXP} s|^#LDAPLIBS=.*|LDAPLIBS=${LDAPLIBS}|;"
+ EXP="${EXP} s|^#LDAPFLAGS=.*|LDAPFLAGS=${LDAPFLAGS}|;"
+
+ EXP="${EXP} s|^#CONTROLDB=.*|CONTROLDB=${CONTROLDB}|;"
+ EXP="${EXP} s|^#RFCFLAGS=.*|RFCFLAGS=${RFCFLAGS}|;"
+ EXP="${EXP} s|^#SECUREBIND=.*|SECUREBIND=${SECUREBIND}|;"
+
+ # TODO: do we even need this with LDAP?
+ EXP="${EXP} s|^#SHADOWLIBS=.*|SHADOWLIBS=-lcrypt|;"
+
+ # automagic maildir creation
+ EXP="${EXP} s|^#\(MDIRMAKE=.*\)|\1|;"
+ EXP="${EXP} s|^#\(HDIRMAKE=.*\)|\1|;"
+
+ use debug && EXP="${EXP} s|^#\(DEBUG=.*\)|\1|;"
+ use zlib && EXP="${EXP} s|^#ZLIB=.*|ZLIB=-lz|;"
+
+ if use ssl; then
+ EXP="${EXP} s|^#\(TLS=.*\)|\1|;"
+ EXP="${EXP} s|^#TLSINCLUDES=.*|TLSINCLUDES=${INCLUDES}|;"
+ EXP="${EXP} s|^#TLSLIBS=.*|TLSLIBS=-L/usr/lib -lssl -lcrypto|;"
+ EXP="${EXP} s|^#OPENSSLBIN=.*|OPENSSLBIN=/usr/bin/openssl|;"
+ fi
+
+ qmail_src_postunpack
+
+ sed -i -e "${EXP}" Makefile || die "could not patch Makefile"
+}
+
+src_compile() {
+ qmail_src_compile ldap
+ use qmail-spp && qmail_spp_src_compile
+}
+
+qmail_full_install_hook() {
+ insinto ${QMAIL_HOME}/bin
+ insopts -o root -g qmail -m 0755
+ doins auth_smtp condwrite digest dirmaker pbs{add,check,dbd} \
+ qmail-{forward,group,quotawarn,reply,secretary,verify}
+
+ insopts -o root -g root -m 0750
+ doins qmail-ldaplookup
+
+ insopts -o root -g qmail -m 0711
+ doins qmail-todo
+
+ insopts -o root -g qmail -m 0700
+ doins auth_{imap,pop} qmail-cdb
+}
+
+qmail_man_install_hook() {
+ dodoc EXTTODO POPBEFORESMTP QLDAP* "${FILESDIR}"/samples.ldif
+}
+
+qmail_config_install_hook() {
+ einfo "Installing OpenLDAP schema"
+ insinto /etc/openldap/schema
+ doins qmail.schema qmail-ldap-control/qmailControl.schema
+}
+
+src_install() {
+ qmail_src_install
+}
+
+pkg_postinst() {
+ qmail_queue_setup
+ qmail_rootmail_fixup
+ qmail_tcprules_build
+
+ qmail_config_notice
+ qmail_supervise_config_notice
+ elog
+ elog "If you are looking for documentation, check those links:"
+ elog "http://www.lifewithqmail.com/ldap/"
+ elog " -- Life with qmail-ldap"
+ elog
+ elog "For sample ldifs, please check /usr/share/doc/${PF}/"
+ elog
+}
+
+pkg_preinst() {
+ qmail_tcprules_fixup
+}
+
+pkg_config() {
+ # avoid some weird locale problems
+ export LC_ALL=C
+
+ qmail_config_fast
+ qmail_tcprules_config
+ qmail_tcprules_build
+
+ use ssl && qmail_ssl_generate
+}
diff --git a/mail-mta/qpsmtpd/Manifest b/mail-mta/qpsmtpd/Manifest
new file mode 100644
index 00000000000..f1274c3de49
--- /dev/null
+++ b/mail-mta/qpsmtpd/Manifest
@@ -0,0 +1,2 @@
+DIST qpsmtpd-0.84.tar.gz 178260 SHA256 a09865816322531edd59d6fecd4bda35a9d583610b69d69a86e44038da841c98 SHA512 a12491c123d21b4e3965105bbe88ad7e7e61551a3ff4e96eee78c83dcb2afae62239fa24d710092a7ccf60097699901c42d70df8183de6454bef4fb26843358d WHIRLPOOL dfc0049faebbbe203949b24fc6d49213c606f5fbe24b4df35b2be8c8cc77d2350719f304a9c7f16782a67d64a5101debb03baa204d91f97adeaa072bf942a3fb
+DIST qpsmtpd-0.95.tar.gz 367400 SHA256 ec5a7d202f4a90ef1df5581c669440082cd5a4c24f5cf4b86f23b323835c7fdb SHA512 4265606ecde68eda92091e2c3c27645baa131db4197f3d135932dc2ad8d76c1fb6c25ce267ab421cab3a4a9902aa682e4be87a1228e41b226705a64e440ffe87 WHIRLPOOL ea927d322d5b5bb82eb80e279e5ca9f461afd42bbb0922470cf97ca8e87578ae968116ccc263eec57676ca2fa3b4b582a11757f6eb9c15c100664451f989d3cd
diff --git a/mail-mta/qpsmtpd/files/qpsmtpd-0.40-badrcptto_allowrelay.patch b/mail-mta/qpsmtpd/files/qpsmtpd-0.40-badrcptto_allowrelay.patch
new file mode 100644
index 00000000000..1f9f33f9a14
--- /dev/null
+++ b/mail-mta/qpsmtpd/files/qpsmtpd-0.40-badrcptto_allowrelay.patch
@@ -0,0 +1,10 @@
+--- qpsmtpd-0.40/plugins/check_badrcptto.badrcptto_allowrelay 2007-06-14 11:57:24.000000000 -0600
++++ qpsmtpd-0.40/plugins/check_badrcptto 2007-06-14 13:26:42.000000000 -0600
+@@ -3,6 +3,7 @@
+
+ sub hook_rcpt {
+ my ($self, $transaction, $recipient, %param) = @_;
++ return (DECLINED) if $self->qp->connection->relay_client;
+ my @badrcptto = $self->qp->config("badrcptto") or return (DECLINED);
+ return (DECLINED) unless $recipient->host && $recipient->user;
+ my $host = lc $recipient->host;
diff --git a/mail-mta/qpsmtpd/files/qpsmtpd-0.83-accept-empty-email.patch b/mail-mta/qpsmtpd/files/qpsmtpd-0.83-accept-empty-email.patch
new file mode 100644
index 00000000000..2e1dcacc46c
--- /dev/null
+++ b/mail-mta/qpsmtpd/files/qpsmtpd-0.83-accept-empty-email.patch
@@ -0,0 +1,44 @@
+Accept messages with no body.
+
+If a message has no body, there is nothing in the RFC spec that says it
+needs to have a trailing \n for a blank line after the headers.
+
+Thumderbird 10 generates some emails like this, which will always cause
+plugin errors when $transaction->header is accessed otherwise, as there
+is almost no checking that $transaction->header is defined before usage.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+Thanks-To: Jack Bates <ms419@freezone.co.uk>
+
+--- qpsmtpd-0.83.orig/lib/Qpsmtpd/SMTP.pm 2009-04-03 06:24:21.000000000 +0000
++++ qpsmtpd-0.83/lib/Qpsmtpd/SMTP.pm 2012-02-25 05:52:14.000000000 +0000
+@@ -632,7 +632,7 @@
+
+ my $timeout = $self->config('timeout');
+ while (defined($_ = $self->getline($timeout))) {
+- $complete++, last if $_ eq ".\r\n";
++ $complete++, $_ = '' if $_ eq ".\r\n";
+ $i++;
+
+ # should probably use \012 and \015 in these checks instead of \r and \n ...
+@@ -648,7 +648,7 @@
+ unless (($max_size and $size > $max_size)) {
+ s/\r\n$/\n/;
+ s/^\.\./\./;
+- if ($in_header and m/^$/) {
++ if ($in_header and (m/^$/ or $complete > 0)) {
+ $in_header = 0;
+ my @headers = split /^/m, $buffer;
+
+@@ -691,9 +691,10 @@
+
+ # copy all lines into the spool file, including the headers
+ # we will create a new header later before sending onwards
+- $self->transaction->body_write($_);
++ $self->transaction->body_write($_) unless $complete;
+ $size += length $_;
+ }
++ last if $complete > 0;
+ #$self->log(LOGDEBUG, "size is at $size\n") unless ($i % 300);
+ }
+
diff --git a/mail-mta/qpsmtpd/files/qpsmtpd-0.83-clamd_conf.patch b/mail-mta/qpsmtpd/files/qpsmtpd-0.83-clamd_conf.patch
new file mode 100644
index 00000000000..801dc477df9
--- /dev/null
+++ b/mail-mta/qpsmtpd/files/qpsmtpd-0.83-clamd_conf.patch
@@ -0,0 +1,12 @@
+diff -Nuar --exclude '*.orig' --exclude '*.rej' qpsmtpd-0.83.orig/plugins/virus/clamav qpsmtpd-0.83/plugins/virus/clamav
+--- qpsmtpd-0.83.orig/plugins/virus/clamav 2009-07-20 15:36:17.000000000 +0000
++++ qpsmtpd-0.83/plugins/virus/clamav 2009-09-16 01:14:22.903329780 +0000
+@@ -151,7 +151,7 @@
+ $self->{_max_size} ||= 512 * 1024;
+ $self->{_spool_dir} ||= $self->spool_dir();
+ $self->{_back_compat} ||= ''; # make sure something is set
+- $self->{_clamd_conf} ||= '/etc/clamd/conf'; # make sure something is set
++ $self->{_clamd_conf} ||= '/etc/clamd.conf'; # make sure something is set
+ $self->{_declined_on_fail} ||= 0; # decline the message on clamav failure
+
+ unless ($self->{_spool_dir}) {
diff --git a/mail-mta/qpsmtpd/files/qpsmtpd-0.84-Net-DNS-id.patch b/mail-mta/qpsmtpd/files/qpsmtpd-0.84-Net-DNS-id.patch
new file mode 100644
index 00000000000..6331e98cb48
--- /dev/null
+++ b/mail-mta/qpsmtpd/files/qpsmtpd-0.84-Net-DNS-id.patch
@@ -0,0 +1,28 @@
+Net::DNS function nextid() changed to id().
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar qpsmtpd-0.84.orig/qpsmtpd-async qpsmtpd-0.84/qpsmtpd-async
+--- qpsmtpd-0.84.orig/qpsmtpd-async 2009-04-03 05:48:34.000000000 +0000
++++ qpsmtpd-0.84/qpsmtpd-async 2013-04-15 23:01:49.952857659 +0000
+@@ -145,7 +145,7 @@
+ # print "Next DNS ID: $Net::DNS::Resolver::global{id}\n";
+ };
+ if ($@) {
+- # print "Next DNS ID: " . Net::DNS::Header::nextid() . "\n";
++ # print "Next DNS ID: " . Net::DNS::Header::id() . "\n";
+ }
+
+ # Fixup lost kqueue after fork
+diff -Nuar qpsmtpd-0.84.orig/qpsmtpd-forkserver qpsmtpd-0.84/qpsmtpd-forkserver
+--- qpsmtpd-0.84.orig/qpsmtpd-forkserver 2010-04-08 05:29:52.000000000 +0000
++++ qpsmtpd-0.84/qpsmtpd-forkserver 2013-04-15 23:01:49.952857659 +0000
+@@ -285,7 +285,7 @@
+ # all children should have different seeds, to prevent conflicts
+ srand();
+ for (0 .. rand(65536)) {
+- Net::DNS::Header::nextid();
++ Net::DNS::Header::id();
+ }
+
+ close $_ for $select->handles;
diff --git a/mail-mta/qpsmtpd/files/qpsmtpd.confd b/mail-mta/qpsmtpd/files/qpsmtpd.confd
new file mode 100644
index 00000000000..9a82c7100e2
--- /dev/null
+++ b/mail-mta/qpsmtpd/files/qpsmtpd.confd
@@ -0,0 +1,25 @@
+# Config file for /etc/init.d/qpsmtpd
+#
+
+QPSMTPD_CONFIG="/etc/qpsmtpd"
+QPSMTPD_NICELEVEL="0"
+
+# Select QPSMTPD server type
+# - async
+# Not all plugins work without problems with the async mode.
+# - forkserver (default)
+# - prefork
+# Does not work 100%. Use at your own risk.
+QPSMTPD_SERVER_TYPE="forkserver"
+
+# QPSMTPD options. This can be different depending on
+# what QPSMTPD server you run.
+#
+# Typical forkserver
+QPSMTPD_OPTIONS="-l 0.0.0.0 -p 25 -u smtpd"
+#
+# Typical prefork
+# QPSMTPD_OPTIONS="--interface 0.0.0.0 --port 25 --user smtpd"
+#
+# Typical async
+# QPSMTPD_OPTIONS="-l 0.0.0.0 -p 25 -u smtpd"
diff --git a/mail-mta/qpsmtpd/files/qpsmtpd.envd b/mail-mta/qpsmtpd/files/qpsmtpd.envd
new file mode 100644
index 00000000000..3665116f34e
--- /dev/null
+++ b/mail-mta/qpsmtpd/files/qpsmtpd.envd
@@ -0,0 +1,2 @@
+QPSMTPD_CONFIG="/etc/qpsmtpd"
+CONFIG_PROTECT="/usr/share/qpsmtpd/plugins"
diff --git a/mail-mta/qpsmtpd/files/qpsmtpd.initd b/mail-mta/qpsmtpd/files/qpsmtpd.initd
new file mode 100644
index 00000000000..b9500b6713c
--- /dev/null
+++ b/mail-mta/qpsmtpd/files/qpsmtpd.initd
@@ -0,0 +1,62 @@
+#!/sbin/runscript
+
+pidfile=/var/run/qpsmtpd/qpsmtpd.pid
+
+depend() {
+ use logger dns ypbind amavisd mysql postgresql antivirus postfix_greylist net saslauthd
+ provide mta
+}
+
+checkconfig() {
+ if ! [ -d "${QPSMTPD_CONFIG:-/etc/qpsmtpd}" ]; then
+ eerror "Configuration directory ${QPSMTPD_CONFIG:-/etc/qpsmtpd} does not exist."
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting qpsmtpd [${QPSMTPD_SERVER_TYPE}] server"
+ HOME="/var/spool/qpsmtpd"
+ local QPSMTPD_SERVER_BIN=""
+ local myopts=""
+ export QPSMTPD_CONFIG=${QPSMTPD_CONFIG}
+ for foo in PERL_UNICODE LANG LC_TIME LC_ALL BASH_ENV ENV CDPATH IFS
+ do
+ unset ${foo}
+ done
+ case "${QPSMTPD_SERVER_TYPE}" in
+ prefork)
+ QPSMTPD_SERVER_BIN="/usr/bin/qpsmtpd-prefork"
+ QPSMTPD_OPTIONS="$(echo "${QPSMTPD_OPTIONS}" | sed "s:\-\-pid\-file[\t ]\{1,99\}[^ ]*::gI")"
+ # Option --pid-file is mentioned in the help of the prefork server
+ # but does not work when specified.
+ # QPSMTPD_OPTIONS="${QPSMTPD_OPTIONS} --pid-file ${pidfile}"
+ myopts="${myopts} --make-pidfile --pidfile ${pidfile}"
+ ;;
+ async)
+ QPSMTPD_SERVER_BIN="/usr/sbin/qpsmtpd-async"
+ myopts="${myopts} --background --make-pidfile --pidfile ${pidfile}"
+ ;;
+ forkserver|*)
+ QPSMTPD_SERVER_BIN="/usr/bin/qpsmtpd-forkserver"
+ QPSMTPD_OPTIONS="$(echo "${QPSMTPD_OPTIONS}" | sed "s:\-\-pid\-file[\t ]\{1,99\}[^ ]*::gI")"
+ QPSMTPD_OPTIONS="$(echo "${QPSMTPD_OPTIONS}" | sed "s:[\t ]\{0,99\}\-d[\t ]\{1,99\}|[\t ]\{1,99\}\-d[\t ]\{0,99\}::gI")"
+ QPSMTPD_OPTIONS="$(echo "${QPSMTPD_OPTIONS}" | sed "s:[\t ]\{0,99\}\-\detach[\t ]\{1,99\}|[\t ]\{1,99\}\-\-detach[\t ]\{0,99\}::gI")"
+ QPSMTPD_OPTIONS="${QPSMTPD_OPTIONS} --pid-file ${pidfile} --detach"
+ myopts="${myopts} --pidfile ${pidfile}"
+ ;;
+ esac
+ start-stop-daemon --start --nicelevel ${QPSMTPD_NICELEVEL:-0} \
+ --quiet ${myopts} \
+ --exec ${QPSMTPD_SERVER_BIN} \
+ -- ${QPSMTPD_OPTIONS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping qpsmtpd [${QPSMTPD_SERVER_TYPE}] server"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/mail-mta/qpsmtpd/files/qpsmtpd.initd-r1 b/mail-mta/qpsmtpd/files/qpsmtpd.initd-r1
new file mode 100644
index 00000000000..1844dfce908
--- /dev/null
+++ b/mail-mta/qpsmtpd/files/qpsmtpd.initd-r1
@@ -0,0 +1,62 @@
+#!/sbin/runscript
+
+pidfile=/run/qpsmtpd/qpsmtpd.pid
+
+depend() {
+ use logger dns ypbind amavisd mysql postgresql antivirus postfix_greylist net saslauthd
+ provide mta
+}
+
+checkconfig() {
+ if ! [ -d "${QPSMTPD_CONFIG:-/etc/qpsmtpd}" ]; then
+ eerror "Configuration directory ${QPSMTPD_CONFIG:-/etc/qpsmtpd} does not exist."
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting qpsmtpd [${QPSMTPD_SERVER_TYPE}] server"
+ HOME="/var/spool/qpsmtpd"
+ local QPSMTPD_SERVER_BIN=""
+ local myopts=""
+ export QPSMTPD_CONFIG=${QPSMTPD_CONFIG}
+ for foo in PERL_UNICODE LANG LC_TIME LC_ALL BASH_ENV ENV CDPATH IFS
+ do
+ unset ${foo}
+ done
+ case "${QPSMTPD_SERVER_TYPE}" in
+ prefork)
+ QPSMTPD_SERVER_BIN="/usr/bin/qpsmtpd-prefork"
+ QPSMTPD_OPTIONS="$(echo "${QPSMTPD_OPTIONS}" | sed "s:\-\-pid\-file[\t ]\{1,99\}[^ ]*::gI")"
+ # Option --pid-file is mentioned in the help of the prefork server
+ # but does not work when specified.
+ # QPSMTPD_OPTIONS="${QPSMTPD_OPTIONS} --pid-file ${pidfile}"
+ myopts="${myopts} --make-pidfile --pidfile ${pidfile}"
+ ;;
+ async)
+ QPSMTPD_SERVER_BIN="/usr/sbin/qpsmtpd-async"
+ myopts="${myopts} --background --make-pidfile --pidfile ${pidfile}"
+ ;;
+ forkserver|*)
+ QPSMTPD_SERVER_BIN="/usr/bin/qpsmtpd-forkserver"
+ QPSMTPD_OPTIONS="$(echo "${QPSMTPD_OPTIONS}" | sed "s:\-\-pid\-file[\t ]\{1,99\}[^ ]*::gI")"
+ QPSMTPD_OPTIONS="$(echo "${QPSMTPD_OPTIONS}" | sed "s:[\t ]\{0,99\}\-d[\t ]\{1,99\}|[\t ]\{1,99\}\-d[\t ]\{0,99\}::gI")"
+ QPSMTPD_OPTIONS="$(echo "${QPSMTPD_OPTIONS}" | sed "s:[\t ]\{0,99\}\-\detach[\t ]\{1,99\}|[\t ]\{1,99\}\-\-detach[\t ]\{0,99\}::gI")"
+ QPSMTPD_OPTIONS="${QPSMTPD_OPTIONS} --pid-file ${pidfile} --detach"
+ myopts="${myopts} --pidfile ${pidfile}"
+ ;;
+ esac
+ start-stop-daemon --start --nicelevel ${QPSMTPD_NICELEVEL:-0} \
+ --quiet ${myopts} \
+ --exec ${QPSMTPD_SERVER_BIN} \
+ -- ${QPSMTPD_OPTIONS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping qpsmtpd [${QPSMTPD_SERVER_TYPE}] server"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/mail-mta/qpsmtpd/files/qpsmtpd.xinetd b/mail-mta/qpsmtpd/files/qpsmtpd.xinetd
new file mode 100644
index 00000000000..71cb21c2b98
--- /dev/null
+++ b/mail-mta/qpsmtpd/files/qpsmtpd.xinetd
@@ -0,0 +1,20 @@
+# default: off
+# description: The telnet server serves telnet sessions; it uses \
+# unencrypted username/password pairs for authentication.
+
+service smtp
+{
+ flags = REUSE
+ socket_type = stream
+ wait = no
+ user = smtpd
+ group = smtpd
+ groups = yes
+ log_on_failure += USERID HOST
+ disable = yes
+ rlimit_as = 128M
+ instances = 40
+ per_source = 10
+ cps = 50 10
+ server = /usr/bin/qpsmtpd
+}
diff --git a/mail-mta/qpsmtpd/metadata.xml b/mail-mta/qpsmtpd/metadata.xml
new file mode 100644
index 00000000000..3bf0de5331b
--- /dev/null
+++ b/mail-mta/qpsmtpd/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>net-mail</herd>
+<use>
+ <flag name='postfix'>create user with permissions for proper postfix interaction</flag>
+</use>
+</pkgmetadata>
diff --git a/mail-mta/qpsmtpd/qpsmtpd-0.84-r2.ebuild b/mail-mta/qpsmtpd/qpsmtpd-0.84-r2.ebuild
new file mode 100644
index 00000000000..81ace43134b
--- /dev/null
+++ b/mail-mta/qpsmtpd/qpsmtpd-0.84-r2.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils perl-app user
+
+DESCRIPTION="qpsmtpd is a flexible smtpd daemon written in Perl"
+HOMEPAGE="http://smtpd.develooper.com"
+SRC_URI="http://smtpd.develooper.com/files/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="postfix ipv6 syslog"
+
+RDEPEND=">=dev-lang/perl-5.8.0
+ >=dev-perl/Net-DNS-0.690.0
+ virtual/perl-MIME-Base64
+ dev-perl/MailTools
+ dev-perl/IPC-Shareable
+ dev-perl/Socket6
+ dev-perl/Danga-Socket
+ dev-perl/ParaDNS
+ ipv6? ( dev-perl/IO-Socket-INET6 )
+ syslog? ( virtual/perl-Sys-Syslog )
+ virtual/inetd"
+
+pkg_setup() {
+ enewgroup smtpd
+ local additional_groups
+ if use postfix; then
+ additional_groups="${additional_groups},postdrop"
+ fi
+ enewuser smtpd -1 -1 /var/spool/qpsmtpd smtpd${additional_groups}
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-0.40-badrcptto_allowrelay.patch
+ #epatch "${FILESDIR}"/${PN}-0.83-clamd_conf.patch
+ epatch "${FILESDIR}"/${PN}-0.83-accept-empty-email.patch
+ epatch "${FILESDIR}"/${PN}-0.84-Net-DNS-id.patch
+}
+
+src_install() {
+ perl-module_src_install
+
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}"/qpsmtpd.xinetd qpsmtpd
+
+ dodir /usr/share/qpsmtpd
+ cp -Rf plugins "${D}"/usr/share/qpsmtpd/
+
+ insinto /etc/qpsmtpd
+ doins config.sample/*
+
+ echo "/usr/share/qpsmtpd/plugins" > "${D}"/etc/qpsmtpd/plugin_dirs
+ echo "/var/spool/qpsmtpd" > "${D}"/etc/qpsmtpd/spool_dir
+ cat >"${D}"/etc/qpsmtpd/logging <<-EOF
+ #logging/syslog loglevel LOGINFO priority LOG_NOTICE
+ #logging/file loglevel LOGINFO /var/log/qpsmtpd/%Y-%m-%d
+ EOF
+ if use syslog; then
+ sed -i -e '/^#logging\/syslog/s,^#,,g' "${D}"/etc/qpsmtpd/logging || die
+ else
+ sed -i -e '/^#logging\/file/s,^#,,g' "${D}"/etc/qpsmtpd/logging || die
+ fi
+
+ newenvd "${FILESDIR}"/qpsmtpd.envd 99qpsmtpd
+
+ newconfd "${FILESDIR}"/qpsmtpd.confd qpsmtpd
+ newinitd "${FILESDIR}"/qpsmtpd.initd-r1 qpsmtpd
+
+ dodoc CREDITS Changes README README.plugins STATUS
+
+ diropts -m 0755 -o smtpd -g smtpd
+ dodir /var/spool/qpsmtpd /var/log/qpsmtpd
+ keepdir /var/spool/qpsmtpd /var/log/qpsmtpd
+
+}
diff --git a/mail-mta/qpsmtpd/qpsmtpd-0.95.ebuild b/mail-mta/qpsmtpd/qpsmtpd-0.95.ebuild
new file mode 100644
index 00000000000..89360694179
--- /dev/null
+++ b/mail-mta/qpsmtpd/qpsmtpd-0.95.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+[[ ${PV} == *9999 ]] && SCM="git-2"
+inherit eutils perl-app user ${SCM}
+
+DESCRIPTION="qpsmtpd is a flexible smtpd daemon written in Perl"
+HOMEPAGE="http://smtpd.develooper.com"
+KEYWORDS=""
+if [[ ${PV} != *9999 ]]; then
+ SRC_URI="https://github.com/smtpd/qpsmtpd/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+else
+ # This is a spotted development fork with many improvements
+EGIT_REPO_URI="git://github.com/qpsmtpd-dev/qpsmtpd-dev.git
+ https://github.com/qpsmtpd-dev/qpsmtpd-dev.git"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS=""
+IUSE="postfix ipv6 syslog"
+
+RDEPEND=">=dev-lang/perl-5.8.0
+ >=dev-perl/Net-DNS-0.690.0
+ virtual/perl-MIME-Base64
+ dev-perl/MailTools
+ dev-perl/IPC-Shareable
+ dev-perl/Socket6
+ dev-perl/Danga-Socket
+ dev-perl/ParaDNS
+ dev-perl/UNIVERSAL-isa
+ ipv6? ( dev-perl/IO-Socket-INET6 )
+ syslog? ( virtual/perl-Sys-Syslog )
+ virtual/inetd"
+
+pkg_setup() {
+ enewgroup smtpd
+ local additional_groups
+ if use postfix; then
+ additional_groups="${additional_groups},postdrop"
+ fi
+ enewuser smtpd -1 -1 /var/spool/qpsmtpd smtpd${additional_groups}
+}
+
+src_unpack() {
+ if [[ ${PV} != *9999 ]]; then
+ unpack ${A}
+ cd "${S}"
+ else
+ git-2_src_unpack
+ cd "${S}"
+ fi
+}
+
+src_install() {
+ perl-module_src_install
+
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}"/qpsmtpd.xinetd qpsmtpd
+
+ dodir /usr/share/qpsmtpd
+ cp -Rf plugins "${D}"/usr/share/qpsmtpd/
+
+ diropts -m 0755 -o smtpd -g smtpd
+ dodir /var/spool/qpsmtpd
+ keepdir /var/spool/qpsmtpd
+
+ dodir /etc/qpsmtpd
+ insinto /etc/qpsmtpd
+ doins config.sample/*
+
+ echo "/usr/share/qpsmtpd/plugins" > "${D}"/etc/qpsmtpd/plugin_dirs
+ echo "/var/spool/qpsmtpd" > "${D}"/etc/qpsmtpd/spool_dir
+ if use syslog; then
+ echo "logging/syslog loglevel LOGINFO priority LOG_NOTICE" > "${D}"/etc/qpsmtpd/logging
+ else
+ diropts -m 0755 -o smtpd -g smtpd
+ dodir /var/log/qpsmtpd
+ keepdir /var/log/qpsmtpd
+ echo "logging/file loglevel LOGINFO /var/log/qpsmtpd/%Y-%m-%d" > "${D}"/etc/qpsmtpd/logging
+ fi
+
+ newenvd "${FILESDIR}"/qpsmtpd.envd 99qpsmtpd
+
+ newconfd "${FILESDIR}"/qpsmtpd.confd qpsmtpd
+ newinitd "${FILESDIR}"/qpsmtpd.initd-r1 qpsmtpd
+
+ dodoc CREDITS Changes README.md README.plugins.md STATUS UPGRADING.md
+}
diff --git a/mail-mta/qpsmtpd/qpsmtpd-9999.ebuild b/mail-mta/qpsmtpd/qpsmtpd-9999.ebuild
new file mode 100644
index 00000000000..f9b0d501a8e
--- /dev/null
+++ b/mail-mta/qpsmtpd/qpsmtpd-9999.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils perl-app user git-2
+
+DESCRIPTION="qpsmtpd is a flexible smtpd daemon written in Perl"
+HOMEPAGE="http://smtpd.develooper.com"
+# This is a spotted development fork with many improvements
+EGIT_REPO_URI="git://github.com/qpsmtpd-dev/qpsmtpd-dev.git
+ https://github.com/qpsmtpd-dev/qpsmtpd-dev.git"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS=""
+IUSE="postfix ipv6 syslog"
+
+RDEPEND=">=dev-lang/perl-5.8.0
+ >=dev-perl/Net-DNS-0.690.0
+ virtual/perl-MIME-Base64
+ dev-perl/MailTools
+ dev-perl/IPC-Shareable
+ dev-perl/Socket6
+ dev-perl/Danga-Socket
+ dev-perl/ParaDNS
+ dev-perl/UNIVERSAL-isa
+ ipv6? ( dev-perl/IO-Socket-INET6 )
+ syslog? ( virtual/perl-Sys-Syslog )
+ virtual/inetd"
+
+pkg_setup() {
+ enewgroup smtpd
+ local additional_groups
+ if use postfix; then
+ additional_groups="${additional_groups},postdrop"
+ fi
+ enewuser smtpd -1 -1 /var/spool/qpsmtpd smtpd${additional_groups}
+}
+
+src_install() {
+ perl-module_src_install
+
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}"/qpsmtpd.xinetd qpsmtpd
+
+ dodir /usr/share/qpsmtpd
+ cp -Rf plugins "${D}"/usr/share/qpsmtpd/
+
+ diropts -m 0755 -o smtpd -g smtpd
+ dodir /var/spool/qpsmtpd
+ keepdir /var/spool/qpsmtpd
+
+ dodir /etc/qpsmtpd
+ insinto /etc/qpsmtpd
+ doins config.sample/*
+
+ echo "/usr/share/qpsmtpd/plugins" > "${D}"/etc/qpsmtpd/plugin_dirs
+ echo "/var/spool/qpsmtpd" > "${D}"/etc/qpsmtpd/spool_dir
+ if use syslog; then
+ echo "logging/syslog loglevel LOGINFO priority LOG_NOTICE" > "${D}"/etc/qpsmtpd/logging
+ else
+ diropts -m 0755 -o smtpd -g smtpd
+ dodir /var/log/qpsmtpd
+ keepdir /var/log/qpsmtpd
+ echo "logging/file loglevel LOGINFO /var/log/qpsmtpd/%Y-%m-%d" > "${D}"/etc/qpsmtpd/logging
+ fi
+
+ newenvd "${FILESDIR}"/qpsmtpd.envd 99qpsmtpd
+
+ newconfd "${FILESDIR}"/qpsmtpd.confd qpsmtpd
+ newinitd "${FILESDIR}"/qpsmtpd.initd-r1 qpsmtpd
+
+ dodoc CREDITS Changes README.md README.plugins.md STATUS UPGRADING.md
+}
diff --git a/mail-mta/sendmail/Manifest b/mail-mta/sendmail/Manifest
new file mode 100644
index 00000000000..4f4212540b9
--- /dev/null
+++ b/mail-mta/sendmail/Manifest
@@ -0,0 +1 @@
+DIST sendmail.8.14.9.tar.gz 2114293 SHA256 f5a497151abd8f341cca0736c3f9bd703d574d93146b2989689dff6d7a445d75 SHA512 a541fe687e9967fb87f2f6c6263ecc698aac42c6a52e81e7ee556f0c3d719b9c996dfccf10cc2e0e5c6d03dd8d3ce79b856b78ca049dd47665e38c77763fa424 WHIRLPOOL c1b290d66d9397bbe8041cd17cfc1fbc205c9d5439d89ee59c339e3febe605d964e7a50482101edec8f0b9cd6df38138e489869a5404dbfc2b7ba57dbeef1c55
diff --git a/mail-mta/sendmail/files/libmilter-sharedlib.patch b/mail-mta/sendmail/files/libmilter-sharedlib.patch
new file mode 100644
index 00000000000..43ec7861219
--- /dev/null
+++ b/mail-mta/sendmail/files/libmilter-sharedlib.patch
@@ -0,0 +1,55 @@
+diff -Nru sendmail-8.14.3.orig/devtools/M4/UNIX/milterlibrary.m4 sendmail-8.14.3/devtools/M4/UNIX/milterlibrary.m4
+--- sendmail-8.14.3.orig/devtools/M4/UNIX/milterlibrary.m4 1970-01-01 01:00:00.000000000 +0100
++++ sendmail-8.14.3/devtools/M4/UNIX/milterlibrary.m4 2009-08-22 21:51:10.000000000 +0200
+@@ -0,0 +1,39 @@
++divert(-1)
++#
++# Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
++# All rights reserved.
++#
++# By using this file, you agree to the terms and conditions set
++# forth in the LICENSE file which can be found at the top level of
++# the sendmail distribution.
++#
++#
++# Definitions for Makefile construction for sendmail
++#
++divert(0)dnl
++include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/links.m4')dnl
++bldLIST_PUSH_ITEM(`bldC_PRODUCTS', bldCURRENT_PRODUCT)dnl
++bldPUSH_TARGET(bldCURRENT_PRODUCT`.so' bldCURRENT_PRODUCT`.a')dnl
++bldPUSH_INSTALL_TARGET(`install-'bldCURRENT_PRODUCT)dnl
++bldPUSH_CLEAN_TARGET(bldCURRENT_PRODUCT`-clean')dnl
++
++include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/defines.m4')
++divert(bldTARGETS_SECTION)
++bldCURRENT_PRODUCT.so: ${BEFORE} ${bldCURRENT_PRODUCT`OBJS'}
++ ${CCLINK} ${LDOPTS_SO} -o bldCURRENT_PRODUCT.so -Wl,confSONAME,bldCURRENT_PRODUCT.so.${MILTER_SOVER} ${bldCURRENT_PRODUCT`OBJS'} -lc ${LIBS}
++bldCURRENT_PRODUCT.a: ${BEFORE} ${bldCURRENT_PRODUCT`OBJS'}
++ ${AR} ${AROPTS} bldCURRENT_PRODUCT.a ${bldCURRENT_PRODUCT`OBJS'}
++ ${RANLIB} ${RANLIBOPTS} bldCURRENT_PRODUCT.a
++ifdef(`bldLINK_SOURCES', `bldMAKE_SOURCE_LINKS(bldLINK_SOURCES)')
++
++install-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT.so 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 ${UBINMODE} bldCURRENT_PRODUCT.so "${DESTDIR}${LIBDIR}/bldCURRENT_PRODUCT.so.${MILTER_SOVER}"
++ ${LN} ${LNOPTS} bldCURRENT_PRODUCT.so.${MILTER_SOVER} "${DESTDIR}${LIBDIR}/bldCURRENT_PRODUCT.so"
++ ${INSTALL} -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} bldCURRENT_PRODUCT.a "${DESTDIR}${LIBDIR}"')
++
++bldCURRENT_PRODUCT-clean:
++ rm -f ${OBJS} bldCURRENT_PRODUCT.so bldCURRENT_PRODUCT.a ${MANPAGES}
++
++divert(0)
++COPTS+= confCCOPTS_SO
+diff -Nru sendmail-8.14.3.orig/libmilter/Makefile.m4 sendmail-8.14.3/libmilter/Makefile.m4
+--- sendmail-8.14.3.orig/libmilter/Makefile.m4 2008-04-08 07:23:44.000000000 +0200
++++ sendmail-8.14.3/libmilter/Makefile.m4 2009-08-22 21:53:35.000000000 +0200
+@@ -9,7 +9,7 @@
+ SMSRCDIR=ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail')
+ PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ')
+
+-bldPRODUCT_START(`library', `libmilter')
++bldPRODUCT_START(`milterlibrary', `libmilter')
+ define(`bldINSTALLABLE', `true')
+ define(`LIBMILTER_EXTRAS', `errstring.c strl.c')
+ APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL -Dsm_snprintf=snprintf')
diff --git a/mail-mta/sendmail/files/sendmail b/mail-mta/sendmail/files/sendmail
new file mode 100644
index 00000000000..a977375b56c
--- /dev/null
+++ b/mail-mta/sendmail/files/sendmail
@@ -0,0 +1,26 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+ use dns logger antivirus
+ provide mta
+}
+
+start() {
+ ebegin "Starting sendmail"
+ /usr/bin/newaliases > /dev/null 2>&1
+ (cd /var/spool/mqueue; rm -f xf*)
+ /usr/sbin/sendmail ${SENDMAIL_OPTS} > /dev/null 2>&1
+ /usr/sbin/sendmail ${CLIENTMQUEUE_OPTS} > /dev/null 2>&1
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping sendmail"
+ kill ${KILL_OPTS} `head -n 1 /var/run/sendmail.pid`
+ kill ${KILL_OPTS} `head -n 1 /var/spool/clientmqueue/sm-client.pid`
+ eend $?
+}
diff --git a/mail-mta/sendmail/files/sendmail-8.14.5+db-5.0.patch b/mail-mta/sendmail/files/sendmail-8.14.5+db-5.0.patch
new file mode 100644
index 00000000000..99ecbe08167
--- /dev/null
+++ b/mail-mta/sendmail/files/sendmail-8.14.5+db-5.0.patch
@@ -0,0 +1,13 @@
+Index: sendmail-8.14.4/include/sm/bdb.h
+===================================================================
+--- sendmail-8.14.4.orig/include/sm/bdb.h
++++ sendmail-8.14.4/include/sm/bdb.h
+@@ -19,7 +19,7 @@
+ # define DB_VERSION_MAJOR 1
+ # endif /* ! DB_VERSION_MAJOR */
+
+-# if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1
++# if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) || DB_VERSION_MAJOR >= 5
+
+ # define DBTXN NULL ,
+
diff --git a/mail-mta/sendmail/files/sendmail-8.14.6-build-system.patch b/mail-mta/sendmail/files/sendmail-8.14.6-build-system.patch
new file mode 100644
index 00000000000..3348e921926
--- /dev/null
+++ b/mail-mta/sendmail/files/sendmail-8.14.6-build-system.patch
@@ -0,0 +1,211 @@
+diff -Nru sendmail-8.14.3.orig/cf/cf/Makefile sendmail-8.14.3/cf/cf/Makefile
+--- sendmail-8.14.3.orig/cf/cf/Makefile 2005-06-14 04:16:34.000000000 +0200
++++ sendmail-8.14.3/cf/cf/Makefile 2009-09-20 10:55:50.000000000 +0200
+@@ -80,10 +80,10 @@
+ install-cf: install-sendmail-cf install-submit-cf
+
+ install-sendmail-cf: $(CF).cf
+- $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(CF).cf ${DESTDIR}$(MAILDIR)/sendmail.cf
++ $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(CF).cf "${DESTDIR}$(MAILDIR)/sendmail.cf"
+
+ install-submit-cf: $(SUBMIT).cf
+- $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(SUBMIT).cf ${DESTDIR}$(MAILDIR)/submit.cf
++ $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(SUBMIT).cf "${DESTDIR}$(MAILDIR)/submit.cf"
+
+ depend:
+
+diff -Nru sendmail-8.14.6.orig/devtools/M4/UNIX/defines.m4 sendmail-8.14.6/devtools/M4/UNIX/defines.m4
+--- sendmail-8.14.6.orig/devtools/M4/UNIX/defines.m4 2012-01-21 00:07:08.000000000 +0000
++++ sendmail-8.14.6/devtools/M4/UNIX/defines.m4 2012-12-27 08:13:15.792214375 +0000
+@@ -26,7 +26,7 @@
+ CCLINK = ifdef(`confCCLINK', `confCCLINK', `confCC')
+ # Linker for libraries
+ LD= ifdef(`confLD', `confLD', `confCC')
+-LDOPTS= ifdef(`confLDOPTS', `confLDOPTS') ifdef(`confMT', ifdef(`confMTLDOPTS', `confMTLDOPTS', `'), `')
++LDOPTS= ifdef(`confLDOPTS', `confLDOPTS')
+ LDOPTS_SO= ${LDOPTS} ifdef(`confLDOPTS_SO', `confLDOPTS_SO', `-shared')
+
+ # Shell
+@@ -71,7 +71,7 @@
+ LIBADD= ifdef(`conf_'bldCURRENT_PRD`_LIBS', `conf_'bldCURRENT_PRD`_LIBS')
+
+ # libraries required on your system
+-LIBS= ${LIBADD} ifdef(`confLIBS', `confLIBS') ifdef(`conf_'bldCURRENT_PRD`_LIB_POST', `conf_'bldCURRENT_PRD`_LIB_POST')
++LIBS= ${LIBADD} ifdef(`confLIBS', `confLIBS') ifdef(`conf_'bldCURRENT_PRD`_LIB_POST', `conf_'bldCURRENT_PRD`_LIB_POST') ifdef(`confMT', ifdef(`confMTLDOPTS', `confMTLDOPTS', `'), `')
+
+ # location of sendmail binary (usually /usr/sbin or /usr/lib)
+ BINDIR= ifdef(`confMBINDIR', `confMBINDIR', `/usr/sbin')
+diff -Nru sendmail-8.14.3.orig/devtools/M4/UNIX/executable.m4 sendmail-8.14.3/devtools/M4/UNIX/executable.m4
+--- sendmail-8.14.3.orig/devtools/M4/UNIX/executable.m4 2006-10-06 07:44:44.000000000 +0200
++++ sendmail-8.14.3/devtools/M4/UNIX/executable.m4 2009-09-20 10:50:36.000000000 +0200
+@@ -30,12 +30,12 @@
+
+ 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}
++ 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}"
+ ifdef(`bldTARGET_LINKS', `bldMAKE_TARGET_LINKS(${bldINSTALL_DIR`'BINDIR}/bldCURRENT_PRODUCT, ${bldCURRENT_PRODUCT`'TARGET_LINKS})')')
+
+ strip-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT
+- ${STRIP} ${STRIPOPTS} ${DESTDIR}${bldINSTALL_DIR`'BINDIR}`'/bldCURRENT_PRODUCT
++ ${STRIP} ${STRIPOPTS} "${DESTDIR}${bldINSTALL_DIR`'BINDIR}`'/bldCURRENT_PRODUCT"
+
+ bldCURRENT_PRODUCT-clean:
+ rm -f ${OBJS} bldCURRENT_PRODUCT ${MANPAGES}
+diff -Nru sendmail-8.14.3.orig/devtools/M4/UNIX/library.m4 sendmail-8.14.3/devtools/M4/UNIX/library.m4
+--- sendmail-8.14.3.orig/devtools/M4/UNIX/library.m4 2006-09-06 00:56:53.000000000 +0200
++++ sendmail-8.14.3/devtools/M4/UNIX/library.m4 2009-09-20 10:50:36.000000000 +0200
+@@ -27,8 +27,8 @@
+ ifdef(`bldLINK_SOURCES', `bldMAKE_SOURCE_LINKS(bldLINK_SOURCES)')
+
+ 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}')
++ifdef(`bldINSTALLABLE', ` ifdef(`confMKDIR', `if [ ! -d "${DESTDIR}${LIBDIR}" ]; then confMKDIR -p "${DESTDIR}${LIBDIR}"; else :; fi ')
++ ${INSTALL} -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} bldCURRENT_PRODUCT.a "${DESTDIR}${LIBDIR}"')
+
+ bldCURRENT_PRODUCT-clean:
+ rm -f ${OBJS} bldCURRENT_PRODUCT.a ${MANPAGES}
+--- sendmail-8.14.6.orig/devtools/M4/UNIX/manpage.m4 2012-01-21 00:07:08.000000000 +0000
++++ sendmail-8.14.6/devtools/M4/UNIX/manpage.m4 2012-12-27 08:28:52.617502447 +0000
+@@ -68,11 +68,11 @@
+ ifdef(`confNO_MAN_INSTALL', `divert(-1)', `dnl')
+ 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}'')
++` ifdef(`confMKDIR', `if [ ! -d "`${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)}" ]; then confMKDIR -p "`${DESTDIR}${MAN'bldGET_MAN_SOURCE_NUM($1)}"; 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}''")
+ 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')'
++` 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')'
+ )dnl
+ bldFOREACH(`bldMAN_INSTALL_CMD(', `bldMAN_PAGES')
+ ifdef(`confNO_MAN_INSTALL', `divert(0)', `dnl')
+diff -Nru sendmail-8.14.3.orig/libmilter/Makefile.m4 sendmail-8.14.3/libmilter/Makefile.m4
+--- sendmail-8.14.3.orig/libmilter/Makefile.m4 2008-04-08 07:23:44.000000000 +0200
++++ sendmail-8.14.3/libmilter/Makefile.m4 2009-09-20 10:50:36.000000000 +0200
+@@ -32,9 +32,9 @@
+ MFAPI= ${SRCDIR}/inc`'lude/libmilter/mfapi.h
+ 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
++ 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"
+ divert(0)
+
+ bldFINISH
+diff -Nru sendmail-8.14.3.orig/mail.local/Makefile.m4 sendmail-8.14.3/mail.local/Makefile.m4
+--- sendmail-8.14.3.orig/mail.local/Makefile.m4 2006-06-28 23:08:02.000000000 +0200
++++ sendmail-8.14.3/mail.local/Makefile.m4 2009-09-20 10:56:24.000000000 +0200
+@@ -30,7 +30,7 @@
+ 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 -o ${UBINOWN} -g ${UBINGRP} -m ${UBINMODE} mail.local "${DESTDIR}${EBINDIR}"
+ divert
+
+ bldFINISH
+diff -Nru sendmail-8.14.3.orig/rmail/Makefile.m4 sendmail-8.14.3/rmail/Makefile.m4
+--- sendmail-8.14.3.orig/rmail/Makefile.m4 2006-06-28 23:08:04.000000000 +0200
++++ sendmail-8.14.3/rmail/Makefile.m4 2009-09-20 10:55:29.000000000 +0200
+@@ -31,7 +31,7 @@
+ 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 -o ${UBINOWN} -g ${UBINGRP} -m ${UBINMODE} rmail "${DESTDIR}${UBINDIR}"
+ divert
+
+ bldFINISH
+diff -Nru sendmail-8.14.3.orig/sendmail/Makefile.m4 sendmail-8.14.3/sendmail/Makefile.m4
+--- sendmail-8.14.3.orig/sendmail/Makefile.m4.orig 2008-03-27 17:13:33.000000000 +0100
++++ sendmail-8.14.3/sendmail/Makefile.m4 2009-09-20 11:07:24.000000000 +0200
+@@ -14,9 +14,9 @@
+
+ dnl hack: /etc/mail is not defined as "location of .cf" in the build system
+ define(`bldTARGET_INST_DEP', ifdef(`confINST_DEP', `confINST_DEP',
+-`${DESTDIR}/etc/mail/submit.cf ${DESTDIR}${MSPQ}'))dnl
++`"${DESTDIR}/etc/mail/submit.cf" "${DESTDIR}${MSPQ}"'))dnl
+ define(`bldTARGET_LINKS', ifdef(`confLINKS', `confLINKS',
+-`${DESTDIR}${UBINDIR}/newaliases ${DESTDIR}${UBINDIR}/mailq ${DESTDIR}${UBINDIR}/hoststat ${DESTDIR}${UBINDIR}/purgestat')
++`"${DESTDIR}${UBINDIR}/newaliases" "${DESTDIR}${UBINDIR}/mailq" "${DESTDIR}${UBINDIR}/hoststat" "${DESTDIR}${UBINDIR}/purgestat"')
+ )dnl
+
+ # location of sendmail statistics file (usually /etc/mail/ or /var/log)
+@@ -43,21 +43,21 @@
+ statistics:
+ ${CP} /dev/null statistics
+
+-${DESTDIR}/etc/mail/submit.cf:
++"${DESTDIR}/etc/mail/submit.cf":
+ @echo "Please read INSTALL if anything fails while installing the binary."
+ @echo "${DESTDIR}/etc/mail/submit.cf will be installed now."
+ cd ${SRCDIR}/cf/cf && make install-submit-cf
+
+ MSPQ=ifdef(`confMSP_QUEUE_DIR', `confMSP_QUEUE_DIR', `/var/spool/clientmqueue')
+
+-${DESTDIR}${MSPQ}:
++"${DESTDIR}${MSPQ}":
+ @echo "Please read INSTALL if anything fails while installing the binary."
+ @echo "You must have setup a new user ${MSPQOWN} and a new group ${GBINGRP}"
+ @echo "as explained in sendmail/SECURITY."
+- mkdir -p ${DESTDIR}${MSPQ}
+- chown ${MSPQOWN} ${DESTDIR}${MSPQ}
+- chgrp ${GBINGRP} ${DESTDIR}${MSPQ}
+- chmod 0770 ${DESTDIR}${MSPQ}
++ mkdir -p "${DESTDIR}${MSPQ}"
++ chown ${MSPQOWN} "${DESTDIR}${MSPQ}"
++ chgrp ${GBINGRP} "${DESTDIR}${MSPQ}"
++ chmod 0770 "${DESTDIR}${MSPQ}"
+
+ divert(0)
+
+@@ -68,30 +68,30 @@
+ 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 -o ${S`'BINOWN} -g ${S`'BINGRP} -m ${S`'BINMODE} bldCURRENT_PRODUCT "${DESTDIR}${M`'BINDIR}"
+ for i in ${sendmailTARGET_LINKS}; do \
+ rm -f $$i; \
+ ${LN} ${LNOPTS} ${M`'BINDIR}/sendmail $$i; \
+ done
+
+-define(`confMTA_LINKS', `${DESTDIR}${UBINDIR}/newaliases ${DESTDIR}${UBINDIR}/mailq ${DESTDIR}${UBINDIR}/hoststat ${DESTDIR}${UBINDIR}/purgestat')
++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 -o ${M`'BINOWN} -g ${M`'BINGRP} -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; \
+ done
+
+ install-hf:
+- if [ ! -d ${DESTDIR}${HFDIR} ]; then mkdir -p ${DESTDIR}${HFDIR}; else :; fi
+- ${INSTALL} -c -o ${UBINOWN} -g ${UBINGRP} -m 444 helpfile ${DESTDIR}${HFFILE}
++ if [ ! -d "${DESTDIR}${HFDIR}" ]; then mkdir -p "${DESTDIR}${HFDIR}"; else :; fi
++ ${INSTALL} -c -o ${UBINOWN} -g ${UBINGRP} -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}
++ 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-submit-st: statistics ${DESTDIR}${MSPQ}
+- ${INSTALL} -c -o ${MSPQOWN} -g ${GBINGRP} -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${MSPQ}/${MSPSTFILE}
++install-submit-st: statistics "${DESTDIR}${MSPQ}"
++ ${INSTALL} -c -o ${MSPQOWN} -g ${GBINGRP} -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics "${DESTDIR}${MSPQ}/${MSPSTFILE}"
+
+ divert(0)
+ bldPRODUCT_END
diff --git a/mail-mta/sendmail/files/sendmail-delivered_hdr.patch b/mail-mta/sendmail/files/sendmail-delivered_hdr.patch
new file mode 100644
index 00000000000..6837fed1c46
--- /dev/null
+++ b/mail-mta/sendmail/files/sendmail-delivered_hdr.patch
@@ -0,0 +1,10 @@
+--- sendmail/conf.c.orig 2004-07-14 21:54:23.000000000 +0000
++++ sendmail/conf.c 2004-12-06 15:22:05.000000000 +0000
+@@ -117,6 +117,7 @@
+ { "content-length", H_ACHECK, NULL },
+ { "subject", H_ENCODABLE, NULL },
+ { "x-authentication-warning", H_FORCE, NULL },
++ { "delivered-to", H_FORCE, NULL },
+
+ { NULL, 0, NULL }
+ };
diff --git a/mail-mta/sendmail/files/sendmail-procmail.mc b/mail-mta/sendmail/files/sendmail-procmail.mc
new file mode 100644
index 00000000000..af994ae33ad
--- /dev/null
+++ b/mail-mta/sendmail/files/sendmail-procmail.mc
@@ -0,0 +1,12 @@
+divert(-1)
+divert(0)dnl
+include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
+VERSIONID(`$Id$')dnl
+OSTYPE(linux)dnl
+DOMAIN(generic)dnl
+FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
+FEATURE(`local_lmtp',`/usr/sbin/mail.local')dnl
+FEATURE(`local_procmail')dnl
+MAILER(local)dnl
+MAILER(smtp)dnl
+MAILER(procmail)dnl
diff --git a/mail-mta/sendmail/files/sendmail-starttls-multi-crl.patch b/mail-mta/sendmail/files/sendmail-starttls-multi-crl.patch
new file mode 100644
index 00000000000..8d93817d07d
--- /dev/null
+++ b/mail-mta/sendmail/files/sendmail-starttls-multi-crl.patch
@@ -0,0 +1,20 @@
+Bug #354611
+--- sendmail/tls.c.orig 2010-05-26 21:54:30.000000000 -0600
++++ sendmail/tls.c 2010-05-26 21:54:36.000000000 -0600
+@@ -723,11 +723,12 @@
+ {
+ if (BIO_read_filename(crl_file, CRLFile) >= 0)
+ {
+- crl = PEM_read_bio_X509_CRL(crl_file, NULL,
+- NULL, NULL);
++ while((crl = PEM_read_bio_X509_CRL(crl_file, NULL, NULL, NULL)))
++ {
++ X509_STORE_add_crl(store, crl);
++ X509_CRL_free(crl);
++ }
+ BIO_free(crl_file);
+- X509_STORE_add_crl(store, crl);
+- X509_CRL_free(crl);
+ X509_STORE_set_flags(store,
+ X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
+ X509_STORE_set_verify_cb_func(store,
diff --git a/mail-mta/sendmail/files/sendmail.mc-r1 b/mail-mta/sendmail/files/sendmail.mc-r1
new file mode 100644
index 00000000000..dbc09b02bc7
--- /dev/null
+++ b/mail-mta/sendmail/files/sendmail.mc-r1
@@ -0,0 +1,11 @@
+divert(-1)
+divert(0)dnl
+include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
+VERSIONID(`$Id$')dnl
+OSTYPE(linux)dnl
+DOMAIN(generic)dnl
+FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
+FEATURE(`local_lmtp',`/usr/sbin/mail.local')dnl
+define(`confTRUSTED_USER', `smmsp')dnl
+MAILER(local)dnl
+MAILER(smtp)dnl
diff --git a/mail-mta/sendmail/files/sendmail.service b/mail-mta/sendmail/files/sendmail.service
new file mode 100644
index 00000000000..1aeb769ecec
--- /dev/null
+++ b/mail-mta/sendmail/files/sendmail.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Sendmail Mail Transport Agent
+After=syslog.target network.target
+Wants=sm-client.service
+
+[Service]
+Type=forking
+PIDFile=/var/run/sendmail.pid
+ExecStartPre=-/usr/bin/newaliases
+ExecStartPre=-/bin/rm -f /var/spool/mqueue/xf*
+ExecStart=/usr/sbin/sendmail -bd -q30m -L sm-mta
+
+[Install]
+WantedBy=multi-user.target
+Also=sm-client.service
diff --git a/mail-mta/sendmail/files/site.config.m4 b/mail-mta/sendmail/files/site.config.m4
new file mode 100644
index 00000000000..a9e0883a9b0
--- /dev/null
+++ b/mail-mta/sendmail/files/site.config.m4
@@ -0,0 +1,16 @@
+define(`confCCOPTS', `@@confCCOPTS@@')
+define(`confMAPDEF', `@@confMAPDEF@@')
+define(`confENVDEF', `@@confENVDEF@@')
+define(`confLIBS', `@@confLIBS@@')
+define(`confSTDIO_TYPE', `portable')
+define(`confLDOPTS', `-Wl,-z,now @@confLDOPTS@@')
+define(`confLDOPTS_SO', `-shared')
+define(`confCCOPTS_SO', `-fPIC')
+define(`confCC', `@@confCC@@')
+define(`confMANOWN', `root')
+define(`confMANGRP', `root')
+define(`confMANMODE', `644')
+define(`confMAN1SRC', `1')
+define(`confMAN5SRC', `5')
+define(`confMAN8SRC', `8')
+APPENDDEF(`conf_sendmail_LIBS', `@@conf_sendmail_LIBS@@')
diff --git a/mail-mta/sendmail/files/sm-client.service b/mail-mta/sendmail/files/sm-client.service
new file mode 100644
index 00000000000..4937c132914
--- /dev/null
+++ b/mail-mta/sendmail/files/sm-client.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Sendmail Mail Transport Client
+After=syslog.target network.target sendmail.service
+BindTo=sendmail.service
+
+[Service]
+Type=forking
+PIDFile=/var/spool/clientmqueue/sm-client.pid
+ExecStartPre=/bin/touch /var/spool/clientmqueue/sm-client.pid
+ExecStartPre=/bin/chown smmsp:smmsp /var/spool/clientmqueue/sm-client.pid
+ExecStart=/usr/sbin/sendmail -Ac -q30m -L sm-cm
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mail-mta/sendmail/metadata.xml b/mail-mta/sendmail/metadata.xml
new file mode 100644
index 00000000000..940fde8f70c
--- /dev/null
+++ b/mail-mta/sendmail/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-mail</herd>
+</pkgmetadata>
diff --git a/mail-mta/sendmail/sendmail-8.14.9.ebuild b/mail-mta/sendmail/sendmail-8.14.9.ebuild
new file mode 100644
index 00000000000..20e7128a011
--- /dev/null
+++ b/mail-mta/sendmail/sendmail-8.14.9.ebuild
@@ -0,0 +1,203 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+inherit eutils multilib systemd toolchain-funcs user
+
+DESCRIPTION="Widely-used Mail Transport Agent (MTA)"
+HOMEPAGE="http://www.sendmail.org/"
+SRC_URI="ftp://ftp.sendmail.org/pub/${PN}/${PN}.${PV}.tar.gz"
+
+LICENSE="Sendmail GPL-2" # GPL-2 is here for initscript
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86"
+IUSE="ssl ldap sasl tcpd mbox ipv6 nis sockets"
+
+DEPEND="net-mail/mailbase
+ sys-devel/m4
+ sasl? ( >=dev-libs/cyrus-sasl-2.1.10 )
+ tcpd? ( sys-apps/tcp-wrappers )
+ ssl? ( dev-libs/openssl )
+ ldap? ( net-nds/openldap )
+ >=sys-libs/db-3.2
+ !net-mail/vacation
+ "
+RDEPEND="${DEPEND}
+ >=net-mail/mailbase-0.00
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/opensmtpd
+ !mail-mta/qmail-ldap
+ !<mail-mta/ssmtp-2.64-r2
+ !>=mail-mta/ssmtp-2.64-r2[mta]"
+
+PDEPEND="!mbox? ( mail-filter/procmail )"
+
+# libmilter library is part of sendmail, but it does not share the version number with it.
+# In order to find the right libmilter version number, check SMFI_VERSION definition
+# that can be found in ${S}/include/libmilter/mfapi.h (see also SM_LM_VRS_* defines).
+# For example, version 1.0.1 has a SMFI_VERSION of 0x01000001.
+LIBMILTER_VER=1.0.2
+
+pkg_setup() {
+ enewgroup smmsp 209
+ enewuser smmsp 209 -1 /var/spool/mqueue smmsp
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/"${PN}"-8.14.6-build-system.patch
+ epatch "${FILESDIR}"/sendmail-delivered_hdr.patch
+ epatch "${FILESDIR}"/libmilter-sharedlib.patch
+ epatch "${FILESDIR}"/"${PN}"-8.14.5+db-5.0.patch
+ epatch "${FILESDIR}"/sendmail-starttls-multi-crl.patch
+
+ local confCC="$(tc-getCC)"
+ local confCCOPTS="${CFLAGS}"
+ local confLDOPTS="${LDFLAGS}"
+ local confMAPDEF="-DMAP_REGEX"
+ local conf_sendmail_LIBS=""
+ use sasl && confLIBS="${confLIBS} -lsasl2" \
+ && confENVDEF="${confENVDEF} -DSASL=2" \
+ && confCCOPTS="${confCCOPTS} -I/usr/include/sasl" \
+ && conf_sendmail_LIBS="${conf_sendmail_LIBS} -lsasl2"
+ use tcpd && confENVDEF="${confENVDEF} -DTCPWRAPPERS" \
+ && confLIBS="${confLIBS} -lwrap"
+ use ssl && confENVDEF="${confENVDEF} -DSTARTTLS -D_FFR_DEAL_WITH_ERROR_SSL" \
+ && confENVDEF="${confENVDEF} -D_FFR_TLS_1" \
+ && confLIBS="${confLIBS} -lssl -lcrypto" \
+ && conf_sendmail_LIBS="${conf_sendmail_LIBS} -lssl -lcrypto"
+ use ldap && confMAPDEF="${confMAPDEF} -DLDAPMAP" \
+ && confLIBS="${confLIBS} -lldap -llber"
+ use ipv6 && confENVDEF="${confENVDEF} -DNETINET6"
+ use nis && confENVDEF="${confENVDEF} -DNIS"
+ use sockets && confENVDEF="${confENVDEF} -DSOCKETMAP"
+ sed -e "s:@@confCCOPTS@@:${confCCOPTS}:" \
+ -e "s/@@confLDOPTS@@/${confLDOPTS}/" \
+ -e "s/@@confCC@@/${confCC}/" \
+ -e "s/@@confMAPDEF@@/${confMAPDEF}/" \
+ -e "s/@@confENVDEF@@/${confENVDEF}/" \
+ -e "s/@@confLIBS@@/${confLIBS}/" \
+ -e "s/@@conf_sendmail_LIBS@@/${conf_sendmail_LIBS}/" \
+ "${FILESDIR}"/site.config.m4 > devtools/Site/site.config.m4
+}
+
+src_compile() {
+ sh Build AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" || die "compilation failed in main Build script"
+ pushd libmilter
+ sh Build AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" MILTER_SOVER=${LIBMILTER_VER} || die "libmilter compilation failed"
+ popd
+}
+
+src_install () {
+ local MY_LIBDIR=/usr/$(get_libdir)
+ local MY_OBJDIR="obj.`uname -s`.`uname -r`.`uname -m`"
+ dodir /usr/bin ${MY_LIBDIR} /usr/include/libmilter
+ dodir /usr/share/man/man{1,5,8} /usr/sbin /var/log /usr/share/sendmail-cf
+ dodir /var/spool/{mqueue,clientmqueue} /etc/conf.d
+ keepdir /var/spool/{clientmqueue,mqueue}
+ for dir in libsmutil sendmail mailstats praliases smrsh makemap vacation editmap
+ do
+ make DESTDIR="${D}" LIBDIR="${MY_LIBDIR}" MANROOT=/usr/share/man/man \
+ SBINOWN=root SBINGRP=root UBINOWN=root UBINGRP=root \
+ MANOWN=root MANGRP=root INCOWN=root INCGRP=root \
+ LIBOWN=root LIBGRP=root GBINOWN=root GBINGRP=root \
+ MSPQOWN=root CFOWN=root CFGRP=root \
+ install -C "${MY_OBJDIR}/${dir}" \
+ || die "install failed"
+ done
+ for dir in rmail mail.local
+ do
+ make DESTDIR="${D}" LIBDIR="${MY_LIBDIR}" MANROOT=/usr/share/man/man \
+ SBINOWN=root SBINGRP=root UBINOWN=root UBINGRP=root \
+ MANOWN=root MANGRP=root INCOWN=root INCGRP=root \
+ LIBOWN=root LIBGRP=root GBINOWN=root GBINGRP=root \
+ MSPQOWN=root CFOWN=root CFGRP=root \
+ force-install -C "${MY_OBJDIR}/${dir}" \
+ || die "install failed"
+ done
+
+ make DESTDIR="${D}" LIBDIR="${MY_LIBDIR}" MANROOT=/usr/share/man/man \
+ SBINOWN=root SBINGRP=root UBINOWN=root UBINGRP=root \
+ MANOWN=root MANGRP=root INCOWN=root INCGRP=root \
+ LIBOWN=root LIBGRP=root GBINOWN=root GBINGRP=root \
+ MSPQOWN=root CFOWN=root CFGRP=root \
+ MILTER_SOVER=${LIBMILTER_VER} \
+ install -C "${MY_OBJDIR}/libmilter" \
+ || die "install failed"
+
+ fowners root:smmsp /usr/sbin/sendmail
+ fperms 2555 /usr/sbin/sendmail
+ fowners smmsp:smmsp /var/spool/clientmqueue
+ fperms 770 /var/spool/clientmqueue
+ fperms 700 /var/spool/mqueue
+ dosym /usr/sbin/makemap /usr/bin/makemap
+ dodoc FAQ KNOWNBUGS README RELEASE_NOTES doc/op/op.ps
+ newdoc sendmail/README README.sendmail
+ newdoc sendmail/SECURITY SECURITY
+ newdoc sendmail/TUNING TUNING
+ newdoc smrsh/README README.smrsh
+ newdoc libmilter/README README.libmilter
+
+ newdoc cf/README README.cf
+ newdoc cf/cf/README README.install-cf
+ cp -pPR cf/* "${D}"/usr/share/sendmail-cf
+
+ docinto contrib
+ dodoc contrib/*
+
+ insinto /etc/mail
+ if use mbox
+ then
+ newins "${FILESDIR}"/sendmail.mc-r1 sendmail.mc
+ else
+ newins "${FILESDIR}"/sendmail-procmail.mc sendmail.mc
+ fi
+ m4 "${D}"/usr/share/sendmail-cf/m4/cf.m4 "${D}"/etc/mail/sendmail.mc \
+ > "${D}"/etc/mail/sendmail.cf
+ echo "include(\`/usr/share/sendmail-cf/m4/cf.m4')dnl" \
+ > "${D}"/etc/mail/submit.mc
+ cat "${D}"/usr/share/sendmail-cf/cf/submit.mc >> "${D}"/etc/mail/submit.mc
+ echo "# local-host-names - include all aliases for your machine here" \
+ > "${D}"/etc/mail/local-host-names
+ cat <<- EOF > "${D}"/etc/mail/trusted-users
+ # trusted-users - users that can send mail as others without a warning
+ # apache, mailman, majordomo, uucp are good candidates
+ EOF
+ cat <<- EOF > "${D}"/etc/mail/access
+ # Check the /usr/share/doc/sendmail/README.cf file for a description
+ # of the format of this file. (search for access_db in that file)
+ # The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
+ # package.
+ #
+
+ EOF
+ cat <<- EOF > "${D}"/etc/conf.d/sendmail
+ # Config file for /etc/init.d/sendmail
+ # add start-up options here
+ SENDMAIL_OPTS="-bd -q30m -L sm-mta" # default daemon mode
+ CLIENTMQUEUE_OPTS="-Ac -q30m -L sm-cm" # clientmqueue
+ KILL_OPTS="" # add -9/-15/your favorite evil SIG level here
+
+ EOF
+ if use sasl; then
+ dodir /etc/sasl2
+ cat <<- EOF > "${D}"/etc/sasl2/Sendmail.conf
+ pwcheck_method: saslauthd
+ mech_list: PLAIN LOGIN
+
+ EOF
+ fi
+
+ doinitd "${FILESDIR}"/sendmail
+ systemd_dounit "${FILESDIR}"/sendmail.service
+ systemd_dounit "${FILESDIR}"/sm-client.service
+
+ keepdir /usr/adm/sm.bin
+}
diff --git a/mail-mta/ssmtp/Manifest b/mail-mta/ssmtp/Manifest
new file mode 100644
index 00000000000..f2c3cd408a1
--- /dev/null
+++ b/mail-mta/ssmtp/Manifest
@@ -0,0 +1,2 @@
+DIST ssmtp-2.64-patches-3.tar.bz2 5128 SHA256 8414329b529b58197e6425ec75387f9bfc02e088cbef7ee83be80bf549ca4140 SHA512 140ca571705ee45ca2d6718b456ab028e3aaeb910a64230d8143a29de837eb3be8f16641f21f56f2c5112867512fabdc952886701d596f0bb303fc1524a1ad46 WHIRLPOOL e4ae24baaa91a424b32cced5111f640e9c3265b2f077f220f894884a7973b3ee4a887bf1113d36a167404c8e6a7123d9bb1bcd95e1a79aada3fd494b2d8b2a0f
+DIST ssmtp_2.64.orig.tar.bz2 52501 SHA256 22c37dc90c871e8e052b2cab0ad219d010fa938608cd66b21c8f3c759046fa36 SHA512 911752e744420adf58552b9cf3a6e558d8b39103e5ad33a9ed4429b9a3a2091f7674aac11fe9bbd66747a61cdabe6bd638b80efcaadc86b057c12e2e235cca72 WHIRLPOOL afa8d41b18c5be632b5b85ca483f1d2ef889d943a5a99fe0c4fe877655148313e3f031308a4126e23c6fa7bcbae009a5804071f6c77f36b092a51aeba259fea8
diff --git a/mail-mta/ssmtp/metadata.xml b/mail-mta/ssmtp/metadata.xml
new file mode 100644
index 00000000000..44448fe7841
--- /dev/null
+++ b/mail-mta/ssmtp/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-mail</herd>
+ <use>
+ <flag name='mta'>Install symlinks for sendmail-compatible MTA.</flag>
+ </use>
+</pkgmetadata>
diff --git a/mail-mta/ssmtp/ssmtp-2.64-r2.ebuild b/mail-mta/ssmtp/ssmtp-2.64-r2.ebuild
new file mode 100644
index 00000000000..201f52da1d4
--- /dev/null
+++ b/mail-mta/ssmtp/ssmtp-2.64-r2.ebuild
@@ -0,0 +1,117 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCHSET=3
+
+WANT_AUTOMAKE=none
+
+inherit eutils autotools user
+
+DESCRIPTION="Extremely simple MTA to get mail off the system to a Mailhub"
+HOMEPAGE="ftp://ftp.debian.org/debian/pool/main/s/ssmtp/"
+SRC_URI="mirror://debian/pool/main/s/ssmtp/${P/-/_}.orig.tar.bz2
+ http://dev.gentoo.org/~flameeyes/ssmtp/${P}-patches-${PATCHSET}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="ipv6 +ssl gnutls +mta"
+
+DEPEND="ssl? (
+ !gnutls? ( dev-libs/openssl )
+ gnutls? ( net-libs/gnutls )
+ )"
+RDEPEND="${DEPEND}
+ net-mail/mailbase
+ mta? (
+ !net-mail/mailwrapper
+ !mail-mta/courier
+ !mail-mta/esmtp
+ !mail-mta/exim
+ !mail-mta/mini-qmail
+ !mail-mta/msmtp[mta]
+ !mail-mta/nbsmtp
+ !mail-mta/netqmail
+ !mail-mta/nullmailer
+ !mail-mta/postfix
+ !mail-mta/qmail-ldap
+ !mail-mta/sendmail
+ !mail-mta/opensmtpd
+ )"
+
+REQUIRED_USE="gnutls? ( ssl )"
+
+pkg_setup() {
+ if ! use prefix; then
+ enewgroup ssmtp
+ fi
+}
+
+src_prepare() {
+ EPATCH_SUFFIX="patch" EPATCH_SOURCE="${WORKDIR}/patches" \
+ epatch
+ epatch_user
+
+ # let's start by not using configure.in anymore as future autoconf
+ # versions will not support it.
+ mv configure.in configure.ac || die
+
+ eautoconf
+}
+
+src_configure() {
+ econf \
+ --sysconfdir="${EPREFIX}"/etc/ssmtp \
+ $(use_enable ssl) $(use_with gnutls) \
+ $(use_enable ipv6 inet6) \
+ --enable-md5auth
+}
+
+src_compile() {
+ emake etcdir="${EPREFIX}"/etc || die
+}
+
+src_install() {
+ dosbin ssmtp
+
+ doman ssmtp.8 ssmtp.conf.5
+ dodoc ChangeLog CHANGELOG_OLD INSTALL README TLS
+ newdoc ssmtp.lsm DESC
+
+ insinto /etc/ssmtp
+ doins ssmtp.conf revaliases
+
+ local conffile="${ED}etc/ssmtp/ssmtp.conf"
+
+ # Sorry about the weird indentation, I couldn't figure out a cleverer way
+ # to do this without having horribly >80 char lines.
+ sed -i -e "s:^hostname=:\n# Gentoo bug #47562\\
+# Commenting the following line will force ssmtp to figure\\
+# out the hostname itself.\n\\
+# hostname=:" \
+ "${conffile}" || die "sed failed"
+
+ # Comment rewriteDomain (bug #243364)
+ sed -i -e "s:^rewriteDomain=:#rewriteDomain=:" "${conffile}"
+
+ # Set restrictive perms on ssmtp.conf as per #187841, #239197
+ # Protect the ssmtp configfile from being readable by regular users as it
+ # may contain login/password data to auth against a the mailhub used.
+ if ! use prefix; then
+ fowners root:ssmtp /etc/ssmtp/ssmtp.conf
+ fperms 640 /etc/ssmtp/ssmtp.conf
+ fowners root:ssmtp /usr/sbin/ssmtp
+ fperms 2711 /usr/sbin/ssmtp
+ fi
+
+ if use mta; then
+ dosym ../sbin/ssmtp /usr/lib/sendmail
+ dosym ../sbin/ssmtp /usr/bin/sendmail
+ dosym ssmtp /usr/sbin/sendmail
+ dosym ../sbin/ssmtp /usr/bin/mailq
+ dosym ../sbin/ssmtp /usr/bin/newaliases
+ fi
+}