diff options
author | Shiz <hi@shiz.me> | 2017-04-12 00:35:55 +0000 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-12 02:46:55 +0200 |
commit | 36d195d7c2f7a01332478e5fbeda6c8ed7d2b3e3 (patch) | |
tree | 876922a8b4d16a624f0d2523656840e9591c50a9 /main/opensmtpd | |
parent | de957d75f735f67db878f9aa7ad445a9a8a05eb1 (diff) | |
download | aports-36d195d7c2f7a01332478e5fbeda6c8ed7d2b3e3.tar.bz2 aports-36d195d7c2f7a01332478e5fbeda6c8ed7d2b3e3.tar.xz |
main/opensmtpd: fix sendmail crash through undefined declarations
Diffstat (limited to 'main/opensmtpd')
-rw-r--r-- | main/opensmtpd/APKBUILD | 10 | ||||
-rw-r--r-- | main/opensmtpd/libressl-compat.patch | 101 | ||||
-rw-r--r-- | main/opensmtpd/missing-decls.patch | 51 |
3 files changed, 159 insertions, 3 deletions
diff --git a/main/opensmtpd/APKBUILD b/main/opensmtpd/APKBUILD index 03d85d9d7d..7c58936aed 100644 --- a/main/opensmtpd/APKBUILD +++ b/main/opensmtpd/APKBUILD @@ -4,7 +4,7 @@ # Maintainer: Jonathan Curran <jonathan@curran.in> pkgname=opensmtpd pkgver=6.0.2p1 -pkgrel=0 +pkgrel=1 pkgdesc="secure, reliable, lean, and easy-to configure SMTP server" url="http://www.opensmtpd.org" arch="all" @@ -17,7 +17,9 @@ subpackages="$pkgname-doc" source="https://www.opensmtpd.org/archives/${pkgname}-${pkgver}.tar.gz smtpd.initd aliases - autoconf-decl-checks.patch" + autoconf-decl-checks.patch + missing-decls.patch + libressl-compat.patch" options="suid" builddir="$srcdir"/$pkgname-$pkgver @@ -58,4 +60,6 @@ package() { sha512sums="1e4275795dd2c43174ffa268398a0d9864ce4cb7d370330f7b8c55a9b40e757616bbd280919a409ebde403769e3dea62047857dc2ff98d7ecce660b459c7ff1c opensmtpd-6.0.2p1.tar.gz 6cbcca9fc74cc0bb007164442dea87d039b06668da1b43da5e1fac2160a96da95d6644437c79a92480a3ab1fc252686bd10eceed38a19971344b0a8fca65a3d6 smtpd.initd 929ba0b8befca6cad558602f9793a9c653923924ee524902916b8ef4952d1ea8a391895e7450ed9768eb82a07bd307b49561f5d49ea4711bd87a1a73eb8d7dad aliases -e61b7b0ab98acca9c092469d3ed756161225af5126e2fc0611b2676b8e1df05db7037549febe85b860fa48e47536a01fa3bfa37976f42e47666065ba4198e903 autoconf-decl-checks.patch" +e61b7b0ab98acca9c092469d3ed756161225af5126e2fc0611b2676b8e1df05db7037549febe85b860fa48e47536a01fa3bfa37976f42e47666065ba4198e903 autoconf-decl-checks.patch +217e7212345f4202bf7e136b2d5b347a9967ea10d15ef50a216bfcd8e4a522076e4ee2044d18a606baf670c0fe6a339951b6381cdb9047730e06987ab7796790 missing-decls.patch +67b5bb221f10e014749592d24f7681bea6872785fa4a70e4e4b978f94859b527c4999aabb489586f7c19fac182acca450bdfa01af3ebc52c009f723830212058 libressl-compat.patch" diff --git a/main/opensmtpd/libressl-compat.patch b/main/opensmtpd/libressl-compat.patch new file mode 100644 index 0000000000..e1656b9404 --- /dev/null +++ b/main/opensmtpd/libressl-compat.patch @@ -0,0 +1,101 @@ +From f948b923873a93472dea9b786cf60a3472b0ddc8 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Wed, 11 Jan 2017 17:35:29 -0600 +Subject: [PATCH] fix compatibility with libressl + +These functions are exported by libcrypto from libressl, due to its +similar OpenBSD compatibility layer, but they are not present in any +header files. Thus, while we can use the existing compiled function, +and do not need to provide our own, we do need to provide the prototype +for it. + +This avoids implicit function declarations and the resulting crashes due +to pointer truncation. + +The patch is based on an equivalent patch for OpenSSH from +https://bugzilla.mindrot.org/show_bug.cgi?id=2465 +Also see +https://github.com/libressl-portable/portable/issues/109 + +Fixes #691 +--- + openbsd-compat/defines.h | 9 --------- + openbsd-compat/openbsd-compat.h | 25 +++++++++++++++---------- + 2 files changed, 15 insertions(+), 19 deletions(-) + +diff --git a/openbsd-compat/defines.h b/openbsd-compat/defines.h +index 2cbfbca..3ffcc81 100644 +--- a/openbsd-compat/defines.h ++++ b/openbsd-compat/defines.h +@@ -422,15 +422,6 @@ typedef uint16_t in_port_t; + #define INET6_ADDRSTRLEN 46 + #endif + +-/* +- * Platforms that have arc4random_uniform() and not arc4random_stir() +- * shouldn't need the latter. +- */ +-#if defined(HAVE_ARC4RANDOM) && defined(HAVE_ARC4RANDOM_UNIFORM) && \ +- !defined(HAVE_ARC4RANDOM_STIR) +-# define arc4random_stir() +-#endif +- + #ifndef HAVE_VA_COPY + # ifdef HAVE___VA_COPY + # define va_copy(dest, src) __va_copy(dest, src) +diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h +index a51385b..51f33bb 100644 +--- a/openbsd-compat/openbsd-compat.h ++++ b/openbsd-compat/openbsd-compat.h +@@ -119,20 +119,25 @@ int BSDoptind; /* index into parent argv vector */ + int getpeereid(int , uid_t *, gid_t *); + #endif + +-#ifdef HAVE_ARC4RANDOM +-# ifndef HAVE_ARC4RANDOM_STIR +-# define arc4random_stir() +-# endif +-#else ++#if !defined(HAVE_ARC4RANDOM) || defined(LIBRESSL_VERSION_NUMBER) + unsigned int arc4random(void); ++#endif ++ ++#if defined(HAVE_ARC4RANDOM_STIR) + void arc4random_stir(void); +-#endif /* !HAVE_ARC4RANDOM */ ++#elif defined(HAVE_ARC4RANDOM) || defined(LIBRESSL_VERSION_NUMBER) ++/* Recent system/libressl implementation; no need for explicit stir */ ++# define arc4random_stir() ++#else ++/* openbsd-compat/arc4random.c provides arc4random_stir() */ ++void arc4random_stir(void); ++#endif + +-#ifndef HAVE_ARC4RANDOM_BUF ++#if !defined(HAVE_ARC4RANDOM_BUF) || defined(LIBRESSL_VERSION_NUMBER) + void arc4random_buf(void *, size_t); + #endif + +-#ifndef HAVE_ARC4RANDOM_UNIFORM ++#if !defined(HAVE_ARC4RANDOM_UNIFORM) || defined(LIBRESSL_VERSION_NUMBER) + uint32_t arc4random_uniform(uint32_t); + #endif + +@@ -174,7 +179,7 @@ int vasprintf(char **, const char *, va_list); + int vsnprintf(char *, size_t, const char *, va_list); + #endif + +-#ifndef HAVE_EXPLICIT_BZERO ++#if !defined(HAVE_EXPLICIT_BZERO) || defined(LIBRESSL_VERSION_NUMBER) + void explicit_bzero(void *p, size_t n); + #endif + +@@ -200,7 +205,7 @@ int pidfile(const char *basename); + struct passwd *pw_dup(const struct passwd *); + #endif + +-#ifndef HAVE_REALLOCARRAY ++#if !defined(HAVE_REALLOCARRAY) || defined(LIBRESSL_VERSION_NUMBER) + void *reallocarray(void *, size_t, size_t); + #endif + diff --git a/main/opensmtpd/missing-decls.patch b/main/opensmtpd/missing-decls.patch new file mode 100644 index 0000000000..065fbcdbe1 --- /dev/null +++ b/main/opensmtpd/missing-decls.patch @@ -0,0 +1,51 @@ +From 2ab442623e689532910b34ff0dbbc2167da02330 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Wed, 11 Jan 2017 17:39:07 -0600 +Subject: [PATCH] fix musl compatibility (missing function prototypes) + +inet_net_pton is already compiled, but no prototype is provided. +res_hnok is provided by the compatibility layer in libasr. + +These fixes avoid warnings about implicit function declaration. + +Fixes #758 +--- + configure.ac | 1 + + openbsd-compat/openbsd-compat.h | 8 ++++++++ + 2 files changed, 9 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 42e092f..e27c514 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -594,6 +594,7 @@ AC_CHECK_FUNCS([ \ + pledge \ + pw_dup \ + reallocarray \ ++ res_hnok \ + setenv \ + setlinebuf \ + setproctitle \ +diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h +index a51385b..5d2e2c2 100644 +--- a/openbsd-compat/openbsd-compat.h ++++ b/openbsd-compat/openbsd-compat.h +@@ -208,10 +208,18 @@ void *reallocarray(void *, size_t, size_t); + void errc(int, int, const char *, ...); + #endif + ++#ifndef HAVE_INET_NET_PTON ++int inet_net_pton(int, const char *, void *, size_t); ++#endif ++ + #ifndef HAVE_PLEDGE + #define pledge(promises, paths) 0 + #endif + ++#ifndef HAVE_RES_HNOK ++int res_hnok(const char *); ++#endif ++ + #if !HAVE_DECL_AF_LOCAL + #define AF_LOCAL AF_UNIX + #endif |