postgresql/src
Michael Paquier 41a6de41ed Fix confusing error caused by connection parameter channel_binding
When using a client compiled without channel binding support (linking to
OpenSSL 1.0.1 or older) to connect to a server which supports channel
binding (linking to OpenSSL 1.0.2 or newer), libpq would generate a
confusing error message with channel_binding=require for an SSL
connection, where the server sends back SCRAM-SHA-256-PLUS:
"channel binding is required, but server did not offer an authentication
method that supports channel binding."

This is confusing because the server did send a SASL mechanism able to
support channel binding, but libpq was not able to detect that
properly.

The situation can be summarized as followed for the case described in
the previous paragraph for the SASL mechanisms used with the various
modes of channel_binding:
1) Client supports channel binding.
1-1) channel_binding = disable => OK, with SCRAM-SHA-256.
1-2) channel_binding = prefer => OK, with SCRAM-SHA-256-PLUS.
1-3) channel_binding = require => OK, with SCRAM-SHA-256-PLUS.
2) Client does not support channel binding.
2-1) channel_binding = disable => OK, with SCRAM-SHA-256.
2-2) channel_binding = prefer => OK, with SCRAM-SHA-256.
2-3) channel_binding = require => failure with new error message,
instead of the confusing one.
This commit updates case 2-3 to generate a better error message.  Note
that the SSL TAP tests are not impacted as it is not possible to test
with mixed versions of OpenSSL for the backend and libpq.

Reported-by: Tom Lane
Author: Michael Paquier
Reviewed-by: Jeff Davis, Tom Lane
Discussion: https://postgr.es/m/24857.1569775891@sss.pgh.pa.us
2019-10-01 10:56:27 +09:00
..
backend Add transparent block-level memory accounting 2019-10-01 03:13:39 +02:00
bin Fix pg_rewind link order issue introduced in 927474ce1a. 2019-09-30 12:43:09 -07:00
common Refactor logic to remove trailing CR/LF characters from strings 2019-08-09 11:05:14 +09:00
fe_utils Split out recovery confing-writing code from pg_basebackup 2019-09-25 14:35:24 -03:00
include Add transparent block-level memory accounting 2019-10-01 03:13:39 +02:00
interfaces Fix confusing error caused by connection parameter channel_binding 2019-10-01 10:56:27 +09:00
makefiles Remove support for non-ELF BSD systems 2019-07-01 23:56:20 +01:00
pl Split tuptoaster.c into three separate files. 2019-09-05 13:15:10 -04:00
port Use explicit_bzero 2019-09-05 08:30:42 +02:00
template Yet further rethinking of build changes for macOS Mojave. 2018-11-02 18:54:00 -04:00
test Rely on plan_cache_mode to force generic plans in partition_prune test. 2019-09-30 17:14:00 -04:00
timezone Update time zone data files to tzdata release 2019c. 2019-09-20 19:53:33 -04:00
tools Split out recovery confing-writing code from pg_basebackup 2019-09-25 14:35:24 -03:00
tutorial Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Don't disable ccache when building with coverage support 2019-09-24 10:00:56 +02:00
Makefile.shlib Remove support for non-ELF BSD systems 2019-07-01 23:56:20 +01:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00