1 |
commit: 8a8806e399ae2045c594aaaa6bdabc203d67208d |
2 |
Author: Samuel Holland <samuel <AT> sholland <DOT> org> |
3 |
AuthorDate: Wed Jan 11 23:19:19 2017 +0000 |
4 |
Commit: Jason Donenfeld <zx2c4 <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Apr 12 14:05:23 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a8806e3 |
7 |
|
8 |
mail-mta/opensmtpd: revbump to fix libressl and musl |
9 |
|
10 |
One patch is a backport from upstream. The other two have been submitted |
11 |
upstream as pull requests. |
12 |
|
13 |
Gentoo-Bug: 598822 |
14 |
Fixes: #3438 |
15 |
|
16 |
.../files/opensmtpd-6.0.2_p1-autoconf.patch | 46 ++++++++++ |
17 |
.../files/opensmtpd-6.0.2_p1-libressl.patch | 101 +++++++++++++++++++++ |
18 |
.../opensmtpd/files/opensmtpd-6.0.2_p1-musl.patch | 51 +++++++++++ |
19 |
mail-mta/opensmtpd/opensmtpd-6.0.2_p1-r2.ebuild | 98 ++++++++++++++++++++ |
20 |
4 files changed, 296 insertions(+) |
21 |
|
22 |
diff --git a/mail-mta/opensmtpd/files/opensmtpd-6.0.2_p1-autoconf.patch b/mail-mta/opensmtpd/files/opensmtpd-6.0.2_p1-autoconf.patch |
23 |
new file mode 100644 |
24 |
index 00000000000..d490a902919 |
25 |
--- /dev/null |
26 |
+++ b/mail-mta/opensmtpd/files/opensmtpd-6.0.2_p1-autoconf.patch |
27 |
@@ -0,0 +1,46 @@ |
28 |
+From 9370e962bfa1032ab16c48c79977536eae665d75 Mon Sep 17 00:00:00 2001 |
29 |
+From: Freddy DISSAUX <dsx@×××××××××××.fr> |
30 |
+Date: Sat, 17 Sep 2016 08:50:14 +0200 |
31 |
+Subject: [PATCH] Fix expression, as explain in |
32 |
+ |
33 |
+https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Generic-Declarations.html#Generic-Declarations |
34 |
+ |
35 |
+"Unlike the other `AC_CHECK_*S' macros, when a symbol is not |
36 |
+declared, HAVE_DECL_symbol is defined to `0' instead of |
37 |
+leaving HAVE_DECL_symbol undeclared." |
38 |
+--- |
39 |
+ openbsd-compat/defines.h | 2 +- |
40 |
+ openbsd-compat/openbsd-compat.h | 4 ++-- |
41 |
+ 2 files changed, 3 insertions(+), 3 deletions(-) |
42 |
+ |
43 |
+diff --git a/openbsd-compat/defines.h b/openbsd-compat/defines.h |
44 |
+index 0a94d76..bda39e9 100644 |
45 |
+--- a/openbsd-compat/defines.h |
46 |
++++ b/openbsd-compat/defines.h |
47 |
+@@ -85,7 +85,7 @@ |
48 |
+ # define STDERR_FILENO 2 |
49 |
+ #endif |
50 |
+ |
51 |
+-#if defined(HAVE_DECL_O_NONBLOCK) && HAVE_DECL_O_NONBLOCK == 0 |
52 |
++#if !HAVE_DECL_O_NONBLOCK |
53 |
+ # define O_NONBLOCK 00004 /* Non Blocking Open */ |
54 |
+ #endif |
55 |
+ |
56 |
+diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h |
57 |
+index fd931d0..1ef2925 100644 |
58 |
+--- a/openbsd-compat/openbsd-compat.h |
59 |
++++ b/openbsd-compat/openbsd-compat.h |
60 |
+@@ -212,11 +212,11 @@ void errc(int, int, const char *, ...); |
61 |
+ #define pledge(promises, paths) 0 |
62 |
+ #endif |
63 |
+ |
64 |
+-#ifndef HAVE_DECL_AF_LOCAL |
65 |
++#if !HAVE_DECL_AF_LOCAL |
66 |
+ #define AF_LOCAL AF_UNIX |
67 |
+ #endif |
68 |
+ |
69 |
+-#ifndef HAVE_DECL_WAIT_MYPGRP |
70 |
++#if !HAVE_DECL_WAIT_MYPGRP |
71 |
+ #define WAIT_MYPGRP 0 |
72 |
+ #endif |
73 |
+ |
74 |
|
75 |
diff --git a/mail-mta/opensmtpd/files/opensmtpd-6.0.2_p1-libressl.patch b/mail-mta/opensmtpd/files/opensmtpd-6.0.2_p1-libressl.patch |
76 |
new file mode 100644 |
77 |
index 00000000000..e1656b94040 |
78 |
--- /dev/null |
79 |
+++ b/mail-mta/opensmtpd/files/opensmtpd-6.0.2_p1-libressl.patch |
80 |
@@ -0,0 +1,101 @@ |
81 |
+From f948b923873a93472dea9b786cf60a3472b0ddc8 Mon Sep 17 00:00:00 2001 |
82 |
+From: Samuel Holland <samuel@××××××××.org> |
83 |
+Date: Wed, 11 Jan 2017 17:35:29 -0600 |
84 |
+Subject: [PATCH] fix compatibility with libressl |
85 |
+ |
86 |
+These functions are exported by libcrypto from libressl, due to its |
87 |
+similar OpenBSD compatibility layer, but they are not present in any |
88 |
+header files. Thus, while we can use the existing compiled function, |
89 |
+and do not need to provide our own, we do need to provide the prototype |
90 |
+for it. |
91 |
+ |
92 |
+This avoids implicit function declarations and the resulting crashes due |
93 |
+to pointer truncation. |
94 |
+ |
95 |
+The patch is based on an equivalent patch for OpenSSH from |
96 |
+https://bugzilla.mindrot.org/show_bug.cgi?id=2465 |
97 |
+Also see |
98 |
+https://github.com/libressl-portable/portable/issues/109 |
99 |
+ |
100 |
+Fixes #691 |
101 |
+--- |
102 |
+ openbsd-compat/defines.h | 9 --------- |
103 |
+ openbsd-compat/openbsd-compat.h | 25 +++++++++++++++---------- |
104 |
+ 2 files changed, 15 insertions(+), 19 deletions(-) |
105 |
+ |
106 |
+diff --git a/openbsd-compat/defines.h b/openbsd-compat/defines.h |
107 |
+index 2cbfbca..3ffcc81 100644 |
108 |
+--- a/openbsd-compat/defines.h |
109 |
++++ b/openbsd-compat/defines.h |
110 |
+@@ -422,15 +422,6 @@ typedef uint16_t in_port_t; |
111 |
+ #define INET6_ADDRSTRLEN 46 |
112 |
+ #endif |
113 |
+ |
114 |
+-/* |
115 |
+- * Platforms that have arc4random_uniform() and not arc4random_stir() |
116 |
+- * shouldn't need the latter. |
117 |
+- */ |
118 |
+-#if defined(HAVE_ARC4RANDOM) && defined(HAVE_ARC4RANDOM_UNIFORM) && \ |
119 |
+- !defined(HAVE_ARC4RANDOM_STIR) |
120 |
+-# define arc4random_stir() |
121 |
+-#endif |
122 |
+- |
123 |
+ #ifndef HAVE_VA_COPY |
124 |
+ # ifdef HAVE___VA_COPY |
125 |
+ # define va_copy(dest, src) __va_copy(dest, src) |
126 |
+diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h |
127 |
+index a51385b..51f33bb 100644 |
128 |
+--- a/openbsd-compat/openbsd-compat.h |
129 |
++++ b/openbsd-compat/openbsd-compat.h |
130 |
+@@ -119,20 +119,25 @@ int BSDoptind; /* index into parent argv vector */ |
131 |
+ int getpeereid(int , uid_t *, gid_t *); |
132 |
+ #endif |
133 |
+ |
134 |
+-#ifdef HAVE_ARC4RANDOM |
135 |
+-# ifndef HAVE_ARC4RANDOM_STIR |
136 |
+-# define arc4random_stir() |
137 |
+-# endif |
138 |
+-#else |
139 |
++#if !defined(HAVE_ARC4RANDOM) || defined(LIBRESSL_VERSION_NUMBER) |
140 |
+ unsigned int arc4random(void); |
141 |
++#endif |
142 |
++ |
143 |
++#if defined(HAVE_ARC4RANDOM_STIR) |
144 |
+ void arc4random_stir(void); |
145 |
+-#endif /* !HAVE_ARC4RANDOM */ |
146 |
++#elif defined(HAVE_ARC4RANDOM) || defined(LIBRESSL_VERSION_NUMBER) |
147 |
++/* Recent system/libressl implementation; no need for explicit stir */ |
148 |
++# define arc4random_stir() |
149 |
++#else |
150 |
++/* openbsd-compat/arc4random.c provides arc4random_stir() */ |
151 |
++void arc4random_stir(void); |
152 |
++#endif |
153 |
+ |
154 |
+-#ifndef HAVE_ARC4RANDOM_BUF |
155 |
++#if !defined(HAVE_ARC4RANDOM_BUF) || defined(LIBRESSL_VERSION_NUMBER) |
156 |
+ void arc4random_buf(void *, size_t); |
157 |
+ #endif |
158 |
+ |
159 |
+-#ifndef HAVE_ARC4RANDOM_UNIFORM |
160 |
++#if !defined(HAVE_ARC4RANDOM_UNIFORM) || defined(LIBRESSL_VERSION_NUMBER) |
161 |
+ uint32_t arc4random_uniform(uint32_t); |
162 |
+ #endif |
163 |
+ |
164 |
+@@ -174,7 +179,7 @@ int vasprintf(char **, const char *, va_list); |
165 |
+ int vsnprintf(char *, size_t, const char *, va_list); |
166 |
+ #endif |
167 |
+ |
168 |
+-#ifndef HAVE_EXPLICIT_BZERO |
169 |
++#if !defined(HAVE_EXPLICIT_BZERO) || defined(LIBRESSL_VERSION_NUMBER) |
170 |
+ void explicit_bzero(void *p, size_t n); |
171 |
+ #endif |
172 |
+ |
173 |
+@@ -200,7 +205,7 @@ int pidfile(const char *basename); |
174 |
+ struct passwd *pw_dup(const struct passwd *); |
175 |
+ #endif |
176 |
+ |
177 |
+-#ifndef HAVE_REALLOCARRAY |
178 |
++#if !defined(HAVE_REALLOCARRAY) || defined(LIBRESSL_VERSION_NUMBER) |
179 |
+ void *reallocarray(void *, size_t, size_t); |
180 |
+ #endif |
181 |
+ |
182 |
|
183 |
diff --git a/mail-mta/opensmtpd/files/opensmtpd-6.0.2_p1-musl.patch b/mail-mta/opensmtpd/files/opensmtpd-6.0.2_p1-musl.patch |
184 |
new file mode 100644 |
185 |
index 00000000000..065fbcdbe1a |
186 |
--- /dev/null |
187 |
+++ b/mail-mta/opensmtpd/files/opensmtpd-6.0.2_p1-musl.patch |
188 |
@@ -0,0 +1,51 @@ |
189 |
+From 2ab442623e689532910b34ff0dbbc2167da02330 Mon Sep 17 00:00:00 2001 |
190 |
+From: Samuel Holland <samuel@××××××××.org> |
191 |
+Date: Wed, 11 Jan 2017 17:39:07 -0600 |
192 |
+Subject: [PATCH] fix musl compatibility (missing function prototypes) |
193 |
+ |
194 |
+inet_net_pton is already compiled, but no prototype is provided. |
195 |
+res_hnok is provided by the compatibility layer in libasr. |
196 |
+ |
197 |
+These fixes avoid warnings about implicit function declaration. |
198 |
+ |
199 |
+Fixes #758 |
200 |
+--- |
201 |
+ configure.ac | 1 + |
202 |
+ openbsd-compat/openbsd-compat.h | 8 ++++++++ |
203 |
+ 2 files changed, 9 insertions(+) |
204 |
+ |
205 |
+diff --git a/configure.ac b/configure.ac |
206 |
+index 42e092f..e27c514 100644 |
207 |
+--- a/configure.ac |
208 |
++++ b/configure.ac |
209 |
+@@ -594,6 +594,7 @@ AC_CHECK_FUNCS([ \ |
210 |
+ pledge \ |
211 |
+ pw_dup \ |
212 |
+ reallocarray \ |
213 |
++ res_hnok \ |
214 |
+ setenv \ |
215 |
+ setlinebuf \ |
216 |
+ setproctitle \ |
217 |
+diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h |
218 |
+index a51385b..5d2e2c2 100644 |
219 |
+--- a/openbsd-compat/openbsd-compat.h |
220 |
++++ b/openbsd-compat/openbsd-compat.h |
221 |
+@@ -208,10 +208,18 @@ void *reallocarray(void *, size_t, size_t); |
222 |
+ void errc(int, int, const char *, ...); |
223 |
+ #endif |
224 |
+ |
225 |
++#ifndef HAVE_INET_NET_PTON |
226 |
++int inet_net_pton(int, const char *, void *, size_t); |
227 |
++#endif |
228 |
++ |
229 |
+ #ifndef HAVE_PLEDGE |
230 |
+ #define pledge(promises, paths) 0 |
231 |
+ #endif |
232 |
+ |
233 |
++#ifndef HAVE_RES_HNOK |
234 |
++int res_hnok(const char *); |
235 |
++#endif |
236 |
++ |
237 |
+ #if !HAVE_DECL_AF_LOCAL |
238 |
+ #define AF_LOCAL AF_UNIX |
239 |
+ #endif |
240 |
|
241 |
diff --git a/mail-mta/opensmtpd/opensmtpd-6.0.2_p1-r2.ebuild b/mail-mta/opensmtpd/opensmtpd-6.0.2_p1-r2.ebuild |
242 |
new file mode 100644 |
243 |
index 00000000000..a00485d278c |
244 |
--- /dev/null |
245 |
+++ b/mail-mta/opensmtpd/opensmtpd-6.0.2_p1-r2.ebuild |
246 |
@@ -0,0 +1,98 @@ |
247 |
+# Copyright 1999-2017 Gentoo Foundation |
248 |
+# Distributed under the terms of the GNU General Public License v2 |
249 |
+ |
250 |
+EAPI=5 |
251 |
+ |
252 |
+inherit multilib user flag-o-matic eutils pam toolchain-funcs autotools systemd versionator |
253 |
+ |
254 |
+DESCRIPTION="Lightweight but featured SMTP daemon from OpenBSD" |
255 |
+HOMEPAGE="http://www.opensmtpd.org/" |
256 |
+MY_P="${P}" |
257 |
+if [ $(get_last_version_component_index) -eq 4 ]; then |
258 |
+ MY_P="${PN}-$(get_version_component_range 4-)" |
259 |
+fi |
260 |
+SRC_URI="https://www.opensmtpd.org/archives/${MY_P/_}.tar.gz" |
261 |
+ |
262 |
+LICENSE="ISC BSD BSD-1 BSD-2 BSD-4" |
263 |
+SLOT="0" |
264 |
+KEYWORDS="~amd64 ~arm ~x86" |
265 |
+IUSE="libressl pam +mta" |
266 |
+ |
267 |
+DEPEND="!libressl? ( dev-libs/openssl:0 ) |
268 |
+ libressl? ( dev-libs/libressl ) |
269 |
+ elibc_musl? ( sys-libs/fts-standalone ) |
270 |
+ sys-libs/zlib |
271 |
+ pam? ( virtual/pam ) |
272 |
+ sys-libs/db:= |
273 |
+ dev-libs/libevent |
274 |
+ app-misc/ca-certificates |
275 |
+ net-mail/mailbase |
276 |
+ net-libs/libasr |
277 |
+ !mail-mta/courier |
278 |
+ !mail-mta/esmtp |
279 |
+ !mail-mta/exim |
280 |
+ !mail-mta/mini-qmail |
281 |
+ !mail-mta/msmtp[mta] |
282 |
+ !mail-mta/netqmail |
283 |
+ !mail-mta/nullmailer |
284 |
+ !mail-mta/postfix |
285 |
+ !mail-mta/qmail-ldap |
286 |
+ !mail-mta/sendmail |
287 |
+ !mail-mta/ssmtp[mta] |
288 |
+" |
289 |
+RDEPEND="${DEPEND}" |
290 |
+ |
291 |
+S=${WORKDIR}/${MY_P/_} |
292 |
+ |
293 |
+src_prepare() { |
294 |
+ # Use /run instead of /var/run |
295 |
+ sed -i -e '/pidfile_path/s:_PATH_VARRUN:"/run/":' openbsd-compat/pidfile.c || die |
296 |
+ epatch "${FILESDIR}"/${P}-autoconf.patch |
297 |
+ epatch "${FILESDIR}"/${P}-libressl.patch |
298 |
+ epatch "${FILESDIR}"/${P}-musl.patch |
299 |
+ epatch_user |
300 |
+ eautoreconf |
301 |
+} |
302 |
+ |
303 |
+src_configure() { |
304 |
+ tc-export AR |
305 |
+ AR="$(which "$AR")" econf \ |
306 |
+ --with-table-db \ |
307 |
+ --with-user-smtpd=smtpd \ |
308 |
+ --with-user-queue=smtpq \ |
309 |
+ --with-group-queue=smtpq \ |
310 |
+ --with-path-socket=/run \ |
311 |
+ --with-path-CAfile=/etc/ssl/certs/ca-certificates.crt \ |
312 |
+ --sysconfdir=/etc/opensmtpd \ |
313 |
+ $(use_with pam auth-pam) |
314 |
+} |
315 |
+ |
316 |
+src_install() { |
317 |
+ default |
318 |
+ newinitd "${FILESDIR}"/smtpd.initd smtpd |
319 |
+ systemd_dounit "${FILESDIR}"/smtpd.{service,socket} |
320 |
+ use pam && newpamd "${FILESDIR}"/smtpd.pam smtpd |
321 |
+ dosym /usr/sbin/smtpctl /usr/sbin/makemap |
322 |
+ dosym /usr/sbin/smtpctl /usr/sbin/newaliases |
323 |
+ if use mta ; then |
324 |
+ dodir /usr/sbin |
325 |
+ dosym /usr/sbin/smtpctl /usr/sbin/sendmail |
326 |
+ dosym /usr/sbin/smtpctl /usr/bin/sendmail |
327 |
+ dosym /usr/sbin/smtpctl /usr/$(get_libdir)/sendmail |
328 |
+ fi |
329 |
+} |
330 |
+ |
331 |
+pkg_preinst() { |
332 |
+ enewgroup smtpd 25 |
333 |
+ enewuser smtpd 25 -1 /var/empty smtpd |
334 |
+ enewgroup smtpq 252 |
335 |
+ enewuser smtpq 252 -1 /var/empty smtpq |
336 |
+} |
337 |
+ |
338 |
+pkg_postinst() { |
339 |
+ einfo |
340 |
+ einfo "Plugins for SQLite, MySQL, PostgreSQL, LDAP, socketmaps," |
341 |
+ einfo "Redis, and many other useful addons and filters are" |
342 |
+ einfo "available in the mail-filter/opensmtpd-extras package." |
343 |
+ einfo |
344 |
+} |