Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5bcbe98

Browse filesBrowse 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
Copy full SHA for 5bcbe98

File tree

1 file changed

+9
-5
lines changed
Filter options

1 file changed

+9
-5
lines changed

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

Copy file name to clipboardExpand all lines: src/interfaces/libpq/fe-secure-openssl.c
+9-5Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.