diff --git a/dev-libs/cyrus-sasl/Manifest b/dev-libs/cyrus-sasl/Manifest new file mode 100644 index 0000000..ac2b025 --- /dev/null +++ b/dev-libs/cyrus-sasl/Manifest @@ -0,0 +1,2 @@ +DIST cyrus-sasl-2.1.28-r6-patches.tar.xz 11700 BLAKE2B e7d92ce05fe4c1280ee6e7343337d843e09e6c64a3b569b1dba2a33bd476de33223109b29e6a172aa918772a5a9bb48e8ffca08455288d0d2cd411a325fe98f7 SHA512 493696f4494c8d7b3712ee4f6a7c7093fdd20855e7d57aff5f166a5940fbe29edcd5b86414454094112dbe6ef5b04734e3080b0a2393b79dcd7372859b52ad40 +DIST cyrus-sasl-2.1.28.tar.gz 4034803 BLAKE2B 6cca8c26cebb9c2ee5d539c43797d30b6309a476ec4233225789978e1d7315c4ea5d2abbc7f5464be0f3c0de5fd9212706b43fbc92f40b76cd0b1013cc00f823 SHA512 db15af9079758a9f385457a79390c8a7cd7ea666573dace8bf4fb01bb4b49037538d67285727d6a70ad799d2e2318f265c9372e2427de9371d626a1959dd6f78 diff --git a/dev-libs/cyrus-sasl/cyrus-sasl-2.1.28-r6.ebuild b/dev-libs/cyrus-sasl/cyrus-sasl-2.1.28-r6.ebuild new file mode 100644 index 0000000..5a7bb52 --- /dev/null +++ b/dev-libs/cyrus-sasl/cyrus-sasl-2.1.28-r6.ebuild @@ -0,0 +1,240 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools edos2unix flag-o-matic multilib multilib-minimal pam db-use systemd toolchain-funcs tmpfiles + +SASLAUTHD_CONF_VER="2.1.26" +MY_PATCH_VER="${PN}-2.1.28-r6-patches" +DESCRIPTION="The Cyrus SASL (Simple Authentication and Security Layer)" +HOMEPAGE="https://www.cyrusimap.org/sasl/" +SRC_URI="https://github.com/cyrusimap/${PN}/releases/download/${P}/${P}.tar.gz" +SRC_URI+=" https://www.applied-asynchrony.com/distfiles/${MY_PATCH_VER}.tar.xz" + +LICENSE="BSD-with-attribution" +SLOT="2" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos ~x64-solaris" +IUSE="authdaemond berkdb gdbm kerberos ldapdb openldap mysql pam postgres selinux sqlite srp ssl static-libs urandom" +REQUIRED_USE="ldapdb? ( openldap )" + +# See bug #855890 for sys-libs/db slot +DEPEND="net-mail/mailbase + virtual/libcrypt:= + authdaemond? ( || ( net-mail/courier-imap mail-mta/courier ) ) + berkdb? ( >=sys-libs/db-4.8.30-r1:4.8[${MULTILIB_USEDEP}] ) + gdbm? ( >=sys-libs/gdbm-1.10-r1:=[${MULTILIB_USEDEP}] ) + kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] ) + openldap? ( >=net-nds/openldap-2.4.38-r1:=[${MULTILIB_USEDEP}] ) + mysql? ( dev-db/mysql-connector-c:0=[${MULTILIB_USEDEP}] ) + pam? ( >=sys-libs/pam-0-r1[${MULTILIB_USEDEP}] ) + postgres? ( dev-db/postgresql:* ) + sqlite? ( >=dev-db/sqlite-3.8.2:3[${MULTILIB_USEDEP}] ) + ssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )" +RDEPEND="${DEPEND} + selinux? ( sec-policy/selinux-sasl )" +BDEPEND="virtual/libcrypt + berkdb? ( >=sys-libs/db-4.8.30-r1:4.8 ) + gdbm? ( >=sys-libs/gdbm-1.10-r1 )" + +MULTILIB_WRAPPED_HEADERS=( + /usr/include/sasl/md5global.h +) + +PATCHES=( + "${WORKDIR}"/${MY_PATCH_VER}/ +) + +src_prepare() { + default + + # Use plugindir for sasldir + # https://github.com/cyrusimap/cyrus-sasl/issues/339 (I think) + sed -i '/^sasldir =/s:=.*:= $(plugindir):' \ + "${S}"/plugins/Makefile.{am,in} || die "sed failed" + + # bug #486740 and bug #468556 (dropped AM_CONFIG_HEADER sed in 2.1.28) + sed -i -e 's:AC_CONFIG_MACRO_DIR:AC_CONFIG_MACRO_DIRS:g' configure.ac || die + + eautoreconf +} + +src_configure() { + export CC_FOR_BUILD="$(tc-getBUILD_CC)" + + # Fails with C23 because of decls + append-flags -std=gnu17 + + # -Werror=lto-type-mismatch + # https://bugs.gentoo.org/894684 + # https://github.com/cyrusimap/cyrus-sasl/pull/771 + # + # Fixed upstream in git master but not released. + use srp && filter-lto + + if [[ ${CHOST} == *-solaris* ]] ; then + # getpassphrase is defined in /usr/include/stdlib.h + append-cppflags -DHAVE_GETPASSPHRASE + else + # this horrendously breaks things on Solaris + append-cppflags -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -DLDAP_DEPRECATED + # replaces BSD_SOURCE (bug #579218) + append-cppflags -D_DEFAULT_SOURCE + fi + + multilib-minimal_src_configure + + if ( use berkdb || use gdbm ) && tc-is-cross-compiler ; then + mkdir -p "${WORKDIR}"/${P}-build || die + cd "${WORKDIR}"/${P}-build || die + # We don't care which berkdb version is used as this build is only + # temporary for generating an empty sasldb2 later. + ECONF_SOURCE="${S}" econf_build \ + --with-dblib=$(usex berkdb berkeley gdbm) + fi +} + +multilib_src_configure() { + local myeconfargs=( + --enable-login + --enable-ntlm + --enable-auth-sasldb + --disable-cmulocal + --disable-krb4 + --disable-macos-framework + --enable-otp + --without-sqlite + --with-saslauthd="${EPREFIX}"/run/saslauthd + --with-pwcheck="${EPREFIX}"/run/saslauthd + --with-configdir="${EPREFIX}"/etc/sasl2 + --with-plugindir="${EPREFIX}/usr/$(get_libdir)/sasl2" + --with-dbpath="${EPREFIX}"/etc/sasl2/sasldb2 + --with-sphinx-build=no + $(use_with ssl openssl) + $(use_with pam) + $(use_with openldap ldap) + $(use_enable ldapdb) + $(use_enable kerberos gssapi) + $(multilib_native_use_with mysql mysql "${EPREFIX}/usr/$(get_libdir)") + $(multilib_native_use_with postgres pgsql "${EPREFIX}/usr/$(get_libdir)/postgresql") + $(use_with sqlite sqlite3 "${EPREFIX}/usr/$(get_libdir)") + $(use_enable srp) + $(use_enable static-libs static) + + # Add authdaemond support (bug #56523). + $(usex authdaemond --with-authdaemond="${EPREFIX}"/var/lib/courier/authdaemon/socket '') + + # Fix for bug #59634. + $(usex ssl '' --without-des) + + # Use /dev/urandom instead of /dev/random (bug #46038). + $(usex urandom --with-devrandom=/dev/urandom '') + ) + + if use sqlite || { multilib_is_native_abi && { use mysql || use postgres; }; } ; then + myeconfargs+=( --enable-sql ) + else + myeconfargs+=( --disable-sql ) + fi + + # Default to GDBM if both 'gdbm' and 'berkdb' are present. + if use gdbm ; then + einfo "Building with GNU DB as database backend for your SASLdb" + myeconfargs+=( --with-dblib=gdbm ) + elif use berkdb ; then + einfo "Building with BerkeleyDB as database backend for your SASLdb" + myeconfargs+=( + --with-dblib=berkeley + --with-bdb-incdir="$(db_includedir)" + ) + else + einfo "Building without SASLdb support" + myeconfargs+=( --with-dblib=none ) + fi + + ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" +} + +src_compile() { + multilib-minimal_src_compile + + if ( use berkdb || use gdbm ) && tc-is-cross-compiler ; then + emake -C "${WORKDIR}"/${P}-build + fi +} + +multilib_src_install() { + default + + if multilib_is_native_abi; then + dosbin saslauthd/testsaslauthd + keepdir /etc/sasl2 + + if use berkdb || use gdbm ; then + einfo "Generating an empty sasldb2 ..." + tc-is-cross-compiler && { cd "${WORKDIR}"/${P}-build || die; } + export SASL_PATH=./plugins/.libs + + ./utils/saslpasswd2 -f "${ED}"/etc/sasl2/sasldb2-empty -p login <<< p \ + || die "Failed to generate sasldb2" + + ./utils/saslpasswd2 -f "${ED}"/etc/sasl2/sasldb2-empty -d login \ + || die "Failed to delete temp user" + + fowners root:mail /etc/sasl2/sasldb2-empty + fperms 0640 /etc/sasl2/sasldb2-empty + fi + fi +} + +multilib_src_install_all() { + doman man/* + + # Reset docinto to default value (bug #674296) + docinto + dodoc AUTHORS ChangeLog doc/legacy/TODO "${FILESDIR}"/README.sample + newdoc pwcheck/README README.pwcheck + + newdoc docsrc/sasl/release-notes/$(ver_cut 1-2)/index.rst release-notes + edos2unix "${ED}"/usr/share/doc/${PF}/release-notes + + docinto html + dodoc doc/html/*.html + + if use pam; then + newpamd "${FILESDIR}"/saslauthd.pam-include saslauthd + fi + + newinitd "${FILESDIR}"/pwcheck.rc6 pwcheck + systemd_dounit "${FILESDIR}"/pwcheck.service + + newinitd "${FILESDIR}"/saslauthd2.rc7 saslauthd + newconfd "${FILESDIR}"/saslauthd-${SASLAUTHD_CONF_VER}.conf saslauthd + systemd_dounit "${FILESDIR}"/saslauthd.service + dotmpfiles "${FILESDIR}"/${PN}.conf + + # The get_modname bit is important: do not remove the .la files on + # platforms where the lib isn't called .so for cyrus searches the .la to + # figure out what the name is supposed to be instead + if ! use static-libs && [[ $(get_modname) == .so ]] ; then + find "${ED}" -name "*.la" -delete || die + fi +} + +pkg_postinst() { + tmpfiles_process ${PN}.conf + + if ( use berkdb || use gdbm ) && [[ ! -f ${EROOT}/etc/sasl2/sasldb2 ]] ; then + cp -av "${EROOT}"/etc/sasl2/sasldb2{-empty,} || die + fi + + if use authdaemond ; then + elog "You need to add a user running a service using Courier's" + elog "authdaemon to the 'mail' group. For example, do:" + elog " gpasswd -a postfix mail" + elog "to add the 'postfix' user to the 'mail' group." + fi + + elog "pwcheck and saslauthd home directories have moved to:" + elog " /run/saslauthd, using tmpfiles.d" +} diff --git a/dev-libs/cyrus-sasl/files/README.sample b/dev-libs/cyrus-sasl/files/README.sample new file mode 100644 index 0000000..25a4a81 --- /dev/null +++ b/dev-libs/cyrus-sasl/files/README.sample @@ -0,0 +1,6 @@ +The cyrus-sasl package contains a sample directory with examples in C +that demonstrate how to build against libsasldb. These examples +are difficult to build outside the cyrus-sasl tree and offer no value +for the installed package in Gentoo, which is why they are no longer +packaged. If you intend to develop e.g. plugins, please see the upstream +development repository at https://github.com/cyrusimap/cyrus-sasl. diff --git a/dev-libs/cyrus-sasl/files/cyrus-sasl.conf b/dev-libs/cyrus-sasl/files/cyrus-sasl.conf new file mode 100644 index 0000000..d4809f7 --- /dev/null +++ b/dev-libs/cyrus-sasl/files/cyrus-sasl.conf @@ -0,0 +1 @@ +d /run/saslauthd 0755 root root - diff --git a/dev-libs/cyrus-sasl/files/pwcheck.rc6 b/dev-libs/cyrus-sasl/files/pwcheck.rc6 new file mode 100644 index 0000000..7b43c4e --- /dev/null +++ b/dev-libs/cyrus-sasl/files/pwcheck.rc6 @@ -0,0 +1,20 @@ +#!/sbin/openrc-run +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need localmount + use logger +} + +start() { + ebegin "Starting sasl pwcheck daemon" + start-stop-daemon --start --quiet --exec /usr/sbin/pwcheck + eend $? +} + +stop() { + ebegin "Stopping sasl pwcheck daemon" + start-stop-daemon --stop --quiet --exec /usr/sbin/pwcheck + eend $? +} diff --git a/dev-libs/cyrus-sasl/files/pwcheck.service b/dev-libs/cyrus-sasl/files/pwcheck.service new file mode 100644 index 0000000..74ff485 --- /dev/null +++ b/dev-libs/cyrus-sasl/files/pwcheck.service @@ -0,0 +1,9 @@ +[Unit] +Description=SASL pwcheck daemon + +[Service] +Type=forking +ExecStart=/usr/sbin/pwcheck + +[Install] +WantedBy=multi-user.target diff --git a/dev-libs/cyrus-sasl/files/saslauthd-2.1.26.conf b/dev-libs/cyrus-sasl/files/saslauthd-2.1.26.conf new file mode 100644 index 0000000..dd487b0 --- /dev/null +++ b/dev-libs/cyrus-sasl/files/saslauthd-2.1.26.conf @@ -0,0 +1,19 @@ +# Config file for /etc/init.d/saslauthd and systemd unit + +# PLEASE READ THIS IF YOU ARE USING SYSTEMD +# Please note that systemd does not expand shell variables +# thus, something like FOO="${FOO} bar" won't work. + +# Specify the authentications mechanism. +# **NOTE** For a list see: saslauthd -v +# Since 2.1.19, add "-r" to options for old behavior, +# ie. reassemble user and realm to user@realm form. +# +# Specify the hostname for remote IMAP server using: +# "-O localhost". +# Specify the number of worker processes to create using: +# "-n ". +# Enable credential cache, set cache size and timeout using: +# "-c -s -t ". +# +SASLAUTHD_OPTS="-a pam" diff --git a/dev-libs/cyrus-sasl/files/saslauthd.pam-include b/dev-libs/cyrus-sasl/files/saslauthd.pam-include new file mode 100644 index 0000000..d50a849 --- /dev/null +++ b/dev-libs/cyrus-sasl/files/saslauthd.pam-include @@ -0,0 +1,8 @@ +#%PAM-1.0 + +auth required pam_nologin.so +auth include system-auth + +account include system-auth + +session include system-auth diff --git a/dev-libs/cyrus-sasl/files/saslauthd.service b/dev-libs/cyrus-sasl/files/saslauthd.service new file mode 100644 index 0000000..1609a65 --- /dev/null +++ b/dev-libs/cyrus-sasl/files/saslauthd.service @@ -0,0 +1,13 @@ +[Unit] +Description=SASL Authentication Daemon + +[Service] +Type=forking +PIDFile=/run/saslauthd/saslauthd.pid +EnvironmentFile=/etc/conf.d/saslauthd +ExecStart=/usr/sbin/saslauthd $SASLAUTHD_OPTS +ExecStop=/bin/kill -15 $MAINPID +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/dev-libs/cyrus-sasl/files/saslauthd2.rc7 b/dev-libs/cyrus-sasl/files/saslauthd2.rc7 new file mode 100644 index 0000000..0abeaf6 --- /dev/null +++ b/dev-libs/cyrus-sasl/files/saslauthd2.rc7 @@ -0,0 +1,20 @@ +#!/sbin/openrc-run +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need net +} + +start() { + ebegin "Starting saslauthd" + start-stop-daemon --start --quiet --exec /usr/sbin/saslauthd \ + -- ${SASLAUTHD_OPTS} + eend $? +} + +stop() { + ebegin "Stopping saslauthd" + start-stop-daemon --stop --quiet --pidfile /run/saslauthd/saslauthd.pid + eend $? +} diff --git a/dev-libs/cyrus-sasl/metadata.xml b/dev-libs/cyrus-sasl/metadata.xml new file mode 100644 index 0000000..dbb996c --- /dev/null +++ b/dev-libs/cyrus-sasl/metadata.xml @@ -0,0 +1,19 @@ + + + + + + + Add Courier-IMAP authdaemond unix socket + support (net-mail/courier-imap, mail-mta/courier) + + Add ldap support for saslauthd + Enable ldapdb plugin + Enable sample client and server + Enable SRP authentication + Use /dev/urandom instead of /dev/random + + + cyrusimap/cyrus-sasl + +