diff --git a/base/libmilter/default-pthread-stacksize.patch b/base/libmilter/default-pthread-stacksize.patch new file mode 100644 index 0000000..9993adf --- /dev/null +++ b/base/libmilter/default-pthread-stacksize.patch @@ -0,0 +1,42 @@ +Set default pthread stack size to 256 KB + +This patch tries to fix various crashes for applications depending on libmilter +by setting the stack size for pthreads to 256 KB. The default stack size for +musl libc is set to 80 KB whereas glibc has it set to 8 MB. This causes problems +when a large amount of memory is allocated on the stack. + +For example, opendkim allocates blocks of 64 KB multiple times, which causes +libmilter (and therefore opendkim) to crash. For now, a stack size of 256 KB +looks sufficient and makes opendkim stop crashing. + +Fixes https://bugs.alpinelinux.org/issues/6360 + +--- a/libmilter/libmilter.h ++++ b/libmilter/libmilter.h +@@ -127,10 +127,10 @@ + # define MI_SOCK_READ(s, b, l) read(s, b, l) + # define MI_SOCK_READ_FAIL(x) ((x) < 0) + # define MI_SOCK_WRITE(s, b, l) write(s, b, l) +- +-# define thread_create(ptid,wr,arg) pthread_create(ptid, NULL, wr, arg) + # define sthread_get_id() pthread_self() + ++extern int thread_create(pthread_t *ptid, void *(*wr) (void *), void *arg); ++ + typedef pthread_mutex_t smutex_t; + # define smutex_init(mp) (pthread_mutex_init(mp, NULL) == 0) + # define smutex_destroy(mp) (pthread_mutex_destroy(mp) == 0) +--- a/libmilter/main.c ++++ b/libmilter/main.c +@@ -16,6 +16,12 @@ + #include + #include + ++int thread_create(pthread_t *ptid, void *(*wr) (void *), void *arg) { ++ pthread_attr_t attr; ++ pthread_attr_init(&attr); ++ pthread_attr_setstacksize(&attr,256*1024); ++ return pthread_create(ptid, &attr, wr, arg); ++} + + static smfiDesc_ptr smfi = NULL; diff --git a/base/libmilter/libmilter-sharedlib.patch b/base/libmilter/libmilter-sharedlib.patch new file mode 100644 index 0000000..43ec786 --- /dev/null +++ b/base/libmilter/libmilter-sharedlib.patch @@ -0,0 +1,55 @@ +diff -Nru sendmail-8.14.3.orig/devtools/M4/UNIX/milterlibrary.m4 sendmail-8.14.3/devtools/M4/UNIX/milterlibrary.m4 +--- sendmail-8.14.3.orig/devtools/M4/UNIX/milterlibrary.m4 1970-01-01 01:00:00.000000000 +0100 ++++ sendmail-8.14.3/devtools/M4/UNIX/milterlibrary.m4 2009-08-22 21:51:10.000000000 +0200 +@@ -0,0 +1,39 @@ ++divert(-1) ++# ++# Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers. ++# All rights reserved. ++# ++# By using this file, you agree to the terms and conditions set ++# forth in the LICENSE file which can be found at the top level of ++# the sendmail distribution. ++# ++# ++# Definitions for Makefile construction for sendmail ++# ++divert(0)dnl ++include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/links.m4')dnl ++bldLIST_PUSH_ITEM(`bldC_PRODUCTS', bldCURRENT_PRODUCT)dnl ++bldPUSH_TARGET(bldCURRENT_PRODUCT`.so' bldCURRENT_PRODUCT`.a')dnl ++bldPUSH_INSTALL_TARGET(`install-'bldCURRENT_PRODUCT)dnl ++bldPUSH_CLEAN_TARGET(bldCURRENT_PRODUCT`-clean')dnl ++ ++include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/defines.m4') ++divert(bldTARGETS_SECTION) ++bldCURRENT_PRODUCT.so: ${BEFORE} ${bldCURRENT_PRODUCT`OBJS'} ++ ${CCLINK} ${LDOPTS_SO} -o bldCURRENT_PRODUCT.so -Wl,confSONAME,bldCURRENT_PRODUCT.so.${MILTER_SOVER} ${bldCURRENT_PRODUCT`OBJS'} -lc ${LIBS} ++bldCURRENT_PRODUCT.a: ${BEFORE} ${bldCURRENT_PRODUCT`OBJS'} ++ ${AR} ${AROPTS} bldCURRENT_PRODUCT.a ${bldCURRENT_PRODUCT`OBJS'} ++ ${RANLIB} ${RANLIBOPTS} bldCURRENT_PRODUCT.a ++ifdef(`bldLINK_SOURCES', `bldMAKE_SOURCE_LINKS(bldLINK_SOURCES)') ++ ++install-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT.so bldCURRENT_PRODUCT.a ++ifdef(`bldINSTALLABLE', ` ifdef(`confMKDIR', `if [ ! -d "${DESTDIR}${bldINSTALL_DIR`'LIBDIR}" ]; then confMKDIR -p "${DESTDIR}${bldINSTALL_DIR`'LIBDIR}"; else :; fi ') ++ ${INSTALL} -c -o ${LIBOWN} -g ${LIBGRP} -m ${UBINMODE} bldCURRENT_PRODUCT.so "${DESTDIR}${LIBDIR}/bldCURRENT_PRODUCT.so.${MILTER_SOVER}" ++ ${LN} ${LNOPTS} bldCURRENT_PRODUCT.so.${MILTER_SOVER} "${DESTDIR}${LIBDIR}/bldCURRENT_PRODUCT.so" ++ ${INSTALL} -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} bldCURRENT_PRODUCT.a "${DESTDIR}${LIBDIR}"') ++ ++bldCURRENT_PRODUCT-clean: ++ rm -f ${OBJS} bldCURRENT_PRODUCT.so bldCURRENT_PRODUCT.a ${MANPAGES} ++ ++divert(0) ++COPTS+= confCCOPTS_SO +diff -Nru sendmail-8.14.3.orig/libmilter/Makefile.m4 sendmail-8.14.3/libmilter/Makefile.m4 +--- sendmail-8.14.3.orig/libmilter/Makefile.m4 2008-04-08 07:23:44.000000000 +0200 ++++ sendmail-8.14.3/libmilter/Makefile.m4 2009-08-22 21:53:35.000000000 +0200 +@@ -9,7 +9,7 @@ + SMSRCDIR=ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail') + PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ') + +-bldPRODUCT_START(`library', `libmilter') ++bldPRODUCT_START(`milterlibrary', `libmilter') + define(`bldINSTALLABLE', `true') + define(`LIBMILTER_EXTRAS', `errstring.c strl.c') + APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL -Dsm_snprintf=snprintf') diff --git a/base/libmilter/libmilter.SMBuild b/base/libmilter/libmilter.SMBuild new file mode 100755 index 0000000..00a140e --- /dev/null +++ b/base/libmilter/libmilter.SMBuild @@ -0,0 +1,53 @@ +# Maintainer: PktSurf +app=libmilter +version=1.0.2 +sapp=sendmail +sversion=8.16.1 +build=1sml +homepage="https://sendmail.org" +download="https://ftp.sendmail.org/sendmail.8.16.1.tar.gz" +desc="Library for opendkim" +requires="musl db" + +prepbuilddir() { + mkandenterbuilddir + rm -rf $sapp-$sversion + + tar xf $srcdir/$sapp.$sversion.tar.?z* + cd $sapp-$sversion + fixbuilddirpermissions + + applypatch $srcdir/default-pthread-stacksize.patch + applypatch $srcdir/libmilter-sharedlib.patch + + cat >> devtools/Site/site.config.m4 <<-EOF +dnl enable ipv6 +APPENDDEF(\`conf_libmilter_ENVDEF',\`-DNETINET6=1') +dnl getipnodebyname/getipnodebyaddr is deprecated and not part of musl libc +APPENDDEF(\`conf_libmilter_ENVDEF',\`-DNEEDSGETIPNODE=1') +EOF +} + +build() { + make -C libmilter MILTER_SOVER=$version + mkdir -p $pkg/lib + + make -C libmilter \ + INCOWN=root INCGRP=root INCMODE=644 \ + LIBOWN=root LIBGRP=root LIBMODE=644 UBINMODE=755 \ + MILTER_SOVER=$version \ + LIBDIR="/lib" \ + INCLUDEDIR="/include" \ + DESTDIR=$pkg install + + cp LICENSE $pkgdocs/ + + mkfinalpkg +} + + +sha512sums=" +d7d4aac3c6d7505782abdb166204901b8b51cac000d610dfe40eda9eef7441a073af9e8e0b14c8719b07b445f55a1e2c28ac63d663d0daa7f1eafc5a101788b2 sendmail.8.16.1.tar.gz +d3e12943fe7e9babdf700a2d8c0229bc16fa2ea16097615600341dee13f137b157ffa4b03f76c92ba9c5552ca3bf01cb598f6a6201720408df3a37247001a219 default-pthread-stacksize.patch +31c36b57739946c1b9c7c85307fe5c53c45d7f8cbf427a0f2248db8b74871a6f5a30ef1af524915821aeca54310d28272bcd0a587cb918192214fa5c30e4a8da libmilter-sharedlib.patch +" diff --git a/base/sqlite/sqlite.SMBuild b/base/sqlite/sqlite.SMBuild index 81f26c9..89a42f8 100755 --- a/base/sqlite/sqlite.SMBuild +++ b/base/sqlite/sqlite.SMBuild @@ -1,6 +1,6 @@ # Maintainer: PktSurf app=sqlite -version=3420000 +version=3430100 build=1sml homepage="https://www.sqlite.org/" download="https://www.sqlite.org/2020/sqlite-autoconf-$version.tar.gz" @@ -30,5 +30,5 @@ build() { } sha512sums=" -1450ee59f157b8774c7650c4b4f6cd01c6d2e736c9732260df0c0aafd9adc686b7d37ccffbf296fe7ba6ef6feba8eaa2dfe3c7b8e682f35c2a92a1310411a0f8 sqlite-autoconf-3420000.tar.lz -" +aab2cdb2cf073d0ef804c9340c2b55f6bf3923eb2563ff4b1d6ebd61c3927ffc4ba912f0cdf2ebcfea9c6a033344f1a8611b1a052b407771a304cf1c4b5ca590 sqlite-autoconf-3430100.tar.gz +" \ No newline at end of file diff --git a/net/opendkim/doinst.sh b/net/opendkim/doinst.sh new file mode 100644 index 0000000..69d9474 --- /dev/null +++ b/net/opendkim/doinst.sh @@ -0,0 +1,21 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/opendkim/opendkim.conf.new + +if ! getent group opendkim ; then + addgroup -S opendkim 2>/dev/null +fi + +if ! getent passwd opendkim ; then + adduser -SDH -h /run/opendkim -s /bin/nologin -G opendkim -g opendkim opendkim 2>/dev/null +fi diff --git a/net/opendkim/opendkim.SMBuild b/net/opendkim/opendkim.SMBuild new file mode 100755 index 0000000..8dd0587 --- /dev/null +++ b/net/opendkim/opendkim.SMBuild @@ -0,0 +1,48 @@ +# Maintainer: PktSurf +app=opendkim +version=2.10.3 +build=1sml +homepage="http://opendkim.org/" +download="http://downloads.sourceforge.net/opendkim/opendkim-2.10.3.tar.gz" +desc="Implementation of the DKIM sender authentication system" +requires="db openssl libmilter" + +prepbuilddir() { + mkandenterbuilddir + rm -rf $app-$version + + tar xf $srcdir/$app-$version.tar.?z* + cd $app-$version + fixbuilddirpermissions + + applypatch $srcdir/openssl_1.1.0_compat.patch + + autoreconf -vi +} + +build() { + ./configure \ + --prefix="" \ + --sbindir=/bin \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --with-db \ + --with-openssl \ + --with-libcurl + + make + make install DESTDIR=$pkg + + install -Dm 640 opendkim/opendkim.conf.simple $pkg/etc/opendkim/opendkim.conf.new + + cp LICENSE* $pkgdocs/ + + preprunitservice -s opendkim -d + + mkfinalpkg +} + +sha512sums=" +97923e533d072c07ae4d16a46cbed95ee799aa50f19468d8bc6d1dc534025a8616c3b4b68b5842bc899b509349a2c9a67312d574a726b048c0ea46dd4fcc45d8 opendkim-2.10.3.tar.gz +f971979c5687286213218a5f0b420ed3593c262231717fb85eeee51762acde9b6e6fa0be5c7731e2da1fcf2d6761dfb3e9d6a1477ec9675fd2bbefceb734799f openssl_1.1.0_compat.patch +" diff --git a/net/opendkim/opendkim.run b/net/opendkim/opendkim.run new file mode 100644 index 0000000..5ed1185 --- /dev/null +++ b/net/opendkim/opendkim.run @@ -0,0 +1,2 @@ +#!/bin/sh +exec /bin/opendkim -x /etc/opendkim/opendkim.conf -f diff --git a/net/opendkim/openssl_1.1.0_compat.patch b/net/opendkim/openssl_1.1.0_compat.patch new file mode 100644 index 0000000..3839908 --- /dev/null +++ b/net/opendkim/openssl_1.1.0_compat.patch @@ -0,0 +1,90 @@ +Description: Build and work with either openssl 1.0.2 or 1.1.0 + * Add patch to build with either openssl 1.0.2 or 1.1.0 (Closes: #828466) + - Thanks to Sebastian Andrzej Siewior for the patch +Author: Sebastian Andrzej Siewior +Bug-Debian: http://bugs.debian.org/828466 +Origin: vendor +Forwarded: no +Reviewed-By: Scott Kitterman +Last-Update: + +--- opendkim-2.11.0~alpha.orig/configure.ac ++++ opendkim-2.11.0~alpha/configure.ac +@@ -864,26 +864,28 @@ then + AC_SEARCH_LIBS([ERR_peek_error], [crypto], , + AC_MSG_ERROR([libcrypto not found])) + +- AC_SEARCH_LIBS([SSL_library_init], [ssl], , +- [ +- if test x"$enable_shared" = x"yes" +- then +- AC_MSG_ERROR([Cannot build shared opendkim +- against static openssl libraries. +- Configure with --disable-shared +- to get this working or obtain a +- shared libssl library for +- opendkim to use.]) +- fi + +- # avoid caching issue - last result of SSL_library_init +- # shouldn't be cached for this next check +- unset ac_cv_search_SSL_library_init +- LIBCRYPTO_LIBS="$LIBCRYPTO_LIBS -ldl" +- AC_SEARCH_LIBS([SSL_library_init], [ssl], , +- AC_MSG_ERROR([libssl not found]), [-ldl]) +- ] +- ) ++ AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM([[#include ]], ++ [[SSL_library_init();]])], ++ [od_have_ossl="yes";], ++ [od_have_ossl="no";]) ++ if test x"$od_have_ossl" = x"no" ++ then ++ if test x"$enable_shared" = x"yes" ++ then ++ AC_MSG_ERROR([Cannot build shared opendkim ++ against static openssl libraries. ++ Configure with --disable-shared ++ to get this working or obtain a ++ shared libssl library for ++ opendkim to use.]) ++ fi ++ ++ LIBCRYPTO_LIBS="$LIBCRYPTO_LIBS -ldl" ++ AC_SEARCH_LIBS([SSL_library_init], [ssl], , ++ AC_MSG_ERROR([libssl not found]), [-ldl]) ++ fi + + AC_CHECK_DECL([SHA256_DIGEST_LENGTH], + AC_DEFINE([HAVE_SHA256], 1, +--- opendkim-2.11.0~alpha.orig/opendkim/opendkim-crypto.c ++++ opendkim-2.11.0~alpha/opendkim/opendkim-crypto.c +@@ -222,7 +222,11 @@ dkimf_crypto_free_id(void *ptr) + { + assert(pthread_setspecific(id_key, ptr) == 0); + ++#if OPENSSL_VERSION_NUMBER >= 0x10100000 ++ OPENSSL_thread_stop(); ++#else + ERR_remove_state(0); ++#endif + + free(ptr); + +@@ -392,11 +396,15 @@ dkimf_crypto_free(void) + { + if (crypto_init_done) + { ++#if OPENSSL_VERSION_NUMBER >= 0x10100000 ++ OPENSSL_thread_stop(); ++#else + CRYPTO_cleanup_all_ex_data(); + CONF_modules_free(); + EVP_cleanup(); + ERR_free_strings(); + ERR_remove_state(0); ++#endif + + if (nmutexes > 0) + {