Git development
 help / color / mirror / Atom feed
From: Beat Bolli <dev+git@drbeat.li>
To: git@vger.kernel.org
Cc: Oswald Buddenhagen <ossi@kde.org>, Beat Bolli <dev+git@drbeat.li>
Subject: [PATCH 1/3] imap-send: prepare for OpenSSL 4.1
Date: Mon,  7 Sep 2026 23:12:08 +0200	[thread overview]
Message-ID: <20260907211210.2621693-2-dev+git@drbeat.li> (raw)
In-Reply-To: <20260907211210.2621693-1-dev+git@drbeat.li>

OpenSSL master (to be v4.1 after the release) renamed the function
ASN1_STRING_length() to ASN1_STRING_get_length(). Map the new name to
the old one if we're compiling with a pre-4.1 version.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
---
 imap-send.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/imap-send.c b/imap-send.c
index 0d16d02029..977d78005c 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -219,12 +219,17 @@ static int ssl_socket_connect(struct imap_socket *sock UNUSED,
 
 #else
 
+#if (OPENSSL_VERSION_NUMBER < 0x40100000L)
+// map to the pre-4.1 name
+#define ASN1_STRING_get_length(s) ASN1_STRING_length(s)
+#endif
+
 static int host_matches(const char *host, const ASN1_STRING *asn1_str)
 {
 	const char *pattern = (const char *)ASN1_STRING_get0_data(asn1_str);
 
 	/* embedded NUL characters may open a security hole */
-	if (memchr(pattern, '\0', ASN1_STRING_length(asn1_str)))
+	if (memchr(pattern, '\0', ASN1_STRING_get_length(asn1_str)))
 	    return 0;
 
 	if (pattern[0] == '*' && pattern[1] == '.') {
-- 
2.53.0


  reply	other threads:[~2026-09-07 21:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 21:12 [PATCH 0/3] imap-send: future proofing and two correctness fixes Beat Bolli
2026-09-07 21:12 ` Beat Bolli [this message]
2026-09-08  4:17   ` [PATCH 1/3] imap-send: prepare for OpenSSL 4.1 Junio C Hamano
2026-09-08  8:26   ` Patrick Steinhardt
2026-09-07 21:12 ` [PATCH 2/3] imap-send: don't expect an ASN1_STRING to be NUL-terminated Beat Bolli
2026-09-08  1:17   ` Junio C Hamano
2026-09-08  8:26   ` Patrick Steinhardt
2026-09-07 21:12 ` [PATCH 3/3] imap-send: only check the CN if no SAN DNS names are present Beat Bolli
2026-09-08  1:28   ` brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260907211210.2621693-2-dev+git@drbeat.li \
    --to=dev+git@drbeat.li \
    --cc=git@vger.kernel.org \
    --cc=ossi@kde.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox