mirror of
https://github.com/openwrt/packages.git
synced 2025-12-26 11:16:31 +04:00
libesmtp: Fix compile with OpenSSL 1.1.0
Also switched back to official tarball. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
92
libs/libesmtp/patches/100-openssl-1.1.patch
Normal file
92
libs/libesmtp/patches/100-openssl-1.1.patch
Normal file
@@ -0,0 +1,92 @@
|
||||
diff --git a/configure b/configure
|
||||
index d586ca2..ee39284 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -11896,9 +11896,9 @@ fi
|
||||
|
||||
fi
|
||||
if test x$with_openssl != xno ; then
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5
|
||||
-$as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
|
||||
-if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then :
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5
|
||||
+$as_echo_n "checking for SSL_new in -lssl... " >&6; }
|
||||
+if test "${ac_cv_lib_ssl_SSL_new+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
@@ -11913,27 +11913,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
-char SSL_library_init ();
|
||||
+char SSL_new ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
-return SSL_library_init ();
|
||||
+return SSL_new ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
- ac_cv_lib_ssl_SSL_library_init=yes
|
||||
+ ac_cv_lib_ssl_SSL_new=yes
|
||||
else
|
||||
- ac_cv_lib_ssl_SSL_library_init=no
|
||||
+ ac_cv_lib_ssl_SSL_new=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5
|
||||
-$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; }
|
||||
-if test "x$ac_cv_lib_ssl_SSL_library_init" = x""yes; then :
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_new" >&5
|
||||
+$as_echo "$ac_cv_lib_ssl_SSL_new" >&6; }
|
||||
+if test "x$ac_cv_lib_ssl_SSL_new" = x""yes; then :
|
||||
|
||||
with_openssl=yes
|
||||
LIBS="-lssl -lcrypto $LIBS"
|
||||
diff --git a/smtp-tls.c b/smtp-tls.c
|
||||
index 9a66806..5bdc191 100644
|
||||
--- a/smtp-tls.c
|
||||
+++ b/smtp-tls.c
|
||||
@@ -64,10 +64,12 @@ openssl_mutexcb (int mode, int n,
|
||||
const char *file __attribute__ ((unused)),
|
||||
int line __attribute__ ((unused)))
|
||||
{
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
if (mode & CRYPTO_LOCK)
|
||||
pthread_mutex_lock (&openssl_mutex[n]);
|
||||
else
|
||||
pthread_mutex_unlock (&openssl_mutex[n]);
|
||||
+#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -76,7 +78,7 @@ starttls_init (void)
|
||||
{
|
||||
if (tls_init)
|
||||
return 1;
|
||||
-
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#ifdef USE_PTHREADS
|
||||
/* Set up mutexes for the OpenSSL library */
|
||||
if (openssl_mutex == NULL)
|
||||
@@ -94,9 +96,12 @@ starttls_init (void)
|
||||
CRYPTO_set_locking_callback (openssl_mutexcb);
|
||||
}
|
||||
#endif
|
||||
- tls_init = 1;
|
||||
SSL_load_error_strings ();
|
||||
SSL_library_init ();
|
||||
+#else
|
||||
+ OPENSSL_init_ssl(0, NULL);
|
||||
+#endif
|
||||
+ tls_init = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user