diff mbox series

[meta-networking,RFC,17/20] libesmtp: fix build with OpenSSL 4.0

Message ID 20260827185324.78997-18-jaipaul.cheernam@est.tech
State New
Headers show
Series Fix OpenSSL 4.0.1 build failures across meta-openembedded | expand

Commit Message

Jaipaul Cheernam Aug. 27, 2026, 6:53 p.m. UTC
OpenSSL 4.0 makes ASN1_STRING opaque. Use accessor functions.

Upstream-Status: Submitted [https://github.com/libesmtp/libESMTP/pull/34]
Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
---
 ...-with-OpenSSL-4.0-opaque-ASN1_STRING.patch | 31 +++++++++++++++++++
 .../libesmtp/libesmtp_1.1.0.bb                |  4 ++-
 2 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-support/libesmtp/libesmtp/0001-Fix-build-with-OpenSSL-4.0-opaque-ASN1_STRING.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-support/libesmtp/libesmtp/0001-Fix-build-with-OpenSSL-4.0-opaque-ASN1_STRING.patch b/meta-networking/recipes-support/libesmtp/libesmtp/0001-Fix-build-with-OpenSSL-4.0-opaque-ASN1_STRING.patch
new file mode 100644
index 0000000000..a949639502
--- /dev/null
+++ b/meta-networking/recipes-support/libesmtp/libesmtp/0001-Fix-build-with-OpenSSL-4.0-opaque-ASN1_STRING.patch
@@ -0,0 +1,31 @@ 
+From f74ac43fcd2af19dac28901bfb9dd1e62a8ec7b0 Mon Sep 17 00:00:00 2001
+From: Ravi Kant Sharma <ravi.kant.sharma@canonical.com>
+Date: Tue, 28 Jul 2026 20:35:48 +0200
+Subject: [PATCH] Fix build with OpenSSL 4.0 opaque ASN1_STRING
+
+OpenSSL 4.0 made ASN1_STRING opaque, so direct access to ->data and
+->length fields no longer compiles. Use ASN1_STRING_get0_data() and
+ASN1_STRING_length() accessors which are available since OpenSSL 1.1.0.
+
+Fixes #33
+Upstream-Status: Submitted [https://github.com/libesmtp/libESMTP/pull/34]
+Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
+---
+ smtp-tls.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/smtp-tls.c b/smtp-tls.c
+index 9f3e50e..981284e 100644
+--- a/smtp-tls.c
++++ b/smtp-tls.c
+@@ -599,8 +599,8 @@ check_acceptable_security (smtp_session_t session, SSL *ssl)
+ 
+ 	      if (name->type == GEN_DNS)
+ 		{
+-		  const char *ia5str = (const char *) name->d.ia5->data;
+-		  size_t ia5len = name->d.ia5->length;
++		  const char *ia5str = (const char *) ASN1_STRING_get0_data(name->d.ia5);
++		  size_t ia5len = ASN1_STRING_length(name->d.ia5);
+ 
+ 		  hasaltname = 1;
+ 		  if (strlen (ia5str) == ia5len && match_domain (host, ia5str))
diff --git a/meta-networking/recipes-support/libesmtp/libesmtp_1.1.0.bb b/meta-networking/recipes-support/libesmtp/libesmtp_1.1.0.bb
index 50f83221c0..d1364a8948 100644
--- a/meta-networking/recipes-support/libesmtp/libesmtp_1.1.0.bb
+++ b/meta-networking/recipes-support/libesmtp/libesmtp_1.1.0.bb
@@ -9,7 +9,9 @@  SECTION = "libs"
 DEPENDS = "openssl"
 
 SRC_URI = "git://github.com/libesmtp/libESMTP.git;branch=master;protocol=https \
-           file://0001-Add-build-option-for-NTLM-support.patch"
+           file://0001-Add-build-option-for-NTLM-support.patch \
+           file://0001-Fix-build-with-OpenSSL-4.0-opaque-ASN1_STRING.patch \
+           "
 SRCREV = "1d0af244310a66943ab400be56b15a9087f181eb"