Import libeventextra with all the bits of libevent 1.4 we don't want in

the base system: DNS resolver, HTTP and RPC functions.
This commit is contained in:
nicm 2010-04-21 22:55:34 +00:00
parent 8180f62607
commit c0e9f0cc65
8 changed files with 154 additions and 0 deletions

View File

@ -0,0 +1,37 @@
# $OpenBSD: Makefile,v 1.1.1.1 2010/04/21 22:55:34 nicm Exp $
COMMENT = libevent extra features
VERSION = 1.4.13
DISTNAME = libevent-${VERSION}-stable
PKGNAME = libeventextra-${VERSION}
MAJOR = 1
MINOR = 0
SHARED_LIBS = eventextra ${MAJOR}.${MINOR}
CATEGORIES = devel
HOMEPAGE = http://www.monkey.org/~provos/
MAINTAINER = Nicholas Marriott <nicm@openbsd.org>
# BSD
PERMIT_PACKAGE_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_CDROM =Yes
PERMIT_DISTFILES_FTP = Yes
MASTER_SITES = ${HOMEPAGE}
MAKE_ENV += CC="${CC}"
pre-build:
@printf "major=${MAJOR}\nminor=${MINOR}\n" >${WRKBUILD}/shlib_version
@cp ${FILESDIR}/Makefile ${WRKBUILD}
@rm -f ${WRKBUILD}/{event.h,evutil.h}
post-install:
${INSTALL_DATA} ${WRKSRC}/{evhttp.h,evdns.h,evrpc.h} ${PREFIX}/include
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (libevent-1.4.13-stable.tar.gz) = Cz6hjGNActErPB7nNCY2ZA==
RMD160 (libevent-1.4.13-stable.tar.gz) = s2Ou6A9z8npoUW1XwAWS/pI6pAo=
SHA1 (libevent-1.4.13-stable.tar.gz) = sMTpgBt0+L7RUCNTZ0KIpeTxyhY=
SHA256 (libevent-1.4.13-stable.tar.gz) = 1v/x1+e3nm4IO0grC1UZD3G6WXtVw1QdZMBXLd8HR6M=
SIZE (libevent-1.4.13-stable.tar.gz) = 499603

View File

@ -0,0 +1,47 @@
# $OpenBSD: Makefile,v 1.1.1.1 2010/04/21 22:55:34 nicm Exp $
LIB= eventextra
SRCS= http.c evdns.c evrpc.c
LIBDIR= /usr/local/lib
NOPROFILE= 1
CFLAGS+= -I${.CURDIR} -DNDEBUG \
-DDNS_USE_ARC4RANDOM_FOR_ID \
-DHAVE_CLOCK_GETTIME \
-DHAVE_CLOCK_MONOTONIC \
-DHAVE_FCNTL_H \
-DHAVE_FD_MASK \
-DHAVE_GETADDRINFO \
-DHAVE_GETEGID \
-DHAVE_GETEUID \
-DHAVE_GETNAMEINFO \
-DHAVE_GETTIMEOFDAY \
-DHAVE_INTTYPES_H \
-DHAVE_ISSETUGID \
-DHAVE_POLL \
-DHAVE_SELECT \
-DHAVE_SETFD \
-DHAVE_SIGACTION \
-DHAVE_STDARG_H \
-DHAVE_STDINT_H \
-DHAVE_STDLIB_H \
-DHAVE_STRLCPY \
-DHAVE_STRSEP \
-DHAVE_STRTOK_R \
-DHAVE_STRTOLL \
-DHAVE_STRUCT_IN6_ADDR \
-DHAVE_SYS_IOCTL_H \
-DHAVE_SYS_PARAM_H \
-DHAVE_SYS_QUEUE_H \
-DHAVE_SYS_SELECT_H \
-DHAVE_SYS_SOCKET_H \
-DHAVE_SYS_STAT_H \
-DHAVE_SYS_TIME_H \
-DHAVE_SYS_TYPES_H \
-DHAVE_TAILQFOREACH \
-DHAVE_UNISTD_H \
-DHAVE_VASPRINTF \
-DHAVE_WORKING_KQUEUE
.include <bsd.lib.mk>

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-evdns_c,v 1.1.1.1 2010/04/21 22:55:34 nicm Exp $
--- evdns.c.orig Tue Apr 20 20:35:13 2010
+++ evdns.c Tue Apr 20 20:36:31 2010
@@ -47,12 +47,14 @@
#ifndef DNS_USE_GETTIMEOFDAY_FOR_ID
#ifndef DNS_USE_OPENSSL_FOR_ID
#ifndef DNS_USE_FTIME_FOR_ID
+#ifndef DNS_USE_ARC4RANDOM_FOR_ID
#error Must configure at least one id generation method.
#error Please see the documentation.
#endif
#endif
#endif
#endif
+#endif
/* #define _POSIX_C_SOURCE 200507 */
#define _GNU_SOURCE
@@ -1080,6 +1082,10 @@ default_transaction_id_fn(void)
*/
abort();
}
+#endif
+
+#ifdef DNS_USE_ARC4RANDOM_FOR_ID
+ trans_id = arc4random() & 0xffff;
#endif
return trans_id;
}

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-http_c,v 1.1.1.1 2010/04/21 22:55:34 nicm Exp $
--- http.c.orig Thu Jul 2 07:05:28 2009
+++ http.c Tue Apr 20 21:32:53 2010
@@ -281,15 +281,17 @@ evhttp_htmlescape(const char *html)
for (i = 0; i < old_size; ++i)
new_size += strlen(html_replace(html[i], scratch_space));
+ new_size++;
- p = escaped_html = malloc(new_size + 1);
+ p = escaped_html = malloc(new_size);
if (escaped_html == NULL)
- event_err(1, "%s: malloc(%d)", __func__, new_size + 1);
+ event_err(1, "%s: malloc(%d)", __func__, new_size);
for (i = 0; i < old_size; ++i) {
const char *replaced = html_replace(html[i], scratch_space);
/* this is length checked */
- strcpy(p, replaced);
+ strlcpy(p, replaced, new_size);
p += strlen(replaced);
+ new_size -= strlen(replaced);
}
*p = '\0';

View File

@ -0,0 +1,3 @@
libevent is a library for event-driven programs.
This provides the "extra" parts: asynchronous DNS, HTTP and RPC support.

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2010/04/21 22:55:34 nicm Exp $
@lib lib/libeventextra.so.${LIBeventextra_VERSION}

View File

@ -0,0 +1,7 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2010/04/21 22:55:34 nicm Exp $
%%SHARED%%
include/evdns.h
include/evhttp.h
include/evrpc.h
lib/libeventextra.a
lib/libeventextra_pic.a