Skip to content

Commit 5bcbe98

Browse files
committed
Fix compilation on OpenSSL 1.0.2 and LibreSSL
SSL_AD_NO_APPLICATION_PROTOCOL was introduced in OpenSSL 1.1.0. While we're at it, add a link to the related OpenSSL github issue to the comment. Per buildfarm and Tom Lane. Discussion: https://www.postgresql.org/message-id/1452995.1714433552@sss.pgh.pa.us
1 parent b7dc5da commit 5bcbe98

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/interfaces/libpq/fe-secure-openssl.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,17 +1741,21 @@ SSLerrmessage(unsigned long ecode)
17411741
return errbuf;
17421742
}
17431743

1744+
/*
1745+
* Server aborted the connection with TLS "no_application_protocol" alert.
1746+
* The ERR_reason_error_string() function doesn't give any error string
1747+
* for that for some reason, so do it ourselves. See
1748+
* https://github.com/openssl/openssl/issues/24300. This is available in
1749+
* OpenSSL 1.1.0 and later, but as of this writing not in LibreSSL.
1750+
*/
1751+
#ifdef SSL_AD_NO_APPLICATION_PROTOCOL
17441752
if (ERR_GET_LIB(ecode) == ERR_LIB_SSL &&
17451753
ERR_GET_REASON(ecode) == SSL_AD_REASON_OFFSET + SSL_AD_NO_APPLICATION_PROTOCOL)
17461754
{
1747-
/*
1748-
* Server aborted the connection with TLS "no_application_protocol"
1749-
* alert. The ERR_reason_error_string() function doesn't give any
1750-
* error string for that for some reason, so do it ourselves.
1751-
*/
17521755
snprintf(errbuf, SSL_ERR_LEN, libpq_gettext("no application protocol"));
17531756
return errbuf;
17541757
}
1758+
#endif
17551759

17561760
/*
17571761
* In OpenSSL 3.0.0 and later, ERR_reason_error_string randomly refuses to

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy