diff options
author | roam <roam@FreeBSD.org> | 2005-06-14 16:58:47 +0800 |
---|---|---|
committer | roam <roam@FreeBSD.org> | 2005-06-14 16:58:47 +0800 |
commit | 67a115f2b6ed02369b858f11a8a5070efc4a6c84 (patch) | |
tree | 36dd53f9f5151c4bd8272f66958569eac5a27455 /security | |
parent | 0a69e03e14f1303fd7c6803b3f676e23a4206ca0 (diff) | |
download | freebsd-ports-gnome-67a115f2b6ed02369b858f11a8a5070efc4a6c84.tar.gz freebsd-ports-gnome-67a115f2b6ed02369b858f11a8a5070efc4a6c84.tar.zst freebsd-ports-gnome-67a115f2b6ed02369b858f11a8a5070efc4a6c84.zip |
Fix the stunnel ucontext-related problems using a patch from the author,
Michael Trojnara[1].
Also, add the build-time WITH_FORK, WITH_PTHREAD, and WITH_UCONTEXT knobs
to control the stunnel threading model used, based on Vasil Dimov's PR's
with some modifications [2].
While I'm here, add in a <sys/types.h> inclusion that seems to be needed
for <ucontext.h> at least on FreeBSD 6.0/sparc64.
Reported by: many
Pointy hat to: roam (myself) for both not noticing this and then letting
it linger for a while
Obtained from: Michael Trojnara's BSD patch from
<53594c631989fde6ca0bdb3435b93dfe@mirt.net> [1]
PR: 81289, 82202 [2]
Submitted by: Vasil Dimov
Diffstat (limited to 'security')
-rw-r--r-- | security/stunnel/Makefile | 23 | ||||
-rw-r--r-- | security/stunnel/files/patch-src::common.h | 50 | ||||
-rw-r--r-- | security/stunnel/files/patch-src::sthreads.c | 12 |
3 files changed, 84 insertions, 1 deletions
diff --git a/security/stunnel/Makefile b/security/stunnel/Makefile index 3a052bfe49d7..b78be2a29d30 100644 --- a/security/stunnel/Makefile +++ b/security/stunnel/Makefile @@ -7,7 +7,7 @@ PORTNAME= stunnel PORTVERSION= 4.10 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= security MASTER_SITES= http://www.stunnel.org/download/stunnel/src/ \ ftp://stunnel.mirt.net/stunnel/OBSOLETE/ \ @@ -36,6 +36,27 @@ PEM_DIR?= ${PREFIX}/etc CONFIGURE_ARGS+= --enable-ipv6 .endif +.if defined(WITH_UCONTEXT) && defined(WITH_FORK) || defined(WITH_UCONTEXT) && defined(WITH_PTHREAD) || defined(WITH_FORK) && defined(WITH_PTHREAD) +BROKEN= 'The WITH_UCONTEXT, WITH_FORK and WITH_PTHREAD options are mutually exclusive - please specify at most one of them, the default is WITH_PTHREAD' +.endif + +CFLAGS+=-DFORCE_THREADING_MODEL +.if defined(WITH_UCONTEXT) +CFLAGS+=-DFORCE_UCONTEXT +.elif defined(WITH_FORK) +CFLAGS+=-DFORCE_FORK +.else +CFLAGS+=-DFORCE_PTHREAD +.endif + +pre-everything:: + @${ECHO} + @${ECHO} 'You can build ${PORTNAME} with the following options:' + @${ECHO} 'WITH_FORK use the fork(2) model' + @${ECHO} 'WITH_PTHREAD use the pthread(3) model (default)' + @${ECHO} 'WITH_UCONTEXT use the ucontext(3) model' + @${ECHO} + post-patch: # place files under /var/tmp so that this can be run by an unprivileged user # user stunnel and group stunnel diff --git a/security/stunnel/files/patch-src::common.h b/security/stunnel/files/patch-src::common.h new file mode 100644 index 000000000000..c19cd216ad5d --- /dev/null +++ b/security/stunnel/files/patch-src::common.h @@ -0,0 +1,50 @@ +--- src/common.h.orig Sat Apr 23 13:40:10 2005 ++++ src/common.h Tue Jun 14 08:27:11 2005 +@@ -38,17 +38,44 @@ + #endif + + /* threads model */ ++#if defined(FORCE_THREADING_MODEL) ++ ++#undef USE_UCONTEXT ++#undef USE_PTHREAD ++#undef USE_FORK ++ ++#ifdef FORCE_UCONTEXT ++#define USE_UCONTEXT ++#else ++#ifdef FORCE_PTHREAD ++#define USE_PTHREAD ++#else ++#define USE_FORK ++#endif /* FORCE_PTHREAD */ ++#endif /* FORCE_UCONTEXT */ ++ ++#else /* FORCE_THREADING_MODEL */ ++ + #if HAVE_UCONTEXT_H && HAVE_GETCONTEXT && HAVE_POLL + #define USE_UCONTEXT +-#include <ucontext.h> + #elif HAVE_PTHREAD_H && HAVE_LIBPTHREAD + #define USE_PTHREAD ++#else ++#define USE_FORK ++#endif ++ ++#endif /* FORCE_THREADING_MODEL */ ++ ++#ifdef USE_UCONTEXT ++#include <sys/types.h> ++#include <ucontext.h> ++#endif ++ ++#ifdef USE_PTHREAD + #include <pthread.h> + #define THREADS + #define _REENTRANT + #define _THREAD_SAFE +-#else +-#define USE_FORK + #endif + + /* TCP wrapper */ diff --git a/security/stunnel/files/patch-src::sthreads.c b/security/stunnel/files/patch-src::sthreads.c new file mode 100644 index 000000000000..d1dfd346efb0 --- /dev/null +++ b/security/stunnel/files/patch-src::sthreads.c @@ -0,0 +1,12 @@ +*** src/sthreads.c.old Mon Jun 13 21:34:53 2005 +--- src/sthreads.c Mon Jun 13 22:15:01 2005 +*************** +*** 63,68 **** +--- 63,69 ---- + + static void ctx_cleanup_func(void) { /* cleanup the active thread */ + s_log(LOG_DEBUG, "Context %ld closed", ready_head->id); ++ makecontext(&ctx_cleanup, ctx_cleanup_func, 0); + s_poll_wait(NULL, 0); /* wait on poll() */ + } + |