Aurelien Larcher
2022-07-15 5bc65fff4e51a9d94537676741a0a213516af636
libesmtp: fix build, drop 32-bit, use openssl 1.1
1 files added
4 files modified
156 ■■■■■ changed files
components/cluster/libesmtp/Makefile 47 ●●●● patch | view | raw | blame | history
components/cluster/libesmtp/libesmtp.p5m 18 ●●●●● patch | view | raw | blame | history
components/cluster/libesmtp/manifests/sample-manifest.p5m 14 ●●●● patch | view | raw | blame | history
components/cluster/libesmtp/patches/libesmtp-1.0.6-openssl-1.1-api-compatibility.patch 74 ●●●●● patch | view | raw | blame | history
components/cluster/libesmtp/pkg5 3 ●●●● patch | view | raw | blame | history
components/cluster/libesmtp/Makefile
@@ -13,42 +13,41 @@
# Copyright 2017 Andreas Grueninger, Grueninger GmbH, (grueni). All rights reserved.
#
BUILD_STYLE=configure
BUILD_BITS=64
USE_OPENSSL11=yes
include ../../../make-rules/shared-macros.mk
COMPONENT_NAME= libesmtp
COMPONENT_VERSION= 1.0.6
COMPONENT_REVISION= 1
COMPONENT_FMRI= library/$(COMPONENT_NAME)
COMPONENT_CLASSIFICATION= Development/C
COMPONENT_NAME=         libesmtp
COMPONENT_VERSION=      1.0.6
COMPONENT_REVISION=     2
COMPONENT_FMRI=         library/$(COMPONENT_NAME)
COMPONENT_CLASSIFICATION=Development/C
COMPONENT_PROJECT_URL=  http://www.stafford.uklinux.net/libesmtp
COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_ARCHIVE= $(COMPONENT_NAME)-$(COMPONENT_VERSION).tar.gz
COMPONENT_SRC=          $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_ARCHIVE=      $(COMPONENT_NAME)-$(COMPONENT_VERSION).tar.gz
COMPONENT_ARCHIVE_HASH= sha256:c99907a63c1135db2659e60e53eaa46723e22e31c9affc054a0a61941f2c1bab
COMPONENT_ARCHIVE_URL= http://github.com/grueni/$(COMPONENT_NAME)/archive/v${COMPONENT_VERSION}.tar.gz
COMPONENT_LICENSE= GPLv2
COMPONENT_SUMMARY= libESMTP - A Library for Posting Electronic Mail
COMPONENT_ARCHIVE_URL=  http://github.com/grueni/$(COMPONENT_NAME)/archive/v${COMPONENT_VERSION}.tar.gz
COMPONENT_LICENSE=      GPLv2
COMPONENT_SUMMARY=      libESMTP - A Library for Posting Electronic Mail
include $(WS_MAKE_RULES)/prep.mk
include $(WS_MAKE_RULES)/configure.mk
include $(WS_MAKE_RULES)/ips.mk
include $(WS_MAKE_RULES)/common.mk
CFLAGS.32= -m32 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS -DNAME_MAX=255 -DHOST_NAME_MAX=255
CFLAGS.64= -m64 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS -DNAME_MAX=255 -DHOST_NAME_MAX=255
CFLAGS=  $(CFLAGS.$(BITS))
CFLAGS= $(CC_BITS) -D__EXTENSIONS__ \
    -D_POSIX_PTHREAD_SEMANTICS \
    -DNAME_MAX=255 -DHOST_NAME_MAX=255 \
        -L$(OPENSSL_LIBDIR.$(BITS)) -R$(OPENSSL_LIBDIR.$(BITS))
CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
CONFIGURE_OPTIONS += LDLAGS="-L$(OPENSSL_LIBDIR.$(BITS)) -R$(OPENSSL_LIBDIR.$(BITS))"
CONFIGURE_OPTIONS += LT_SYS_LIBRARY_PATH="$(OPENSSL_LIBDIR.$(BITS))"
CONFIGURE_OPTIONS += --disable-isoc
COMPONENT_PREP_ACTION=(cd $(SOURCE_DIR); mkdir m4; $(AUTORECONF) -i)
COMPONENT_PRE_CONFIGURE_ACTION=($(CLONEY) $(SOURCE_DIR) $(@D))
build:          $(BUILD_32_and_64)
install:        $(INSTALL_32_and_64)
test:           $(TEST_32_and_64)
REQUIRED_PACKAGES += SUNWcs
REQUIRED_PACKAGES += library/security/openssl
# Auto-generated dependencies
REQUIRED_PACKAGES += library/security/openssl-11
REQUIRED_PACKAGES += shell/ksh93
REQUIRED_PACKAGES += system/library
components/cluster/libesmtp/libesmtp.p5m
@@ -1,10 +1,11 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL)". You may
# only use this file in accordance with the terms of the CDDL.
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
@@ -14,16 +15,16 @@
#
set name=pkg.fmri value=pkg:/$(COMPONENT_FMRI)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.human-version value=$(HUMAN_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY)"
set name=info.classification value="$(COMPONENT_CLASSIFICATION)"
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
license $(COMPONENT_LICENSE_FILE) license='$(COMPONENT_LICENSE)'
file path=usr/bin/libesmtp-config
file path=usr/bin/$(MACH64)/libesmtp-config
file path=usr/include/auth-client.h
file path=usr/include/auth-plugin.h
@@ -35,10 +36,3 @@
link path=usr/lib/$(MACH64)/libesmtp.so target=libesmtp.so.6.1.6
link path=usr/lib/$(MACH64)/libesmtp.so.6 target=libesmtp.so.6.1.6
file path=usr/lib/$(MACH64)/libesmtp.so.6.1.6
file path=usr/lib/esmtp-plugins/sasl-cram-md5.so
file path=usr/lib/esmtp-plugins/sasl-login.so
file path=usr/lib/esmtp-plugins/sasl-plain.so
link path=usr/lib/libesmtp.so target=libesmtp.so.6.1.6
link path=usr/lib/libesmtp.so.6 target=libesmtp.so.6.1.6
file path=usr/lib/libesmtp.so.6.1.6
components/cluster/libesmtp/manifests/sample-manifest.p5m
@@ -10,10 +10,11 @@
#
#
# Copyright 2017 <contributor>
# Copyright 2022 <contributor>
#
set name=pkg.fmri value=pkg:/$(COMPONENT_FMRI)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.human-version value=$(HUMAN_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY)"
set name=info.classification value="$(COMPONENT_CLASSIFICATION)"
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
@@ -22,7 +23,6 @@
license $(COMPONENT_LICENSE_FILE) license='$(COMPONENT_LICENSE)'
file path=usr/bin/$(MACH64)/libesmtp-config
file path=usr/bin/libesmtp-config
file path=usr/include/auth-client.h
file path=usr/include/auth-plugin.h
@@ -37,13 +37,3 @@
link path=usr/lib/$(MACH64)/libesmtp.so target=libesmtp.so.6.1.6
link path=usr/lib/$(MACH64)/libesmtp.so.6 target=libesmtp.so.6.1.6
file path=usr/lib/$(MACH64)/libesmtp.so.6.1.6
file path=usr/lib/esmtp-plugins/sasl-cram-md5.a
file path=usr/lib/esmtp-plugins/sasl-cram-md5.so
file path=usr/lib/esmtp-plugins/sasl-login.a
file path=usr/lib/esmtp-plugins/sasl-login.so
file path=usr/lib/esmtp-plugins/sasl-plain.a
file path=usr/lib/esmtp-plugins/sasl-plain.so
file path=usr/lib/libesmtp.a
link path=usr/lib/libesmtp.so target=libesmtp.so.6.1.6
link path=usr/lib/libesmtp.so.6 target=libesmtp.so.6.1.6
file path=usr/lib/libesmtp.so.6.1.6
components/cluster/libesmtp/patches/libesmtp-1.0.6-openssl-1.1-api-compatibility.patch
New file
@@ -0,0 +1,74 @@
https://gitweb.gentoo.org/repo/gentoo.git/plain/net-libs/libesmtp/files/libesmtp-1.0.6-openssl-1.1-api-compatibility.patch?id=fa230af7c9832b53e08d34799acbc5877a912fc5
diff --git a/configure.ac b/configure.ac
index 556f220..2c0693d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -303,7 +303,7 @@ if test x$with_openssl != xno ; then
     )
 fi
 if test x$with_openssl != xno ; then
-    AC_CHECK_LIB(ssl, SSL_library_init, [
+    AC_CHECK_LIB(ssl, SSL_new, [
                 with_openssl=yes
                 LIBS="-lssl -lcrypto $LIBS"
              ], [
diff --git a/smtp-tls.c b/smtp-tls.c
index 9a66806..cfc6589 100644
--- a/smtp-tls.c
+++ b/smtp-tls.c
@@ -57,6 +57,7 @@ static void *ctx_password_cb_arg;
 #ifdef USE_PTHREADS
 #include <pthread.h>
 static pthread_mutex_t starttls_mutex = PTHREAD_MUTEX_INITIALIZER;
+#if OPENSSL_VERSION_NUMBER < 0x10100000
 static pthread_mutex_t *openssl_mutex;
 static void
@@ -70,6 +71,7 @@ openssl_mutexcb (int mode, int n,
     pthread_mutex_unlock (&openssl_mutex[n]);
 }
 #endif
+#endif
 static int
 starttls_init (void)
@@ -77,6 +79,10 @@ starttls_init (void)
   if (tls_init)
     return 1;
+#if OPENSSL_VERSION_NUMBER < 0x10100000
+  /* starting from OpenSSL 1.1.0, OpenSSL uses a new threading API and does its own locking */
+  /* also initialization has been reworked and is done automatically */
+  /* so there's not much to do here any more */
 #ifdef USE_PTHREADS
   /* Set up mutexes for the OpenSSL library */
   if (openssl_mutex == NULL)
@@ -94,9 +100,10 @@ starttls_init (void)
       CRYPTO_set_locking_callback (openssl_mutexcb);
     }
 #endif
-  tls_init = 1;
   SSL_load_error_strings ();
   SSL_library_init ();
+#endif
+  tls_init = 1;
   return 1;
 }
@@ -201,7 +208,15 @@ starttls_create_ctx (smtp_session_t session)
      3207.  Servers typically support SSL as well as TLS because some
      versions of Netscape do not support TLS.  I am assuming that all
      currently deployed servers correctly support TLS.  */
+#if OPENSSL_VERSION_NUMBER < 0x10100000
   ctx = SSL_CTX_new (TLSv1_client_method ());
+#else
+  ctx = SSL_CTX_new (TLS_client_method ());
+  if (!SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION)) {
+        /* FIXME: set an error code AND free the allocated ctx */
+        return NULL;
+  }
+#endif
   /* Load our keys and certificates.  To avoid messing with configuration
      variables etc, use fixed paths for the certificate store.  These are
components/cluster/libesmtp/pkg5
@@ -1,7 +1,8 @@
{
    "dependencies": [
        "SUNWcs",
        "library/security/openssl",
        "library/security/openssl-11",
        "shell/ksh93",
        "system/library"
    ],
    "fmris": [