summaryrefslogtreecommitdiff
path: root/mail-mta/courier
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /mail-mta/courier
reinit the tree, so we can have metadata
Diffstat (limited to 'mail-mta/courier')
-rw-r--r--mail-mta/courier/Manifest12
-rw-r--r--mail-mta/courier/courier-0.75.0-r1.ebuild312
-rw-r--r--mail-mta/courier/courier-0.75.0.ebuild310
-rw-r--r--mail-mta/courier/courier-0.76.4.ebuild308
-rw-r--r--mail-mta/courier/files/apache-sqwebmail.inc14
-rw-r--r--mail-mta/courier/files/courier-init-r4189
-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.xml25
9 files changed, 1197 insertions, 0 deletions
diff --git a/mail-mta/courier/Manifest b/mail-mta/courier/Manifest
new file mode 100644
index 000000000000..6855fd71fc03
--- /dev/null
+++ b/mail-mta/courier/Manifest
@@ -0,0 +1,12 @@
+AUX apache-sqwebmail.inc 347 SHA256 3a6616dacfd49ab0c89c62d9df5662fc3c2d9e598786d781240bf5e8900afc65 SHA512 e3f8f4f01563184ec4afc98d61ab739d5900f7d8757638fb06ff21ca3604f8c6f708730af514f6ca662559980503dee5955ba48c5a643e473054f3eec49b89a0 WHIRLPOOL e586f1bcf82af87df2285ec142f92056fd25df515b2cdc1027d62a97a26ba8205204c192c0bf0b59fb636ca84f70baadd79ea8a60bf9cb97db34e2b66aaee8f4
+AUX courier-init-r4 4965 SHA256 ee9316314925c8c4d59a225398d0d0ab48ba0788224e8383ba610402357128be SHA512 ca5e12bfa4fe2166cd2c1ef8c68e3cda957fd33011971237f3f76ec9d4ec1503eb22d78ec08ed42671d8858790ea7761c272a4896c680a51691c094696fee5f9 WHIRLPOOL e1857116d36306c03db5a82a29b41821fc74c7262ac5499df1af7c917e2877a2d97de8c49da3c30b18d29f8d2c7bda05c5780fb75e0594386aa04c889b0a0411
+AUX norewrite.patch 489 SHA256 526f3742fb43af93811e6e4b3210fda1c611b50ce5abdf3a57a25dfe4f5c38e4 SHA512 e9e95bd5d1a78b510f6dd7e155999089f123eecfdc16d3b5005b00981a7b6d29827cdddc61035ed3c3edcf0b9907ddfbae76df6503a1a8ef26b4de43a02bfc8e WHIRLPOOL c41a0b63a2109ac33532de0830257929995383d246eb3f84674e6fcf267ce5cc0b7e8ce339926429a7212f63aa117b5de65bc870f21b0a4a545f4b3f10827323
+AUX password.dist 247 SHA256 46f20a84922d108d39a7c26ad3ba8915326549f46cea811e2384f55a589d38e2 SHA512 f488b0ab1a909c9b878b9f3f3147641a9ed6d8d2ad44c67cd641934b800b18a62de2a7f5f51fdbecfbbcdd7c39c753734984cc0836c905a3b708858e1b91093d WHIRLPOOL 98883b10ae103663d1d1205532e6c243bb462e9dc2adf1b9d6a968f9246283bbb2aabb8779ab5d8b7d052a5a3032f9d113ac74c773bf7591e81ccf086a2e51b3
+DIST courier-0.75.0.tar.bz2 6970339 SHA256 2571a5b938649681ee98a2dc137f088aae0fd584cca3adf2dde1d826185406cc SHA512 37e66329f157e18176d4ac8c5e814be78e80ff7dec234886bec8dce2ae5c58ac68bc18e07c739295c25fae8ec778b162bab505d85ea0998db7192d52c47e7bc6 WHIRLPOOL 8cfd184beddb48e7e6efab4917372ec331d3e08f608abc6257ed408df96e100cf28226665fe1018b24e00e4336d705417484a6d890f11a6feb84045d9f969e17
+DIST courier-0.76.4.tar.bz2 7237424 SHA256 4e2fd0dbe7375a081731fe27ef2cd6c27ec87be0a0364374ffb8729e4ab65e59 SHA512 6350ef5e30bd1e4921350bf3a09de0b56513530852c93f9a06e23625e49ae09d7ff26558da1f816a5bb492579afb5c1cbcf7573199bf898a039cd3607e847c30 WHIRLPOOL 3de5fc1869563182bf6e63bb8e9ded677e4ee27f0344acec5611cc86672cb4df98b4a2ffcae08f307e50f00f3d2444a44b76ea52f25ed4b6dcdb7756cac81986
+EBUILD courier-0.75.0-r1.ebuild 9427 SHA256 574cc7e9c6577c4c5332ca343b21bfa652aa168c71862f0ee1e53b0b129b590c SHA512 f2f24fc78ef2865f2734802004abbcad11fd78ff11ec3ea4f9a5a9599c227553bb3c4f73225aef46dba28961e4c9113f722fc1ec9d9bebd23f83097efa4ea866 WHIRLPOOL b951a08d10ddc002fd3d9cf5e1431889a38de86e2649489f1cdc2714feaff1ea80cd9bb714498e94bb7047105d78e49248380c192f27247b15e602706b0e7694
+EBUILD courier-0.75.0.ebuild 9322 SHA256 44fc43ecbae3585da361cc609778f8528bce22618c7412e46556e26092a954b0 SHA512 11c0d1f278d13d0ff77691f48065c289870545414161e35fd10dd95c429a1e2adc97f1cef3da578211468ec46b74fa7b698a8fbf6205c1bd7b05b1f71c6b9434 WHIRLPOOL 25c4ab6d472b8ae1a8353e694b71f88f57ec50f631e970db2d1a7319f598960fde3626ca4af6d885bda6ef6fed663b47afd1b00da1f74c9205fe4e44e0bef703
+EBUILD courier-0.76.4.ebuild 9327 SHA256 9cc11da2d5639bba61d76fd75df868a766d33facf2dc77dab63ebe6e78150083 SHA512 91a9cf8f9f2953b97793e6c1fe3db0e3e0eeb81692a8604eef46736b58584235bff3194db8d4de2d062e4d90a267c2e578623f8a2c4e710b7092273096672a90 WHIRLPOOL f803243b0c076f7b04b0bc46cd9ac8a70e542eb34948168c1f6a36d5186deef57f55aba10b0ad1b69d349524d98130b39d2ab88877e8c40c5bd8ddcece2c8229
+MISC ChangeLog 3523 SHA256 999a8bb7b052fb1de25a32dd0432cf2c1b463acf92b6635cd3efda3530234833 SHA512 dc766a3d52a171336631157f7cb8a293628255620aa194f65a670f0dd0fc6872e363969aa4b6e7b70bc6f7833b906cc852b6d5cbd575d391bf9a08204b7e5cb8 WHIRLPOOL f29554b2e080984ab8e2e8d178917e1f37803648488d33b078bb8d6c13cb928c1d127c5af2dd56047b4b6be52a03779177fe3bb2cadc25c2547618cb9d4b5053
+MISC ChangeLog-2015 41616 SHA256 976bf31b34bb52b1419c3a3ce9c4aac056cb151831f349adaa748b4ff468fe98 SHA512 6802d9404f5973301c400bead487ef1ab82469ae962106096ea734c92a10afc653ef21b40060d324d82cc7684cb12179278483245ba5cf3ef0bf66a5145cfd5e WHIRLPOOL 4bdea1231ca3bb87efd3470abb6df693c34dbbfd67603bae38060079d8eca352e0dc8132d845aefeb491ec9151ddb26201e95c48d2d6d65bc6fcdb5e51615d33
+MISC metadata.xml 860 SHA256 4e30b525e98f5fcf1aea328bc8ee53e87d5d4270b5a341b66279c17133d07cf7 SHA512 00c4c31649f17ac2fba94122762bcd4c2f9b57ad3117645c1f0607d6d214ecd6c9c789a7b2d48b1945472e38da49257ea2903b1abec3294cfecbc25ff4501c7e WHIRLPOOL 86d40c34f61404ba38f5fe945b7d8c9a6b6c5d2fe40c8250867703c8f76123a8754f3f36a38c79f8a697b235940f2d1de8b9e31c964687d513365e774b4d2894
diff --git a/mail-mta/courier/courier-0.75.0-r1.ebuild b/mail-mta/courier/courier-0.75.0-r1.ebuild
new file mode 100644
index 000000000000..6ace61ccecb1
--- /dev/null
+++ b/mail-mta/courier/courier-0.75.0-r1.ebuild
@@ -0,0 +1,312 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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 libressl mysql pam nls ipv6 spell fax crypt norewrite \
+ fam web webmail gnutls"
+REQUIRED_USE="?? ( gnutls libressl )"
+
+DEPEND="
+ >=net-libs/courier-authlib-0.66.3
+ >=net-libs/courier-unicode-1.3
+ !gnutls? ( !libressl? ( dev-libs/openssl:0= ) )
+ libressl? ( dev-libs/libressl:= )
+ 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/courier-0.75.0.ebuild b/mail-mta/courier/courier-0.75.0.ebuild
new file mode 100644
index 000000000000..0365834aafe8
--- /dev/null
+++ b/mail-mta/courier/courier-0.75.0.ebuild
@@ -0,0 +1,310 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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/courier-0.76.4.ebuild b/mail-mta/courier/courier-0.76.4.ebuild
new file mode 100644
index 000000000000..f1b0aa79e0c5
--- /dev/null
+++ b/mail-mta/courier/courier-0.76.4.ebuild
@@ -0,0 +1,308 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86"
+IUSE="postgres ldap libressl mysql pam nls ipv6 spell fax crypt norewrite \
+ fam web webmail gnutls"
+REQUIRED_USE="?? ( gnutls libressl )"
+
+DEPEND="
+ >=net-libs/courier-authlib-0.66.3
+ >=net-libs/courier-unicode-1.4
+ !gnutls? ( !libressl? ( dev-libs/openssl:0= ) )
+ libressl? ( dev-libs/libressl:= )
+ 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() {
+ 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 000000000000..c88f803c5d1b
--- /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-init-r4 b/mail-mta/courier/files/courier-init-r4
new file mode 100644
index 000000000000..28dbd7936744
--- /dev/null
+++ b/mail-mta/courier/files/courier-init-r4
@@ -0,0 +1,189 @@
+#!/sbin/openrc-run
+# Portions Copyright 2003 Gentoo Linux
+#
+# 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 000000000000..8d8f5362967e
--- /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 000000000000..5220e4ee0eb3
--- /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 000000000000..97214a9aee27
--- /dev/null
+++ b/mail-mta/courier/metadata.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>hanno@gentoo.org</email>
+ </maintainer>
+ <maintainer type="project">
+ <email>net-mail@gentoo.org</email>
+ <name>Net-Mail</name>
+ </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>