From 8146a1f86e72210919cd8a0020aaf19838da0637 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 2 Mar 2016 17:37:51 +0100 Subject: mail-mta/opensmtpd: do not crash with libressl --- ...d-5.7.3p2-libressl-arc4random-circularity.patch | 35 ++++++++ mail-mta/opensmtpd/opensmtpd-5.7.3_p2-r1.ebuild | 94 --------------------- mail-mta/opensmtpd/opensmtpd-5.7.3_p2-r2.ebuild | 95 ++++++++++++++++++++++ 3 files changed, 130 insertions(+), 94 deletions(-) create mode 100644 mail-mta/opensmtpd/files/opensmtpd-5.7.3p2-libressl-arc4random-circularity.patch delete mode 100644 mail-mta/opensmtpd/opensmtpd-5.7.3_p2-r1.ebuild create mode 100644 mail-mta/opensmtpd/opensmtpd-5.7.3_p2-r2.ebuild (limited to 'mail-mta') diff --git a/mail-mta/opensmtpd/files/opensmtpd-5.7.3p2-libressl-arc4random-circularity.patch b/mail-mta/opensmtpd/files/opensmtpd-5.7.3p2-libressl-arc4random-circularity.patch new file mode 100644 index 000000000000..7c3586291429 --- /dev/null +++ b/mail-mta/opensmtpd/files/opensmtpd-5.7.3p2-libressl-arc4random-circularity.patch @@ -0,0 +1,35 @@ +diff -ru opensmtpd-5.7.3p2/openbsd-compat/arc4random.c opensmtpd-5.7.3p2-fixed/openbsd-compat/arc4random.c +--- opensmtpd-5.7.3p2/openbsd-compat/arc4random.c 2016-02-02 08:40:06.000000000 +0100 ++++ opensmtpd-5.7.3p2-fixed/openbsd-compat/arc4random.c 2016-03-02 17:34:24.535030362 +0100 +@@ -188,6 +188,7 @@ + _ARC4_UNLOCK(); + } + ++#if 0 + u_int32_t + arc4random(void) + { +@@ -198,12 +199,13 @@ + _ARC4_UNLOCK(); + return val; + } ++#endif + + /* + * If we are providing arc4random, then we can provide a more efficient + * arc4random_buf(). + */ +-# ifndef HAVE_ARC4RANDOM_BUF ++#if 0 + void + arc4random_buf(void *buf, size_t n) + { +@@ -215,7 +217,7 @@ + #endif /* !HAVE_ARC4RANDOM */ + + /* arc4random_buf() that uses platform arc4random() */ +-#if !defined(HAVE_ARC4RANDOM_BUF) && defined(HAVE_ARC4RANDOM) ++#if 0 + void + arc4random_buf(void *_buf, size_t n) + { diff --git a/mail-mta/opensmtpd/opensmtpd-5.7.3_p2-r1.ebuild b/mail-mta/opensmtpd/opensmtpd-5.7.3_p2-r1.ebuild deleted file mode 100644 index ef9a28680ae7..000000000000 --- a/mail-mta/opensmtpd/opensmtpd-5.7.3_p2-r1.ebuild +++ /dev/null @@ -1,94 +0,0 @@ -# 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="libressl pam +mta" - -DEPEND="!libressl? ( dev-libs/openssl:0 ) - libressl? ( dev-libs/libressl ) - 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.3_p2-r2.ebuild b/mail-mta/opensmtpd/opensmtpd-5.7.3_p2-r2.ebuild new file mode 100644 index 000000000000..dc90b4649854 --- /dev/null +++ b/mail-mta/opensmtpd/opensmtpd-5.7.3_p2-r2.ebuild @@ -0,0 +1,95 @@ +# Copyright 1999-2016 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="libressl pam +mta" + +DEPEND="!libressl? ( dev-libs/openssl:0 ) + libressl? ( dev-libs/libressl ) + 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 + use libressl && epatch "${FILESDIR}/${PN}-5.7.3p2-libressl-arc4random-circularity.patch" + + 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 +} -- cgit v1.2.3-18-g5258