diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-02-24 21:49:24 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-02-24 21:49:24 +0000 |
commit | a1c55a7e2f400a6170fd3df167bfdc299c05e2db (patch) | |
tree | 63add7e7943810930ca6e296397ef4bdea18eb6b /mail-mta/courier | |
parent | c18398e8c10c222f0daed55f7d69339e3c7885bd (diff) |
gentoo auto-resync : 24:02:2023 - 21:49:24
Diffstat (limited to 'mail-mta/courier')
-rw-r--r-- | mail-mta/courier/Manifest | 2 | ||||
-rw-r--r-- | mail-mta/courier/courier-1.2.2-r1.ebuild | 315 | ||||
-rw-r--r-- | mail-mta/courier/files/courier-1.2.2-fix-getgrnam-buffer.diff | 120 |
3 files changed, 437 insertions, 0 deletions
diff --git a/mail-mta/courier/Manifest b/mail-mta/courier/Manifest index c2cbd30ab449..3560a6f994f2 100644 --- a/mail-mta/courier/Manifest +++ b/mail-mta/courier/Manifest @@ -1,4 +1,5 @@ AUX apache-sqwebmail.inc 347 BLAKE2B e77a680065e064c300d01ec21db524f3a440623b685ecd870607b563ebbaaf1106091074e55346743877cfa44d425c29592ec3f60dedf8c7e2b6355cdc84e558 SHA512 e3f8f4f01563184ec4afc98d61ab739d5900f7d8757638fb06ff21ca3604f8c6f708730af514f6ca662559980503dee5955ba48c5a643e473054f3eec49b89a0 +AUX courier-1.2.2-fix-getgrnam-buffer.diff 2468 BLAKE2B ba01b7a98aad1df059ab8135a94fbbfdb10ae9196ddf3985ce41a365946e5a0ec25f4e4d932cf1b76ecd971e3e17837d02f7f86e957192888b44668dbf0ff948 SHA512 7ce3ef8c3db636370b60ac04c18390fef9b9d0702e99aaf82b7d899e07fe23c47cea2cde26e22270db7788de70508d0686b0df02311987388d0f59969f094331 AUX courier-init-r4 4965 BLAKE2B 09f29543599abfb6dd5df058f832e979bde471be3f9d293d975fdfc28787e8622ddab797c9d51fa89207fbc1a1ee23fb82471617366bf1467d1e7f2d7d3f2bcc SHA512 ca5e12bfa4fe2166cd2c1ef8c68e3cda957fd33011971237f3f76ec9d4ec1503eb22d78ec08ed42671d8858790ea7761c272a4896c680a51691c094696fee5f9 AUX norewrite.patch 488 BLAKE2B 663b52ff5936d5c8aa24ce2a226cd803f09a972a2f358b7f81d1711319b4fee2d7a9c4a8b498e8550b27d796939f6ba042790211592e55072bbff6b7f7172ea3 SHA512 5c2329f497951220bb1276058fe7fe2e0eba710fcad65c9ff1143827fec7c8d9745703fbebf624fecf740fb767401eeba9f0e91b09cd891622d01899578326db AUX password.dist 247 BLAKE2B 1803a6663c32ccc74c4dfb1d591a01d4416f9de9c4bf35c9a7ca277c2007b8c29a8899f4285c78eeb8592766457eef0caf377a344adee7a61be15bbf8b80c7de SHA512 f488b0ab1a909c9b878b9f3f3147641a9ed6d8d2ad44c67cd641934b800b18a62de2a7f5f51fdbecfbbcdd7c39c753734984cc0836c905a3b708858e1b91093d @@ -7,5 +8,6 @@ DIST courier-1.1.8.tar.bz2 7655220 BLAKE2B 189c87e416fe8d232e1fab8be47ff8258a54d DIST courier-1.2.2.tar.bz2 7841858 BLAKE2B 93ff5cbfe6cc8e51c769718a7933c6f7acc7f910fd3c966c3f0703a8775d360b899f846e34174b48152d397d1c7e89f67b511ec31a63641649f015574149deec SHA512 801893f77b3e18e01f3cec4a9d73abe8fc7aaca34d3c853fd5e6007e30c2b47f9e2f54e50fbff5a5bbb5ddb72ddcb5e4b7f862f17146253e44ad61b97bc556b0 EBUILD courier-1.1.5-r3.ebuild 9233 BLAKE2B d0c7f609140f624ee3b971f240766b80bc467d5f9ce649b2ff4591096d48eea997e2a9951fd56bbbb5511557609bcc21c7a5e992931597e52d0a584141eb9c90 SHA512 6563cd00e122b641f4b2147b02edcda05dd6bc6e662a2d4a55fa9f4d5327c3c48931bd4c8d6d536eae05726f91f405d20d534e70a50f1d2193d22a53ba5f6d6f EBUILD courier-1.1.8-r2.ebuild 9239 BLAKE2B 37bdf7f22ac01545fe89f6a3d63a58ab984c5f27efd0d8a6a5d751b15bd184afb53e92ad04e7fce78cae5557dc960e22ca3135aee5334603804ab00e29a02b47 SHA512 46489020884af61bac01a18dca9704a931ba81ad07f08873511baa15fc401c722c52f882c136eadc36cc46d3f590e48bb7aacff54b129b265384baaf0618da3f +EBUILD courier-1.2.2-r1.ebuild 9457 BLAKE2B 4a8e8dcc45fd9381fb735419c3ba0b445b1f3585d525992f8b165cad294732b3190059374b917a00b38625445b0d574ac9d42697ae2d4af613a918770f483b43 SHA512 5b89f7e14d600edcd90f98eadd1ac0774c83905fa77607884a447ed2a2bd8a1552b91ef3c87e5afa5fc46975a0cda15c8a5b5729a4166501c58b35dea2cb32f2 EBUILD courier-1.2.2.ebuild 9263 BLAKE2B e5656abf60207172da2e27674b32e4a45d6874c20130c13634c0df07e5e4049ce9bb398eb4e2a0397b94839257cf0cf043d63b3cd2f40d18a974079cfa24f367 SHA512 1ac12e88befc9f6f1e7f9a2ee4e72697c47b4f4575b9ed7dc1ef3df67ee4fe7d9976786f993d394da1956b2fa1f59a8d26739788f16b025e29dee6fed7ee66fc MISC metadata.xml 756 BLAKE2B e3d128790b1620d9005c9a14cef1c452488fc8e465b235791cc196f431cb2ea8348aba342b0867282878d0c73392694be0db0686dc048d9345b286c3bccf1cab SHA512 c3fcd1ba4b22f91b1acf49faeee41562a7963b51d37e1593156086b79a1eb4172a12e7226b71a9aa55b5a4ef7d734351752451a2300375d061ae20481778b273 diff --git a/mail-mta/courier/courier-1.2.2-r1.ebuild b/mail-mta/courier/courier-1.2.2-r1.ebuild new file mode 100644 index 000000000000..7ef2ccb961ea --- /dev/null +++ b/mail-mta/courier/courier-1.2.2-r1.ebuild @@ -0,0 +1,315 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic + +# Avoids failures on systems with large numbers of users in a group, +# see https://github.com/svarshavchik/courier-libs/pull/30 +PATCHES=( "${FILESDIR}/courier-1.2.2-fix-getgrnam-buffer.diff" ) + +DESCRIPTION="An MTA designed specifically for maildirs" +HOMEPAGE="https://www.courier-mta.org/" +SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +IUSE="postgres ldap mysql pam nls ipv6 spell fax crypt norewrite \ + fam web webmail gnutls" + +DEPEND=" + >=net-libs/courier-authlib-0.72.0 + >=net-libs/courier-unicode-2.2.6:= + net-dns/libidn2:= + gnutls? ( net-libs/gnutls:= ) + !gnutls? ( + dev-libs/openssl:0= + ) + >=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? ( sys-libs/pam ) + mysql? ( dev-db/mysql-connector-c ) + 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/msmtp[mta] + !mail-mta/netqmail + !mail-mta/nullmailer + !mail-mta/postfix + !mail-mta/sendmail + !mail-mta/ssmtp[mta] + !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/courier-imap + !net-mail/cyrus-imapd" + +PDEPEND="pam? ( net-mail/mailbase ) + crypt? ( >=app-crypt/gnupg-1.0.4 )" + +src_prepare() { + use norewrite && eapply "${FILESDIR}/norewrite.patch" + default +} + +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) \ + --with-notice=unicode \ + --enable-mimetypes=/etc/mime.types \ + --prefix=/usr \ + --disable-root-check \ + --mandir=/usr/share/man \ + --sysconfdir=/etc/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" +} + +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 DESTDIR="${D}" || 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:mail ldapaliasrc ; chmod 640 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 ../share/courier/pop3d /usr/sbin/courier-pop3d + dosym ../share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl + dosym ../share/courier/imapd /usr/sbin/courier-imapd + dosym ../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 ../bin/sendmail /usr/sbin/sendmail +} + +src_test() { + if [ `whoami` != 'root' ]; then + # Disable valgrind checks + echo '#!/bin/sh' > libs/imap/testsuitevalgrind + echo '#!/bin/sh' > libs/maildir/testsuitevalgrind + sed -i -e 's:VALGRIND=:#VALGRIND=:g' libs/maildrop/Makefile* + emake -j1 check + 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 [[ -z "${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/courier-1.2.2-fix-getgrnam-buffer.diff b/mail-mta/courier/files/courier-1.2.2-fix-getgrnam-buffer.diff new file mode 100644 index 000000000000..73384098189c --- /dev/null +++ b/mail-mta/courier/files/courier-1.2.2-fix-getgrnam-buffer.diff @@ -0,0 +1,120 @@ +diff -Naurp a/libs/numlib/changeuidgid.c b/libs/numlib/changeuidgid.c +--- a/libs/numlib/changeuidgid.c 2022-03-06 20:02:45.000000000 +0100 ++++ b/libs/numlib/changeuidgid.c 2023-02-24 17:26:02.452835861 +0100 +@@ -52,10 +52,11 @@ void libmail_changeuidgid(uid_t uid, gid + */ + uid_t libmail_getuid(const char *uname, gid_t *pw_gid) + { +- size_t bufsize; ++ int bufsize; + char *buf; + struct passwd pwbuf; + struct passwd *pw; ++ int s; + + /* + ** uname might be a pointer returned from a previous called to getpw(), +@@ -70,35 +71,39 @@ uid_t libmail_getuid(const char *uname, + } + strcpy(p, uname); + +-#ifdef _SC_GETGR_R_SIZE_MAX +- bufsize = sysconf(_SC_GETGR_R_SIZE_MAX); ++#ifdef _SC_GETPW_R_SIZE_MAX ++ bufsize = sysconf(_SC_GETPW_R_SIZE_MAX); + if (bufsize == -1) /* Value was indeterminate */ +- { + #endif +- bufsize = 16384; /* Should be more than enough */ +- } +- +- buf = malloc(bufsize); +- if (buf == NULL) + { +- perror("malloc"); +- exit(1); ++ bufsize = 16384; /* Should be more than enough */ + } + ++ do { ++ buf = malloc(bufsize); ++ if (buf == NULL) ++ { ++ perror("malloc"); ++ exit(1); ++ } + +- errno=ENOENT; +- +- getpwnam_r(p, &pwbuf, buf, bufsize, &pw); ++ s = getpwnam_r(p, &pwbuf, buf, bufsize, &pw); ++ if (s == ERANGE) { ++ free(buf); ++ bufsize += 1024; ++ } ++ } while (s == ERANGE && bufsize <= 65536); + +- free(buf); ++ free(p); + + if (pw == 0) + { +- free(p); +- perror("getpwnam"); ++ errno = s; ++ perror("getpwnam_r"); + exit(1); + } +- free(p); ++ ++ free(buf); + + if ( pw_gid ) *pw_gid = pw->pw_gid; + +@@ -149,7 +154,7 @@ gid_t libmail_getgid(const char *gname) + struct group grp; + struct group *result; + char *buf; +- size_t bufsize; ++ int bufsize; + int s; + char *p=malloc(strlen(gname)+1); + +@@ -168,14 +173,21 @@ gid_t libmail_getgid(const char *gname) + bufsize = 16384; /* Should be more than enough */ + } + +- buf = malloc(bufsize); +- if (buf == NULL) +- { +- perror("malloc"); +- exit(1); +- } ++ do { ++ buf = malloc(bufsize); ++ if (buf == NULL) ++ { ++ perror("malloc"); ++ exit(1); ++ } ++ ++ s = getgrnam_r(p, &grp, buf, bufsize, &result); ++ if (s == ERANGE) { ++ free(buf); ++ bufsize += 1024; ++ } ++ } while (s == ERANGE && bufsize <= 65536); + +- s = getgrnam_r(p, &grp, buf, bufsize, &result); + free(p); + + if (result == NULL) +@@ -187,7 +199,7 @@ gid_t libmail_getgid(const char *gname) + else + { + errno = s; +- perror("getpwnam_r"); ++ perror("getgrnam_r"); + } + exit(1); + } |