commit:     0d0139d9442980ff8b1bb9c1db112162fb108496
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Nov  6 13:53:52 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Nov  6 13:54:08 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d0139d9

net-misc/stunnel: version bump to 5.43

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 net-misc/stunnel/Manifest                          |   1 +
 .../files/stunnel-5.43-compat-libressl.patch       | 126 +++++++++++++++++++++
 net-misc/stunnel/stunnel-5.43.ebuild               |  95 ++++++++++++++++
 3 files changed, 222 insertions(+)

diff --git a/net-misc/stunnel/Manifest b/net-misc/stunnel/Manifest
index f0c646af453..eee88aeff94 100644
--- a/net-misc/stunnel/Manifest
+++ b/net-misc/stunnel/Manifest
@@ -3,3 +3,4 @@ DIST stunnel-5.37.tar.gz 645336 SHA256 
d0e3530e3effc64fdec792c71791d4937c6b8bd3b
 DIST stunnel-5.38.tar.gz 647774 SHA256 
09ada29ba1683ab1fd1f31d7bed8305127a0876537e836a40cb83851da034fd5 SHA512 
29adae28955639ab7732ff0d7ea3c097211babcd0c8932717c582f5e38279811a0a209f1daa2c6a22cf69ef28b8b67439038625ba58683c268c322b19e43ac58
 WHIRLPOOL 
ae549e6d498a0bf31591b32f56c4d97141e00485d66aa50be23c5022e9c73f5d51c91d685bf135bf12a365a9b56d53c2dded042ecd8810cbe19e74ca7f89cc5b
 DIST stunnel-5.39.tar.gz 647101 SHA256 
288c087a50465390d05508068ac76c8418a21fae7275febcc63f041ec5b04dee SHA512 
1a59ca3bedd00730598e5bdee61d1968e76d3b1c0bb666fcab5103f5ba6fac0585612198baab180ac0745f658041510fe0115ec8b111da6fd7c161a4ec301458
 WHIRLPOOL 
b4cb9c164b65a6091cde9867cc2386083b5d7224d98f19a84021408b0827eb117a9fa1ef3c3d8e9c85d28d8988dbddaf37ed03235d115d9e284d0ef24ddbe5fa
 DIST stunnel-5.40.tar.gz 648828 SHA256 
23acdb390326ffd507d90f8984ecc90e0d9993f6bd6eac1d0a642456565c45ff SHA512 
2dd403f212f701370775516d25ea441fe41564daf1460f8a9ba4eb960adfb5f007ebfb51a90503fa168c420f06e17a6d20f1b0eab697e2abb6a42dc6f1f898b2
 WHIRLPOOL 
5f9fa99d8e6e153abd15896bd704f42324a8f376633e65685fc7b3d80f06b52048eba923c16a8fbb57e09624a65f0f957fc169e1b9f89d683b67c1cee1ba71b0
+DIST stunnel-5.43.tar.gz 698715 SHA256 
05915babf705a0494886a72a7367913d403d07fc908ebb7b380d639e2d8bcee2 SHA512 
3158ab7573d8c548ee71aecb3f94e141bd80e123a62848945263004e28668050a8a08c904dbf61df28c4f5c1d94eb380943ab39835ccd18273a6acf05a3488a8
 WHIRLPOOL 
3da1656e5937dd1155431fcffd59d523de05a9957a46c8c44edae9493e153919972b1c03b292d6833b4e5ab6a1d8f6b40987f5baa9be9600397430462566b0da

diff --git a/net-misc/stunnel/files/stunnel-5.43-compat-libressl.patch 
b/net-misc/stunnel/files/stunnel-5.43-compat-libressl.patch
new file mode 100644
index 00000000000..5b015a98b61
--- /dev/null
+++ b/net-misc/stunnel/files/stunnel-5.43-compat-libressl.patch
@@ -0,0 +1,126 @@
+diff -Naur stunnel-5.43.orig/src/common.h stunnel-5.43/src/common.h
+--- stunnel-5.43.orig/src/common.h     2017-01-02 14:27:26.000000000 +0000
++++ stunnel-5.43/src/common.h  2017-11-06 13:42:39.940942240 +0000
+@@ -448,7 +448,7 @@
+ #define OPENSSL_NO_TLS1_2
+ #endif /* OpenSSL older than 1.0.1 || defined(OPENSSL_NO_TLS1) */
+ 
+-#if OPENSSL_VERSION_NUMBER>=0x10100000L
++#if OPENSSL_VERSION_NUMBER>=0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #ifndef OPENSSL_NO_SSL2
+ #define OPENSSL_NO_SSL2
+ #endif /* !defined(OPENSSL_NO_SSL2) */
+@@ -474,7 +474,7 @@
+ #include <openssl/des.h>
+ #ifndef OPENSSL_NO_DH
+ #include <openssl/dh.h>
+-#if OPENSSL_VERSION_NUMBER<0x10100000L
++#if OPENSSL_VERSION_NUMBER<0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
+ #endif /* OpenSSL older than 1.1.0 */
+ #endif /* !defined(OPENSSL_NO_DH) */
+diff -Naur stunnel-5.43.orig/src/ctx.c stunnel-5.43/src/ctx.c
+--- stunnel-5.43.orig/src/ctx.c        2017-08-17 09:18:53.000000000 +0000
++++ stunnel-5.43/src/ctx.c     2017-11-06 13:47:55.571861529 +0000
+@@ -295,7 +295,7 @@
+ 
+ #ifndef OPENSSL_NO_DH
+ 
+-#if OPENSSL_VERSION_NUMBER<0x10100000L
++#if OPENSSL_VERSION_NUMBER<0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ NOEXPORT STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx) {
+     return ctx->cipher_list;
+ }
+@@ -398,7 +398,7 @@
+ /**************************************** initialize OpenSSL CONF */
+ 
+ NOEXPORT int conf_init(SERVICE_OPTIONS *section) {
+-#if OPENSSL_VERSION_NUMBER>=0x10002000L
++#if OPENSSL_VERSION_NUMBER>=0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
+     SSL_CONF_CTX *cctx;
+     NAME_LIST *curr;
+     char *cmd, *param;
+diff -Naur stunnel-5.43.orig/src/options.c stunnel-5.43/src/options.c
+--- stunnel-5.43.orig/src/options.c    2017-10-16 18:38:47.000000000 +0000
++++ stunnel-5.43/src/options.c 2017-11-06 13:46:18.630650320 +0000
+@@ -3656,7 +3656,7 @@
+     }
+ #endif
+     /* engines can add new algorithms */
+-#if OPENSSL_VERSION_NUMBER>=0x10100000L
++#if OPENSSL_VERSION_NUMBER>=0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+     OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS|
+         OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
+ #else
+diff -Naur stunnel-5.43.orig/src/ssl.c stunnel-5.43/src/ssl.c
+--- stunnel-5.43.orig/src/ssl.c        2017-10-07 14:23:08.000000000 +0000
++++ stunnel-5.43/src/ssl.c     2017-11-06 13:42:39.940942240 +0000
+@@ -51,7 +51,7 @@
+ int index_session_authenticated, index_session_connect_address;
+ 
+ int ssl_init(void) { /* init TLS before parsing configuration file */
+-#if OPENSSL_VERSION_NUMBER>=0x10100000L
++#if OPENSSL_VERSION_NUMBER>=0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+     OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS |
+         OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_LOAD_CONFIG, NULL);
+ #else
+@@ -87,7 +87,7 @@
+ }
+ 
+ #ifndef OPENSSL_NO_DH
+-#if OPENSSL_VERSION_NUMBER<0x10100000L
++#if OPENSSL_VERSION_NUMBER<0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ /* this is needed for dhparam.c generated with OpenSSL >= 1.1.0
+  * to be linked against the older versions */
+ int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) {
+diff -Naur stunnel-5.43.orig/src/sthreads.c stunnel-5.43/src/sthreads.c
+--- stunnel-5.43.orig/src/sthreads.c   2017-08-17 09:18:53.000000000 +0000
++++ stunnel-5.43/src/sthreads.c        2017-11-06 13:42:39.940942240 +0000
+@@ -216,7 +216,7 @@
+ 
+ struct CRYPTO_dynlock_value stunnel_locks[STUNNEL_LOCKS];
+ 
+-#if OPENSSL_VERSION_NUMBER<0x10100004L
++#if OPENSSL_VERSION_NUMBER<0x10100004L || defined(LIBRESSL_VERSION_NUMBER)
+ #define CRYPTO_THREAD_lock_new() CRYPTO_get_new_dynlockid()
+ #endif
+ 
+diff -Naur stunnel-5.43.orig/src/verify.c stunnel-5.43/src/verify.c
+--- stunnel-5.43.orig/src/verify.c     2017-05-13 09:01:07.000000000 +0000
++++ stunnel-5.43/src/verify.c  2017-11-06 13:46:56.317566128 +0000
+@@ -51,7 +51,7 @@
+ NOEXPORT int verify_callback(int, X509_STORE_CTX *);
+ NOEXPORT int verify_checks(CLI *, int, X509_STORE_CTX *);
+ NOEXPORT int cert_check(CLI *, X509_STORE_CTX *, int);
+-#if OPENSSL_VERSION_NUMBER>=0x10002000L
++#if OPENSSL_VERSION_NUMBER>=0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
+ NOEXPORT int cert_check_subject(CLI *, X509_STORE_CTX *);
+ #endif /* OPENSSL_VERSION_NUMBER>=0x10002000L */
+ NOEXPORT int cert_check_local(X509_STORE_CTX *);
+@@ -285,7 +285,7 @@
+     }
+ 
+     if(depth==0) { /* additional peer certificate checks */
+-#if OPENSSL_VERSION_NUMBER>=0x10002000L
++#if OPENSSL_VERSION_NUMBER>=0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
+         if(!cert_check_subject(c, callback_ctx))
+             return 0; /* reject */
+ #endif /* OPENSSL_VERSION_NUMBER>=0x10002000L */
+@@ -296,7 +296,7 @@
+     return 1; /* accept */
+ }
+ 
+-#if OPENSSL_VERSION_NUMBER>=0x10002000L
++#if OPENSSL_VERSION_NUMBER>=0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
+ NOEXPORT int cert_check_subject(CLI *c, X509_STORE_CTX *callback_ctx) {
+     X509 *cert=X509_STORE_CTX_get_current_cert(callback_ctx);
+     NAME_LIST *ptr;
+@@ -353,7 +353,7 @@
+     cert=X509_STORE_CTX_get_current_cert(callback_ctx);
+     subject=X509_get_subject_name(cert);
+ 
+-#if OPENSSL_VERSION_NUMBER<0x10100006L
++#if OPENSSL_VERSION_NUMBER<0x10100006L || defined(LIBRESSL_VERSION_NUMBER)
+ #define X509_STORE_CTX_get1_certs X509_STORE_get1_certs
+ #endif
+     /* modern API allows retrieving multiple matching certificates */

diff --git a/net-misc/stunnel/stunnel-5.43.ebuild 
b/net-misc/stunnel/stunnel-5.43.ebuild
new file mode 100644
index 00000000000..cb4aa444784
--- /dev/null
+++ b/net-misc/stunnel/stunnel-5.43.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit ssl-cert multilib systemd user
+
+DESCRIPTION="TLS/SSL - Port Wrapper"
+HOMEPAGE="http://www.stunnel.org/index.html";
+SRC_URI="ftp://ftp.stunnel.org/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
+       http://www.usenix.org.uk/mirrors/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
+       
http://ftp.nluug.nl/pub/networking/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
+       http://www.namesdir.com/mirrors/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
+       http://stunnel.cybermirror.org/archive/${PV%%.*}.x/${P}.tar.gz
+       http://mirrors.zerg.biz/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
+       ftp://mirrors.go-parts.com/stunnel/archive/${PV%%.*}.x/${P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 
~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x86-macos"
+IUSE="ipv6 libressl selinux stunnel3 tcpd"
+
+DEPEND="tcpd? ( sys-apps/tcp-wrappers )
+       !libressl? ( dev-libs/openssl:0= )
+       libressl? ( dev-libs/libressl:0= )"
+RDEPEND="${DEPEND}
+       stunnel3? ( dev-lang/perl )
+       selinux? ( sec-policy/selinux-stunnel )"
+
+RESTRICT="test"
+
+pkg_setup() {
+       enewgroup stunnel
+       enewuser stunnel -1 -1 -1 stunnel
+}
+
+src_prepare() {
+       # Hack away generation of certificate
+       sed -i -e "s/^install-data-local:/do-not-run-this:/" \
+               tools/Makefile.in || die "sed failed"
+
+       # libressl compat
+       eapply "${FILESDIR}"/${PN}-5.43-compat-libressl.patch
+
+       echo "CONFIG_PROTECT=\"/etc/stunnel/stunnel.conf\"" > "${T}"/20stunnel
+
+       eapply_user
+}
+
+src_configure() {
+       econf \
+               --libdir="${EPREFIX}/usr/$(get_libdir)" \
+               $(use_enable ipv6) \
+               $(use_enable tcpd libwrap) \
+               --with-ssl="${EPREFIX}"/usr \
+               --disable-fips
+}
+
+src_install() {
+       emake DESTDIR="${D}" install
+       rm -rf "${ED}"/usr/share/doc/${PN}
+       rm -f "${ED}"/etc/stunnel/stunnel.conf-sample \
+               "${ED}"/usr/share/man/man8/stunnel.{fr,pl}.8
+       use stunnel3 || rm -f "${ED}"/usr/bin/stunnel3
+
+       # The binary was moved to /usr/bin with 4.21,
+       # symlink for backwards compatibility
+       dosym ../bin/stunnel /usr/sbin/stunnel
+
+       dodoc AUTHORS BUGS CREDITS PORTS README TODO ChangeLog
+       docinto html
+       dodoc doc/stunnel.html doc/en/VNC_StunnelHOWTO.html tools/ca.html \
+               tools/importCA.html
+
+       insinto /etc/stunnel
+       doins "${FILESDIR}"/stunnel.conf
+       newinitd "${FILESDIR}"/stunnel-r1 stunnel
+
+       doenvd "${T}"/20stunnel
+
+       systemd_dounit "${S}/tools/stunnel.service"
+       systemd_newtmpfilesd "${FILESDIR}"/stunnel.tmpfiles.conf stunnel.conf
+}
+
+pkg_postinst() {
+       if [ ! -f "${EROOT}"/etc/stunnel/stunnel.key ]; then
+               install_cert /etc/stunnel/stunnel
+               chown stunnel:stunnel 
"${EROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
+               chmod 0640 "${EROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
+       fi
+
+       einfo "If you want to run multiple instances of stunnel, create a new 
config"
+       einfo "file ending with .conf in /etc/stunnel/. **Make sure** you 
change "
+       einfo "\'pid= \' with a unique filename."
+}

Reply via email to