aboutsummaryrefslogtreecommitdiff
path: root/security/distcache
diff options
context:
space:
mode:
authorAlexey Dokuchaev <danfe@FreeBSD.org>2020-07-07 10:07:49 +0000
committerAlexey Dokuchaev <danfe@FreeBSD.org>2020-07-07 10:07:49 +0000
commit475c4b91c05634f5510205234a9eda043514abbc (patch)
tree4358daf66ad18115988bfa465f8027aaf09295bf /security/distcache
parent0bfceccee1490793f60b2d9f94d997b382053470 (diff)
downloadports-475c4b91c05634f5510205234a9eda043514abbc.tar.gz
ports-475c4b91c05634f5510205234a9eda043514abbc.zip
- Unbreak the build against contemporary versions of OpenSSL
- Hoop up a simple test to our framework so we know it works PR: 236820
Notes
Notes: svn path=/head/; revision=541400
Diffstat (limited to 'security/distcache')
-rw-r--r--security/distcache/Makefile15
-rw-r--r--security/distcache/files/patch-ssl__swamp__swamp.c36
-rw-r--r--security/distcache/files/patch-ssl__swamp__swamp.h9
-rw-r--r--security/distcache/files/patch-ssl__swamp__utils.c6
-rw-r--r--security/distcache/files/patch-ssl_libnalssl_bss__nal.c105
5 files changed, 154 insertions, 17 deletions
diff --git a/security/distcache/Makefile b/security/distcache/Makefile
index 6913bb7d2966..1fe6c654077d 100644
--- a/security/distcache/Makefile
+++ b/security/distcache/Makefile
@@ -24,12 +24,10 @@ PORTDOCS= ANNOUNCE BUGS CHANGES FAQ README
OPTIONS_DEFINE= DOCS
-.include <bsd.port.pre.mk>
-
-.if ${SSL_DEFAULT} == base
-BROKEN_FreeBSD_12= SSL/TLS libraries were missing or unusable
-BROKEN_FreeBSD_13= SSL/TLS libraries were missing or unusable
-.endif
+post-patch:
+ @${GREP} -q 'define SSLeay_version' /usr/include/openssl/crypto.h \
+ && ${REINPLACE_CMD} -e 's,SSLeay_version,OpenSSL_version,' \
+ ${WRKSRC}/ssl/configure || :
post-install:
# INSTALL_TARGET=install-strip isn't working! Brute force it
@@ -39,4 +37,7 @@ post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
(cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR})
-.include <bsd.port.post.mk>
+do-test:
+ @cd ${WRKSRC} && ${SH} devel/test.sh
+
+.include <bsd.port.mk>
diff --git a/security/distcache/files/patch-ssl__swamp__swamp.c b/security/distcache/files/patch-ssl__swamp__swamp.c
index b21f89363d5c..462be842d4b8 100644
--- a/security/distcache/files/patch-ssl__swamp__swamp.c
+++ b/security/distcache/files/patch-ssl__swamp__swamp.c
@@ -1,17 +1,45 @@
---- ssl/swamp/swamp.c.orig 2004-02-19 20:37:33 UTC
+--- ssl/swamp/swamp.c.orig 2004-04-30 12:58:00 UTC
+++ ssl/swamp/swamp.c
-@@ -104,10 +104,14 @@ static SSL_CTX *ossl_setup_ssl_ctx(const
+@@ -105,10 +105,14 @@ static SSL_CTX *ossl_setup_ssl_ctx(const swamp_config
switch(config->sslmeth) {
case SWAMP_SSLMETH_NORMAL:
sslmethod = SSLv23_client_method(); break;
-+#ifndef OPENSSL_NO_SSL2
++#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(OPENSSL_NO_SSL2)
case SWAMP_SSLMETH_SSLv2:
sslmethod = SSLv2_client_method(); break;
+#endif
-+#ifndef OPENSSL_NO_SSL3
++#ifndef OPENSSL_NO_SSL3_METHOD
case SWAMP_SSLMETH_SSLv3:
sslmethod = SSLv3_client_method(); break;
+#endif
case SWAMP_SSLMETH_TLSv1:
sslmethod = TLSv1_client_method(); break;
default:
+@@ -151,7 +155,7 @@ static SSL_CTX *ossl_setup_ssl_ctx(const swamp_config
+ fp = NULL;
+ }
+ if(x509) {
+- if(!X509_STORE_add_cert(ctx->cert_store, x509))
++ if(!X509_STORE_add_cert(SSL_CTX_get_cert_store(ctx), x509))
+ return NULL;
+ /* Reference counts */
+ X509_free(x509);
+@@ -444,13 +448,16 @@ possible_reconnect:
+ }
+ }
+ if(ctx->config->output_sessions) {
++ const unsigned char *session_id;
++ unsigned int session_id_length;
+ temp_session = SSL_get1_session(item->ssl);
+ /* debug some stuff :-) */
+ SYS_fprintf(SYS_stderr, "session-id[conn:%i]:", loop);
+- for(tmp = 0; tmp < (int)temp_session->session_id_length;
++ session_id = SSL_SESSION_get_id(temp_session, &session_id_length);
++ for(tmp = 0; tmp < session_id_length;
+ tmp++)
+ SYS_fprintf(SYS_stderr, "%02X",
+- temp_session->session_id[tmp]);
++ session_id[tmp]);
+ SYS_fprintf(SYS_stderr, "\n");
+ SSL_SESSION_free(temp_session);
+ }
diff --git a/security/distcache/files/patch-ssl__swamp__swamp.h b/security/distcache/files/patch-ssl__swamp__swamp.h
index 763b1922bb24..842826594d5a 100644
--- a/security/distcache/files/patch-ssl__swamp__swamp.h
+++ b/security/distcache/files/patch-ssl__swamp__swamp.h
@@ -1,12 +1,15 @@
---- ssl/swamp/swamp.h.orig 2004-02-17 20:29:34 UTC
+--- ssl/swamp/swamp.h.orig 2004-04-30 12:58:00 UTC
+++ ssl/swamp/swamp.h
-@@ -161,7 +161,9 @@ char *util_parse_escaped_string(const ch
+@@ -162,8 +162,12 @@ char *util_parse_escaped_string(const char *str_toconv
typedef enum st_swamp_sslmeth {
SWAMP_SSLMETH_NORMAL, /* SSLv23_client_method() */
-+#ifndef OPENSSL_NO_SSL2
++#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(OPENSSL_NO_SSL2)
SWAMP_SSLMETH_SSLv2, /* SSLv2_client_method() */
+#endif
++#ifndef OPENSSL_NO_SSL3_METHOD
SWAMP_SSLMETH_SSLv3, /* SSLv3_client_method() */
++#endif
SWAMP_SSLMETH_TLSv1 /* TLSv1_client_method() */
} swamp_sslmeth;
+
diff --git a/security/distcache/files/patch-ssl__swamp__utils.c b/security/distcache/files/patch-ssl__swamp__utils.c
index 813fd3ab268b..ab38bc962a37 100644
--- a/security/distcache/files/patch-ssl__swamp__utils.c
+++ b/security/distcache/files/patch-ssl__swamp__utils.c
@@ -1,10 +1,10 @@
---- ssl/swamp/utils.c.orig 2004-02-17 20:29:34 UTC
+--- ssl/swamp/utils.c.orig 2004-04-30 12:58:00 UTC
+++ ssl/swamp/utils.c
-@@ -269,10 +269,14 @@ int util_parse_sslmeth(const char *str_t
+@@ -267,10 +267,14 @@ int util_parse_sslmeth(const char *str_toconvert, swam
{
if(!strcmp(str_toconvert, "normal"))
*val = SWAMP_SSLMETH_NORMAL;
-+#ifndef OPENSSL_NO_SSL2
++#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(OPENSSL_NO_SSL2)
else if(!strcmp(str_toconvert, "sslv2"))
*val = SWAMP_SSLMETH_SSLv2;
+#endif
diff --git a/security/distcache/files/patch-ssl_libnalssl_bss__nal.c b/security/distcache/files/patch-ssl_libnalssl_bss__nal.c
new file mode 100644
index 000000000000..ec7f7e73c322
--- /dev/null
+++ b/security/distcache/files/patch-ssl_libnalssl_bss__nal.c
@@ -0,0 +1,105 @@
+--- ssl/libnalssl/bss_nal.c.orig 2004-05-27 20:54:48 UTC
++++ ssl/libnalssl/bss_nal.c
+@@ -41,26 +41,30 @@ static long NAL_bio_ctrl(BIO *, int, long, void *);
+ static int NAL_bio_new(BIO *);
+ static int NAL_bio_free(BIO *);
+
+-static BIO_METHOD NAL_bio_meth = {
+- BIO_TYPE_BIO,
+- "NAL_CONNECTION",
+- NAL_bio_write,
+- NAL_bio_read,
+- NAL_bio_puts,
+- NULL, /* bgets */
+- NAL_bio_ctrl,
+- NAL_bio_new,
+- NAL_bio_free,
+- NULL /* callback_ctrl */
+-};
++static BIO_METHOD *NAL_bio_meth = NULL;
+
++static BIO_METHOD *create_NAL_bio_meth(void)
++{
++ BIO_METHOD *bm = BIO_meth_new(BIO_get_new_index(), "NAL_CONNECTION");
++ BIO_meth_set_write(bm, NAL_bio_write);
++ BIO_meth_set_read(bm, NAL_bio_read);
++ BIO_meth_set_puts(bm, NAL_bio_puts);
++ BIO_meth_set_ctrl(bm, NAL_bio_ctrl);
++ BIO_meth_set_create(bm, NAL_bio_new);
++ BIO_meth_set_destroy(bm, NAL_bio_free);
++ return bm;
++}
++
+ BIO *BIO_new_NAL_CONNECTION(NAL_CONNECTION *c)
+ {
+- BIO *b = BIO_new(&NAL_bio_meth);
++ if (NAL_bio_meth == NULL)
++ NAL_bio_meth = create_NAL_bio_meth();
++
++ BIO *b = BIO_new(NAL_bio_meth);
+ if(!b) return NULL;
+- b->ptr = c;
+- b->init = 1;
+- b->shutdown = 1;
++ BIO_set_data(b, c);
++ BIO_set_init(b, 1);
++ BIO_set_shutdown(b, 1);
+ return b;
+ }
+
+@@ -69,10 +73,10 @@ static int NAL_bio_new(BIO *b)
+ #ifdef NAL_BIO_DEBUG
+ SYS_fprintf(SYS_stdout, "NAL_BIO_DEBUG: NAL_bio_new()\n");
+ #endif
+- b->init = 0;
+- b->num = -1;
+- b->ptr = NULL;
+- b->flags = 0;
++ BIO_set_init(b, 0);
++ // XXX: b->num = -1;
++ BIO_set_data(b, NULL);
++ BIO_set_flags(b, 0);
+ return 1;
+ }
+
+@@ -81,8 +85,8 @@ static int NAL_bio_free(BIO *b)
+ #ifdef NAL_BIO_DEBUG
+ SYS_fprintf(SYS_stdout, "NAL_BIO_DEBUG: NAL_bio_free()\n");
+ #endif
+- if(b->shutdown && b->init && b->ptr) {
+- NAL_CONNECTION *c = b->ptr;
++ if(BIO_get_shutdown(b) && BIO_get_init(b) && BIO_get_data(b)) {
++ NAL_CONNECTION *c = BIO_get_data(b);
+ NAL_CONNECTION_free(c);
+ }
+ return 1;
+@@ -91,7 +95,7 @@ static int NAL_bio_free(BIO *b)
+ static int NAL_bio_write(BIO *b, const char *ptr, int len)
+ {
+ unsigned int res;
+- NAL_CONNECTION *c = (NAL_CONNECTION *)b->ptr;
++ NAL_CONNECTION *c = (NAL_CONNECTION *)BIO_get_data(b);
+ NAL_BUFFER *buf = NAL_CONNECTION_get_send(c);
+ #ifdef NAL_BIO_DEBUG
+ SYS_fprintf(SYS_stdout, "NAL_BIO_DEBUG: NAL_bio_write(%d)\n", len);
+@@ -109,7 +113,7 @@ static int NAL_bio_write(BIO *b, const char *ptr, int
+ static int NAL_bio_read(BIO *b, char *ptr, int len)
+ {
+ unsigned int res;
+- NAL_CONNECTION *c = (NAL_CONNECTION *)b->ptr;
++ NAL_CONNECTION *c = (NAL_CONNECTION *)BIO_get_data(b);
+ NAL_BUFFER *buf = NAL_CONNECTION_get_read(c);
+ #ifdef NAL_BIO_DEBUG
+ SYS_fprintf(SYS_stdout, "NAL_BIO_DEBUG: NAL_bio_read(%d)\n", len);
+@@ -150,9 +154,9 @@ static long NAL_bio_ctrl(BIO *b, int cmd, long num, vo
+ return 1;
+ /* Commands */
+ case BIO_CTRL_GET_CLOSE:
+- return b->shutdown;
++ return BIO_get_shutdown(b);
+ case BIO_CTRL_SET_CLOSE:
+- b->shutdown = (int)num;
++ BIO_set_shutdown(b, (int)num);
+ return 1;
+ default:
+ #ifdef NAL_BIO_DEBUG