pgsql: Fix assorted issues in backend's GSSAPI encryption support.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix assorted issues in backend's GSSAPI encryption support.
Дата
Msg-id E1ku1Tt-0006OT-GL@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix assorted issues in backend's GSSAPI encryption support.

Unrecoverable errors detected by GSSAPI encryption can't just be
reported with elog(ERROR) or elog(FATAL), because attempting to
send the error report to the client is likely to lead to infinite
recursion or loss of protocol sync.  Instead make this code do what
the SSL encryption code has long done, which is to just report any
such failure to the server log (with elevel COMMERROR), then pretend
we've lost the connection by returning errno = ECONNRESET.

Along the way, fix confusion about whether message translation is done
by pg_GSS_error() or its callers (the latter should do it), and make
the backend version of that function work more like the frontend
version.

Avoid allocating the port->gss struct until it's needed; we surely
don't need to allocate it in the postmaster.

Improve logging of "connection authorized" messages with GSS enabled.
(As part of this, I back-patched the code changes from dc11f31a1.)

Make BackendStatusShmemSize() account for the GSS-related space that
will be allocated by CreateSharedBackendStatus().  This omission
could possibly cause out-of-shared-memory problems with very high
max_connections settings.

Remove arbitrary, pointless restriction that only GSS authentication
can be used on a GSS-encrypted connection.

Improve documentation; notably, document the fact that libpq now
prefers GSS encryption over SSL encryption if both are possible.

Per report from Mikael Gustavsson.  Back-patch to v12 where
this code was introduced.

Discussion: https://postgr.es/m/e5b0b6ed05764324a2f3fe7acfc766d5@smhi.se

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c1c88bf03e1eb85d5ca04bc7cfe2630154ec70d3

Modified Files
--------------
doc/src/sgml/client-auth.sgml        | 123 ++++++++++++++++++-----------------
doc/src/sgml/libpq.sgml              |  19 ++++++
doc/src/sgml/protocol.sgml           |  42 +++++++-----
doc/src/sgml/runtime.sgml            |  12 +++-
src/backend/libpq/auth.c             |  35 +++++-----
src/backend/libpq/be-gssapi-common.c |  51 ++++++++++-----
src/backend/libpq/be-secure-gssapi.c |  98 ++++++++++++++++++++--------
src/backend/libpq/be-secure.c        |   4 +-
src/backend/libpq/hba.c              |  19 ++----
src/backend/libpq/pqcomm.c           |  27 ++++----
src/backend/postmaster/pgstat.c      |  12 +++-
src/backend/postmaster/postmaster.c  |  37 ++---------
src/backend/utils/init/postinit.c    |  89 +++++++++++--------------
src/include/libpq/be-gssapi-common.h |   2 +-
src/include/libpq/libpq-be.h         |   5 +-
15 files changed, 322 insertions(+), 253 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix bugs in libpq's GSSAPI encryption support.
Следующее
От: Michael Paquier
Дата:
Сообщение: pgsql: doc: Improve description of min_dynamic_shared_memory