getdns: fix compilation with OPENSSL_NO_DEPRECATED
authorAndre Heider <redacted>
Tue, 21 Feb 2023 14:54:16 +0000 (15:54 +0100)
committerRosen Penev <redacted>
Mon, 1 May 2023 10:36:00 +0000 (13:36 +0300)
SSL_get_peer_certificate() is deprecated, OpenSSL v3.0 added
SSL_get0_peer_certificate() and SSL_get1_peer_certificate().

Use the latter since the return value is explicitely X509_free()ed
here, see [0].

[0] https://www.openssl.org/docs/manmaster/man3/SSL_get_peer_certificate.html

Signed-off-by: Andre Heider <redacted>
libs/getdns/Makefile
libs/getdns/patches/001-openssl-deprecated.patch [new file with mode: 0644]

index 9a4b838bdc26a6670da667305a1bba698fb93891..f9825493bf492210663d604c049e320044c6ee55 100644 (file)
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=getdns
 PKG_VERSION:=1.7.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=LICENSE
diff --git a/libs/getdns/patches/001-openssl-deprecated.patch b/libs/getdns/patches/001-openssl-deprecated.patch
new file mode 100644 (file)
index 0000000..ed695ac
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/openssl/tls.c
++++ b/src/openssl/tls.c
+@@ -872,7 +872,7 @@ _getdns_tls_x509* _getdns_tls_connection
+       if (!conn || !conn->ssl)
+               return NULL;
+-      return _getdns_tls_x509_new(mfs, SSL_get_peer_certificate(conn->ssl));
++      return _getdns_tls_x509_new(mfs, SSL_get1_peer_certificate(conn->ssl));
+ }
+ getdns_return_t _getdns_tls_connection_is_session_reused(_getdns_tls_connection* conn)
+@@ -990,7 +990,7 @@ getdns_return_t _getdns_tls_connection_c
+ #if defined(USE_DANESSL)
+       {
+               getdns_return_t res = GETDNS_RETURN_GOOD;
+-              X509* peer_cert = SSL_get_peer_certificate(conn->ssl);
++              X509* peer_cert = SSL_get1_peer_certificate(conn->ssl);
+               if (peer_cert) {
+                       if (conn->auth_name[0] &&
+                           X509_check_host(peer_cert,
git clone https://git.99rst.org/PROJECT