diff options
Diffstat (limited to 'mail-mta/netqmail')
4 files changed, 322 insertions, 4 deletions
diff --git a/mail-mta/netqmail/files/genqmail-20080406-ldflags.patch b/mail-mta/netqmail/files/genqmail-20080406-ldflags.patch index 1eb334c259c1..cfd27cbb8280 100644 --- a/mail-mta/netqmail/files/genqmail-20080406-ldflags.patch +++ b/mail-mta/netqmail/files/genqmail-20080406-ldflags.patch @@ -1,6 +1,6 @@ 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 +--- a/genqmail-20080406/spp/Makefile 2008-04-06 15:44:14.000000000 +0000 ++++ b/genqmail-20080406/spp/Makefile 2013-05-27 00:37:58.687763457 +0000 @@ -14,7 +14,7 @@ rm -f $(TARGETS) diff --git a/mail-mta/netqmail/files/netqmail-1.06-ipme-multiple.patch b/mail-mta/netqmail/files/netqmail-1.06-ipme-multiple.patch new file mode 100644 index 000000000000..85b5a450c959 --- /dev/null +++ b/mail-mta/netqmail/files/netqmail-1.06-ipme-multiple.patch @@ -0,0 +1,117 @@ +From d24a34857afc33ed11da9ba62736c0bb9b3e5b94 Mon Sep 17 00:00:00 2001 +From: Rolf Eike Beer <eike@sf-mail.de> +Date: Thu, 29 Aug 2019 20:35:48 +0200 +Subject: [PATCH 1/2] ask kernel for the correct buffer size to satisfy + SIOCGIFCONF before looping + +--- + ipme.c | 41 ++++++++++++++++++++++++++++------------- + 1 file changed, 28 insertions(+), 13 deletions(-) + +diff --git a/ipme.c b/ipme.c +index 3c86127..d88785d 100644 +--- a/ipme.c ++++ b/ipme.c +@@ -52,20 +52,35 @@ int ipme_init() + byte_copy(&ix.ip,4,"\0\0\0\0"); + if (!ipalloc_append(&ipme,&ix)) { return 0; } + if ((s = socket(AF_INET,SOCK_STREAM,0)) == -1) return -1; +- +- len = 256; +- for (;;) { +- if (!stralloc_ready(&buf,len)) { close(s); return 0; } +- buf.len = 0; ++ ++ ifc.ifc_buf = 0; ++ ifc.ifc_len = 0; ++ ++ /* first pass: just ask what the correct length for all addresses is */ ++ len = 0; ++ if (ioctl(s,SIOCGIFCONF,&ifc) >= 0 && ifc.ifc_len > 0) { /* > is for System V */ ++ if (!stralloc_ready(&buf,ifc.ifc_len)) { close(s); return 0; } + ifc.ifc_buf = buf.s; +- ifc.ifc_len = len; +- if (ioctl(s,SIOCGIFCONF,&ifc) >= 0) /* > is for System V */ +- if (ifc.ifc_len + sizeof(*ifr) + 64 < len) { /* what a stupid interface */ +- buf.len = ifc.ifc_len; +- break; +- } +- if (len > 200000) { close(s); return -1; } +- len += 100 + (len >> 2); ++ if (ioctl(s,SIOCGIFCONF,&ifc) >= 0) ++ buf.len = ifc.ifc_len; ++ } ++ ++ /* check if we have complete length, otherwise try so sort that out */ ++ if (buf.len == 0) { ++ len = 256; ++ for (;;) { ++ if (!stralloc_ready(&buf,len)) { close(s); return 0; } ++ buf.len = 0; ++ ifc.ifc_buf = buf.s; ++ ifc.ifc_len = len; ++ if (ioctl(s,SIOCGIFCONF,&ifc) >= 0) /* > is for System V */ ++ if (ifc.ifc_len + sizeof(*ifr) + 64 < len) { /* what a stupid interface */ ++ buf.len = ifc.ifc_len; ++ break; ++ } ++ if (len > 200000) { close(s); return -1; } ++ len += 100 + (len >> 2); ++ } + } + x = buf.s; + while (x < buf.s + buf.len) { +-- +2.16.4 + +From 9d6c05d092e3cf94a6591cd5420f8026fcd4691f Mon Sep 17 00:00:00 2001 +From: Rolf Eike Beer <eike@sf-mail.de> +Date: Thu, 29 Aug 2019 20:37:03 +0200 +Subject: [PATCH 2/2] ipme: fix detection of multiple IP addresses on the same + link + +The problem was that the code did another ioctl() to check if the link is +actually up, and when doing this overwrites the information it is currently +looking at. The code when sa_len is available copies the current IP address out +before checking if the link is up. Reorder the code so both branches share more +code and both work. +--- + CHANGES | 2 ++ + ipme.c | 14 +++----------- + 2 files changed, 5 insertions(+), 11 deletions(-) + +diff --git a/ipme.c b/ipme.c +index d88785d..e163f5b 100644 +--- a/ipme.c ++++ b/ipme.c +@@ -89,6 +89,9 @@ int ipme_init() + len = sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len; + if (len < sizeof(*ifr)) + len = sizeof(*ifr); ++#else ++ len = sizeof(*ifr); ++#endif + if (ifr->ifr_addr.sa_family == AF_INET) { + sin = (struct sockaddr_in *) &ifr->ifr_addr; + byte_copy(&ix.ip,4,&sin->sin_addr); +@@ -96,17 +99,6 @@ int ipme_init() + if (ifr->ifr_flags & IFF_UP) + if (!ipalloc_append(&ipme,&ix)) { close(s); return 0; } + } +-#else +- len = sizeof(*ifr); +- if (ioctl(s,SIOCGIFFLAGS,x) == 0) +- if (ifr->ifr_flags & IFF_UP) +- if (ioctl(s,SIOCGIFADDR,x) == 0) +- if (ifr->ifr_addr.sa_family == AF_INET) { +- sin = (struct sockaddr_in *) &ifr->ifr_addr; +- byte_copy(&ix.ip,4,&sin->sin_addr); +- if (!ipalloc_append(&ipme,&ix)) { close(s); return 0; } +- } +-#endif + x += len; + } + close(s); +-- +2.16.4 + diff --git a/mail-mta/netqmail/files/use-new-path-for-functions.sh.patch b/mail-mta/netqmail/files/use-new-path-for-functions.sh.patch index 52f3d8e9a957..c107db0480f9 100644 --- a/mail-mta/netqmail/files/use-new-path-for-functions.sh.patch +++ b/mail-mta/netqmail/files/use-new-path-for-functions.sh.patch @@ -1,5 +1,5 @@ ---- genqmail-20080406.orig/ssl/mkservercert.orig 2015-10-18 12:46:40.082559295 -0200 -+++ genqmail-20080406/ssl/mkservercert 2015-10-18 12:49:03.749576181 -0200 +--- a/genqmail-20080406/ssl/mkservercert.orig 2015-10-18 12:46:40.082559295 -0200 ++++ b/genqmail-20080406/ssl/mkservercert 2015-10-18 12:49:03.749576181 -0200 @@ -5,7 +5,7 @@ # Based on mkimapdcert from courier-imap. diff --git a/mail-mta/netqmail/netqmail-1.06-r7.ebuild b/mail-mta/netqmail/netqmail-1.06-r7.ebuild new file mode 100644 index 000000000000..00b6a3087f4d --- /dev/null +++ b/mail-mta/netqmail/netqmail-1.06-r7.ebuild @@ -0,0 +1,201 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +GENQMAIL_PV=20080406 +QMAIL_SPP_PV=0.42 + +QMAIL_TLS_PV=20190114 +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' + +QMAIL_SMTPUTF8='qmail-smtputf8.patch' + +inherit qmail + +DESCRIPTION="qmail -- a secure, reliable, efficient, simple message transfer agent" +HOMEPAGE=" + http://netqmail.org + https://cr.yp.to/qmail.html + http://qmail.org +" +SRC_URI="mirror://qmail/${P}.tar.gz + https://dev.gentoo.org/~hollow/distfiles/${GENQMAIL_F} + https://www.ckdhr.com/ckd/${QMAIL_LARGE_DNS} + !vanilla? ( + highvolume? ( mirror://qmail/${QMAIL_BIGTODO_F} ) + qmail-spp? ( mirror://sourceforge/qmail-spp/${QMAIL_SPP_F} ) + ssl? ( + https://mirror.alexh.name/qmail/netqmail/${QMAIL_TLS_F} + http://inoa.net/qmail-tls/${QMAIL_TLS_CVE} + https://arnt.gulbrandsen.priv.no/qmail/qmail-smtputf8.patch + ) + ) +" + +LICENSE="public-domain" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~x86" +IUSE="authcram gencertdaily highvolume libressl qmail-spp ssl vanilla" +REQUIRED_USE="vanilla? ( !ssl !qmail-spp !highvolume )" +RESTRICT="test" + +DEPEND=" + acct-group/nofiles + acct-group/qmail + acct-user/alias + acct-user/qmaild + acct-user/qmaill + acct-user/qmailp + acct-user/qmailq + acct-user/qmailr + acct-user/qmails + net-dns/libidn2 + net-mail/queue-repair + sys-apps/gentoo-functions + sys-apps/groff + ssl? ( + !libressl? ( >=dev-libs/openssl-1.1:0= ) + libressl? ( dev-libs/libressl:= ) + ) +" +RDEPEND="${DEPEND} + >=net-mail/dot-forward-0.71-r3 + >=sys-apps/ucspi-tcp-0.88-r17 + virtual/checkpassword + virtual/daemontools + authcram? ( >=net-mail/cmd5checkpw-0.30 ) + ssl? ( >=sys-apps/ucspi-ssl-0.70-r1 ) + !mail-mta/courier + !mail-mta/esmtp + !mail-mta/exim + !mail-mta/mini-qmail + !mail-mta/msmtp[mta] + !mail-mta/nullmailer + !mail-mta/opensmtpd + !mail-mta/postfix + !mail-mta/qmail-ldap + !mail-mta/sendmail + !mail-mta/ssmtp[mta] +" + +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 "see 'user patches' in the portage manual." + eerror + die "QMAIL_PATCH_DIR is not supported anymore" + fi +} + +src_unpack() { + genqmail_src_unpack + use qmail-spp && qmail_spp_src_unpack + + unpack ${P}.tar.gz +} + +PATCHES=( + "${FILESDIR}/${PV}-exit.patch" + "${FILESDIR}/${PV}-readwrite.patch" + "${DISTDIR}/${QMAIL_LARGE_DNS}" + "${FILESDIR}/${PV}-fbsd-utmpx.patch" + "${FILESDIR}/${P}-ipme-multiple.patch" +) + +src_prepare() { + if ! use vanilla; then + if use ssl; then + # This patch contains relative paths and needs to be cleaned up. + sed 's~^--- \.\./\.\./~--- ~g' \ + < "${DISTDIR}"/${QMAIL_TLS_F} \ + > "${T}"/${QMAIL_TLS_F} || die + local PATCHES+=( "${T}/${QMAIL_TLS_F}" + "${DISTDIR}/${QMAIL_TLS_CVE}" + "${FILESDIR}/qmail-smtputf8.patch" + ) + fi + if use highvolume; then + local PATCHES+=( "${DISTDIR}/${QMAIL_BIGTODO_F}" ) + fi + + if use qmail-spp; then + if use ssl; then + SPP_PATCH="${QMAIL_SPP_S}/qmail-spp-smtpauth-tls-20060105.diff" + else + SPP_PATCH="${QMAIL_SPP_S}/netqmail-spp.diff" + fi + # make the patch work with "-p1" + sed -e 's#^--- \([Mq]\)#--- a/\1#' -e 's#^+++ \([Mq]\)#+++ b/\1#' -i ${SPP_PATCH} || die + + local PATCHES+=( "${SPP_PATCH}" ) + fi + fi + + default + + pushd "${WORKDIR}" >/dev/null || die + use qmail-spp && eapply "${FILESDIR}/genqmail-20080406-ldflags.patch" + eapply "${FILESDIR}"/use-new-path-for-functions.sh.patch + popd >/dev/null || die + + 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 || die + else + einfo "Enabled CRAM_MD5 support" + fi + + ht_fix_file Makefile* +} + +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 "https://wiki.gentoo.org/wiki/Virtual_mail_hosting_with_qmail" + 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 +} |