From: Junio C Hamano Date: Tue, 08 Sep 2026 04:17:01 GMT Subject: Re: [PATCH 1/3] imap-send: prepare for OpenSSL 4.1 Message-ID: In-Reply-To: <20260907211210.2621693-2-dev+git@drbeat.li> Beat Bolli writes: > 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 > --- > 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 Style? > +#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] == '.') {