msmtp: Fix compilation without deprecated OpenSSL APIs 7562/head
authorRosen Penev <rosenp@gmail.com>
Mon, 3 Dec 2018 00:25:17 +0000 (16:25 -0800)
committerRosen Penev <rosenp@gmail.com>
Mon, 3 Dec 2018 00:25:17 +0000 (16:25 -0800)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
mail/msmtp/Makefile
mail/msmtp/patches/010-openssl-deprecated.patch [new file with mode: 0644]

index 6bc23912c18150bf35d79c60dd894f10acb252ce..2c9ec32490150a4534496579d9ee67e25f0220bd 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=msmtp
 PKG_VERSION:=1.6.8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://marlam.de/msmtp/releases
diff --git a/mail/msmtp/patches/010-openssl-deprecated.patch b/mail/msmtp/patches/010-openssl-deprecated.patch
new file mode 100644 (file)
index 0000000..2a229aa
--- /dev/null
@@ -0,0 +1,42 @@
+--- a/src/tls.c
++++ b/src/tls.c
+@@ -45,6 +45,10 @@
+ # include <openssl/err.h>
+ # include <openssl/rand.h>
+ # include <openssl/evp.h>
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#define X509_getm_notBefore X509_get_notBefore
++#define X509_getm_notAfter X509_get_notAfter
++#endif
+ #endif /* HAVE_LIBSSL */
+ #ifdef HAVE_LIBIDN
+@@ -167,8 +171,10 @@ int tls_lib_init(char **errstr)
+ #ifdef HAVE_LIBSSL
+     int e;
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+     SSL_load_error_strings();
+     SSL_library_init();
++#endif
+     if ((e = seed_prng(errstr)) != TLS_EOK)
+     {
+         return e;
+@@ -518,7 +524,7 @@ int tls_cert_info_get(tls_t *tls, tls_cert_info_t *tci, char **errstr)
+         *errstr = xasprintf(_("%s: error getting SHA1 fingerprint"), errmsg);
+         return TLS_ECERT;
+     }
+-    asn1time = X509_get_notBefore(x509cert);
++    asn1time = X509_getm_notBefore(x509cert);
+     if (asn1time_to_time_t((char *)asn1time->data,
+                 (asn1time->type != V_ASN1_GENERALIZEDTIME),
+                 &(tci->activation_time)) != 0)
+@@ -528,7 +534,7 @@ int tls_cert_info_get(tls_t *tls, tls_cert_info_t *tci, char **errstr)
+         tls_cert_info_free(tci);
+         return TLS_ECERT;
+     }
+-    asn1time = X509_get_notAfter(x509cert);
++    asn1time = X509_getm_notAfter(x509cert);
+     if (asn1time_to_time_t((char *)asn1time->data,
+                 (asn1time->type != V_ASN1_GENERALIZEDTIME),
+                 &(tci->expiration_time)) != 0)