logo

overlay

Personnal gentoo overlay
commit: a041abec87705308b54fc8d455b8eef65ee97ac8
parent: 21444c1cb0f0c216725581c749e15a5d7833afee
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 30 Dec 2017 02:09:59 +0100

net-libs/libasr: Add patch from Alpine Linux with LibreSSL (also fixes build with musl)

Diffstat:

net-libs/libasr/files/1.0.2-Replace-res_randomid_with_arc4random.patch | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
net-libs/libasr/libasr-1.0.2.ebuild | 8++++++--
2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/net-libs/libasr/files/1.0.2-Replace-res_randomid_with_arc4random.patch b/net-libs/libasr/files/1.0.2-Replace-res_randomid_with_arc4random.patch @@ -0,0 +1,66 @@ +From fb2c3b37d1022d84506ca0815c7c888c4f08e90c Mon Sep 17 00:00:00 2001 +From: xentec <xentec@aix0.eu> +Date: Sat, 11 Feb 2017 14:39:24 +0000 +Subject: [PATCH 2/3] Replace missing res_randomid() with the more secure + arc4random() + +--- + configure.ac | 2 ++ + openbsd-compat/openbsd-compat.h | 2 ++ + src/res_mkquery.c | 2 +- + src/res_send_async.c | 2 +- + 4 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 10aff04..fa0e896 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -264,6 +264,8 @@ AC_ARG_WITH([Werror], + ) + #l325 + ++LIBS="-lcrypto $LIBS" ++ + AC_CHECK_HEADERS([ \ + crypt.h \ + dirent.h \ +diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h +index c30591c..9be2e0b 100644 +--- a/openbsd-compat/openbsd-compat.h ++++ b/openbsd-compat/openbsd-compat.h +@@ -123,4 +123,6 @@ int res_hnok(const char *); + int clock_gettime(int, struct timespec *); + #endif + ++unsigned int arc4random(void); ++ + #endif /* _OPENBSD_COMPAT_H */ +diff --git a/src/res_mkquery.c b/src/res_mkquery.c +index 27ed21e..cce4029 100644 +--- a/src/res_mkquery.c ++++ b/src/res_mkquery.c +@@ -57,7 +57,7 @@ res_mkquery(int op, const char *dname, int class, int type, + ac = asr_use_resolver(NULL); + + memset(&h, 0, sizeof h); +- h.id = res_randomid(); ++ h.id = arc4random(); + if (ac->ac_options & RES_RECURSE) + h.flags |= RD_MASK; + h.qdcount = 1; +diff --git a/src/res_send_async.c b/src/res_send_async.c +index a60aa0d..a0f4704 100644 +--- a/src/res_send_async.c ++++ b/src/res_send_async.c +@@ -380,7 +380,7 @@ setup_query(struct asr_query *as, const char *name, const char *dom, + as->as.dns.obuflen = 0; + + memset(&h, 0, sizeof h); +- h.id = res_randomid(); ++ h.id = arc4random(); + if (as->as_ctx->ac_options & RES_RECURSE) + h.flags |= RD_MASK; + h.qdcount = 1; +-- +2.11.1 + diff --git a/net-libs/libasr/libasr-1.0.2.ebuild b/net-libs/libasr/libasr-1.0.2.ebuild @@ -10,7 +10,11 @@ SRC_URI="https://www.opensmtpd.org/archives/${P}.tar.gz" LICENSE="ISC BSD BSD-1 BSD-2 BSD-4" SLOT="0" KEYWORDS="~amd64 ~arm ~arm64 ~x86" -IUSE="" +IUSE="libressl" -DEPEND="" +DEPEND="?libressl ( dev-libs/libressl:= )" RDEPEND="${DEPEND}" + +src_prepare() { + use libressl && epatch "${FILESDIR}/${PV}-Replace-res_randomid_with_arc4random.patch" +}