aboutsummaryrefslogtreecommitdiff
path: root/security/stunnel
diff options
context:
space:
mode:
authorPeter Pentchev <roam@FreeBSD.org>2005-06-14 08:58:47 +0000
committerPeter Pentchev <roam@FreeBSD.org>2005-06-14 08:58:47 +0000
commitfe4f451ee5f772b531d032be959ba01b0a1e3e39 (patch)
tree1507fa66a383f6956a6dce16930251b04ea743dd /security/stunnel
parentb46b07b68a32301dccbced83288dac2ab5fbab57 (diff)
downloadports-fe4f451ee5f772b531d032be959ba01b0a1e3e39.tar.gz
ports-fe4f451ee5f772b531d032be959ba01b0a1e3e39.zip
Notes
Diffstat (limited to 'security/stunnel')
-rw-r--r--security/stunnel/Makefile23
-rw-r--r--security/stunnel/files/patch-src::common.h50
-rw-r--r--security/stunnel/files/patch-src::sthreads.c12
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() */
+ }
+