Skip to content

Commit

Permalink
Merge pull request #552 from fac/2016Q4_backport_libevent
Browse files Browse the repository at this point in the history
Backport libevent from 2017Q4 for security fixes
  • Loading branch information
mamash committed Feb 5, 2018
2 parents 7b5da50 + e58e087 commit d6d7c0c
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 61 deletions.
18 changes: 10 additions & 8 deletions devel/libevent/Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# $NetBSD: Makefile,v 1.50 2016/03/05 11:27:45 jperkin Exp $
# $NetBSD: Makefile,v 1.53 2017/09/26 17:57:36 gson Exp $

PKGREVISION= 1
.include "../../devel/libevent/Makefile.common"

PKGNAME= libevent-${LIBEVENT_VERSION}
CATEGORIES= devel
PKGREVISION= 1

MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://libevent.org/
PKGNAME= ${DISTNAME:S/-stable//}
COMMENT= Asynchronous event notification library
LICENSE= modified-bsd

CONFLICTS+= libev<3.9nb1

USE_LIBTOOL= yes
GNU_CONFIGURE= yes
PKGCONFIG_OVERRIDE+= libevent_core.pc.in
PKGCONFIG_OVERRIDE+= libevent_extra.pc.in
PKGCONFIG_OVERRIDE+= libevent_openssl.pc.in
PKGCONFIG_OVERRIDE+= libevent_pthreads.pc.in
PKGCONFIG_OVERRIDE+= libevent.pc.in
TEST_TARGET= verify

LIBS.SunOS+= -lnsl -lresolv
LIBS.SunOS+= -lnsl -lresolv
CPPFLAGS.SunOS+= -D__EXTENSIONS__
CPPFLAGS.QNX+= -D__EXT_POSIX2

CFLAGS+=-g -O0
INSTALL_UNSTRIPPED=yes

# XXX helps build, but needs more testing
#CFLAGS.Interix+= -Dsockaddr_storage=sockaddr_in -DNI_MAXSERV=32
Expand Down
19 changes: 14 additions & 5 deletions devel/libevent/Makefile.common
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# $NetBSD: Makefile.common,v 1.2 2015/02/04 08:04:34 spz Exp $

# $NetBSD: Makefile.common,v 1.3 2017/02/15 17:34:37 adam Exp $
#
# used by devel/libevent/Makefile
# used by devel/py-libevent-rpcgen/Makefile

LIBEVENT_VERSION= 2.0.22
DISTNAME= libevent-2.1.8-stable
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GITHUB:=libevent/}

MAINTAINER?= pkgsrc-users@NetBSD.org
HOMEPAGE= http://libevent.org/
LICENSE= modified-bsd

GITHUB_PROJECT= libevent
GITHUB_RELEASE= release-${PKGVERSION_NOREV}-stable

DISTNAME= libevent-${LIBEVENT_VERSION}-stable
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=levent/}
DISTINFO_FILE= ${.CURDIR}/../../devel/libevent/distinfo
PATCHDIR= ${.CURDIR}/../../devel/libevent/patches
5 changes: 4 additions & 1 deletion devel/libevent/PLIST
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.7 2013/05/10 01:22:27 riastradh Exp $
@comment $NetBSD: PLIST,v 1.8 2017/02/15 17:34:37 adam Exp $
include/evdns.h
include/event.h
include/event2/buffer.h
Expand Down Expand Up @@ -26,6 +26,7 @@ include/event2/tag.h
include/event2/tag_compat.h
include/event2/thread.h
include/event2/util.h
include/event2/visibility.h
include/evhttp.h
include/evrpc.h
include/evutil.h
Expand All @@ -35,5 +36,7 @@ lib/libevent_extra.la
lib/libevent_openssl.la
lib/libevent_pthreads.la
lib/pkgconfig/libevent.pc
lib/pkgconfig/libevent_core.pc
lib/pkgconfig/libevent_extra.pc
lib/pkgconfig/libevent_openssl.pc
lib/pkgconfig/libevent_pthreads.pc
9 changes: 4 additions & 5 deletions devel/libevent/buildlink3.mk
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# $NetBSD: buildlink3.mk,v 1.23 2016/03/05 11:27:45 jperkin Exp $
# $NetBSD: buildlink3.mk,v 1.24 2017/02/15 17:34:37 adam Exp $

BUILDLINK_TREE+= libevent

.if !defined(LIBEVENT_BUILDLINK3_MK)
LIBEVENT_BUILDLINK3_MK:=

BUILDLINK_API_DEPENDS.libevent+=libevent>=0.6
BUILDLINK_ABI_DEPENDS.libevent+=libevent>=2.0.10
BUILDLINK_ABI_DEPENDS.libevent?= libevent>=2.0.22nb1
BUILDLINK_PKGSRCDIR.libevent?= ../../devel/libevent
BUILDLINK_API_DEPENDS.libevent+= libevent>=0.6
BUILDLINK_ABI_DEPENDS.libevent+= libevent>=2.0.22nb1
BUILDLINK_PKGSRCDIR.libevent?= ../../devel/libevent

.include "../../security/openssl/buildlink3.mk"
.endif # LIBEVENT_BUILDLINK3_MK
Expand Down
18 changes: 10 additions & 8 deletions devel/libevent/distinfo
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
$NetBSD: distinfo,v 1.32 2015/11/03 03:27:40 agc Exp $
$NetBSD: distinfo,v 1.37 2017/09/26 17:57:36 gson Exp $

SHA1 (libevent-2.0.22-stable.tar.gz) = a586882bc93a208318c70fc7077ed8fca9862864
RMD160 (libevent-2.0.22-stable.tar.gz) = 6a7e8e3ebcfd2227fa807a604b5c773c90c8b8cc
SHA512 (libevent-2.0.22-stable.tar.gz) = 990637f12e890bfa7f86c194c8b112701436e92b60afb829194879efb85d558b986261e6508fe29bde73981feada874438e2d442cec8ea5730c889954f9bc907
Size (libevent-2.0.22-stable.tar.gz) = 854987 bytes
SHA1 (patch-Makefile.am) = 4bada3e2ddb6cff34edf92abbe22e5d9a64b8ee8
SHA1 (patch-Makefile.in) = 8fcd6f893c3c967599fa4f528953e449e85ac8f0
SHA1 (patch-evutil__rand.c) = e8e0bbccd27ccbb7a9cf077352a8c56a35e87b47
SHA1 (libevent-2.1.8-stable.tar.gz) = 2a1b8bb7a262d3fd0ed6a080a20991a6eed675ec
RMD160 (libevent-2.1.8-stable.tar.gz) = 6c7ce8cb51279f9b6b8d8897192db6a2da3d6797
SHA512 (libevent-2.1.8-stable.tar.gz) = a2fd3dd111e73634e4aeb1b29d06e420b15c024d7b47778883b5f8a4ff320b5057a8164c6d50b53bd196c79d572ce2639fe6265e03a93304b09c22b41e4c2a17
Size (libevent-2.1.8-stable.tar.gz) = 1026485 bytes
SHA1 (patch-Makefile.in) = 09c7524eb8657e1f76232db97273806a8c900219
SHA1 (patch-evutil__rand.c) = 2b51e719d25181e03b5afb7df0bf443f1d62a8f1
SHA1 (patch-http.c) = f878714bf4d894d0026580bbed2a93927543eae8
SHA1 (patch-signal.c) = 1058566e7a6e0ffb709fbd2a3440cac86e188657
SHA1 (patch-test_bench__cascade.c) = 58bd32fe0cddc468fda57386283b5298b28ef93e
15 changes: 0 additions & 15 deletions devel/libevent/patches/patch-Makefile.am

This file was deleted.

21 changes: 6 additions & 15 deletions devel/libevent/patches/patch-Makefile.in
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
$NetBSD: patch-Makefile.in,v 1.2 2015/10/13 14:21:13 jperkin Exp $
$NetBSD: patch-Makefile.in,v 1.3 2017/02/15 17:34:37 adam Exp $

Don't install event_rpcgen.py.

--- Makefile.in.orig 2015-01-05 14:31:14.000000000 +0000
--- Makefile.in.orig 2017-01-29 18:41:28.000000000 +0000
+++ Makefile.in
@@ -210,7 +210,7 @@ libevent_pthreads_la_LINK = $(LIBTOOL) -
@INSTALL_LIBEVENT_FALSE@@PTHREADS_TRUE@am_libevent_pthreads_la_rpath =
@INSTALL_LIBEVENT_TRUE@@PTHREADS_TRUE@am_libevent_pthreads_la_rpath = \
@INSTALL_LIBEVENT_TRUE@@PTHREADS_TRUE@ -rpath $(libdir)
-am__dist_bin_SCRIPTS_DIST = event_rpcgen.py
+am__dist_bin_SCRIPTS_DIST =
SCRIPTS = $(dist_bin_SCRIPTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -511,7 +511,7 @@ VERSION_INFO = 6:9:1
@@ -1003,7 +1003,7 @@ VERSION_INFO = 6:2:0
# nice and rare. For the next couple of years, though, 'struct event'
# is user-visible, and so we can pretty much guarantee that release
# series won't be binary-compatible.
-@INSTALL_LIBEVENT_TRUE@dist_bin_SCRIPTS = event_rpcgen.py
+@INSTALL_LIBEVENT_TRUE@dist_bin_SCRIPTS =
+@INSTALL_LIBEVENT_TRUE@dist_bin_SCRIPTS =
pkgconfigdir = $(libdir)/pkgconfig
LIBEVENT_PKGCONFIG = libevent.pc $(am__append_2) $(am__append_4)

LIBEVENT_PKGCONFIG = libevent.pc libevent_core.pc libevent_extra.pc \
$(am__append_2) $(am__append_4)
9 changes: 5 additions & 4 deletions devel/libevent/patches/patch-evutil__rand.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
$NetBSD: patch-evutil__rand.c,v 1.1 2015/10/13 14:21:13 jperkin Exp $
$NetBSD: patch-evutil__rand.c,v 1.4 2017/09/22 02:58:50 maya Exp $

Native illumos arc4random(3C) imported the latest OpenBSD API which
does not have arc4random_addrandom().

--- evutil_rand.c.orig 2013-11-01 18:18:57.000000000 +0000
--- evutil_rand.c.orig 2016-10-04 19:55:31.000000000 +0000
+++ evutil_rand.c
@@ -174,7 +174,9 @@ evutil_secure_rng_get_bytes(void *buf, s
@@ -195,8 +195,10 @@ evutil_secure_rng_get_bytes(void *buf, s
void
evutil_secure_rng_add_bytes(const char *buf, size_t n)
{
+#if !(defined(_EVENT_HAVE_ARC4RANDOM) && defined(__sun))
+#if !(defined(EVENT__HAVE_ARC4RANDOM) && defined(__sun))
arc4random_addrandom((unsigned char*)buf,
n>(size_t)INT_MAX ? INT_MAX : (int)n);
+#endif
}

void
18 changes: 18 additions & 0 deletions devel/libevent/patches/patch-http.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$NetBSD: patch-http.c,v 1.1 2017/09/26 17:57:36 gson Exp $

Do not crash when evhttp_send_reply_start() is called after
a timeout. Fixes https://github.com/libevent/libevent/issues/509.

--- http.c.orig 2016-12-18 21:56:34.000000000 +0000
+++ http.c
@@ -2820,6 +2820,10 @@ evhttp_send_reply_start(struct evhttp_re
const char *reason)
{
evhttp_response_code_(req, code, reason);
+
+ if (req->evcon == NULL)
+ return;
+
if (evhttp_find_header(req->output_headers, "Content-Length") == NULL &&
REQ_VERSION_ATLEAST(req, 1, 1) &&
evhttp_response_needs_body(req)) {
17 changes: 17 additions & 0 deletions devel/libevent/patches/patch-signal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$NetBSD: patch-signal.c,v 1.1 2017/09/23 03:24:55 maya Exp $

Provide a fallback definition of SA_RESTART for QNX 6.5

--- signal.c.orig 2016-10-04 19:55:31.000000000 +0000
+++ signal.c
@@ -88,6 +88,10 @@
#define __cdecl
#endif

+#ifndef SA_RESTART /* Absent in QNX 6.5 */
+#define SA_RESTART 0
+#endif
+
static int evsig_add(struct event_base *, evutil_socket_t, short, short, void *);
static int evsig_del(struct event_base *, evutil_socket_t, short, short, void *);

14 changes: 14 additions & 0 deletions devel/libevent/patches/patch-test_bench__cascade.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$NetBSD: patch-test_bench__cascade.c,v 1.1 2017/09/22 02:58:50 maya Exp $

Remove redundant include (absent in QNX 6.5)

--- test/bench_cascade.c.orig 2016-10-04 19:55:31.000000000 +0000
+++ test/bench_cascade.c
@@ -48,7 +48,6 @@
#include <unistd.h>
#endif
#include <errno.h>
-#include <getopt.h>
#include <event.h>
#include <evutil.h>

0 comments on commit d6d7c0c

Please sign in to comment.