forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit17a834a
committed
Reject SSL connection if ALPN is used but there's no common protocol
If the client supports ALPN but tries to use some other protocol, likeHTTPS, reject the connection in the server. That is surely a confusionof some sort. Furthermore, the ALPN RFC 7301 says:> In the event that the server supports no protocols that the client> advertises, then the server SHALL respond with a fatal> "no_application_protocol" alert.This commit makes the server follow that advice.In the client, specifically check for the OpenSSL error code for the"no_application_protocol" alert. Otherwise you got a cryptic "SSLerror: SSL error code 167773280" error if you tried to connect to anon-PostgreSQL server that rejects the connection with"no_application_protocol". ERR_reason_error_string() returns NULL forthat code, which frankly seems like an OpenSSL bug to me, but we caneasily print a better message ourselves.Reported-by: Jacob ChampionDiscussion:https://www.postgresql.org/message-id/6aedcaa5-60f3-49af-a857-2c76ba55a1f3@iki.fi1 parent03a0e0d commit17a834a
File tree
2 files changed
+19
-3
lines changed- src
- backend/libpq
- interfaces/libpq
2 files changed
+19
-3
lines changedLines changed: 7 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1336 | 1336 |
| |
1337 | 1337 |
| |
1338 | 1338 |
| |
1339 |
| - | |
1340 |
| - | |
1341 | 1339 |
| |
1342 |
| - | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
1343 | 1347 |
| |
1344 | 1348 |
| |
1345 | 1349 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1741 | 1741 |
| |
1742 | 1742 |
| |
1743 | 1743 |
| |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
1744 | 1756 |
| |
1745 | 1757 |
| |
1746 | 1758 |
| |
|
0 commit comments
Comments
(0)