pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor SASL code with a generic interface for its mechanisms
Date: Wed, 07 Jul 2021 01:57:03 +0000
Message-ID: <E1m0woB-0001Y7-BR@gemulon.postgresql.org> (raw)

Refactor SASL code with a generic interface for its mechanisms

The code of SCRAM and SASL have been tightly linked together since SCRAM
exists in the core code, making hard to apprehend the addition of new
SASL mechanisms, but these are by design different facilities, with
SCRAM being an option for SASL.  This refactors the code related to both
so as the backend and the frontend use a set of callbacks for SASL
mechanisms, documenting while on it what is expected by anybody adding a
new SASL mechanism.

The separation between both layers is neat, using two sets of callbacks
for the frontend and the backend to mark the frontier between both
facilities.  The shape of the callbacks is now directly inspired from
the routines used by SCRAM, so the code change is straight-forward, and
the SASL code is moved into its own set of files.  These will likely
change depending on how and if new SASL mechanisms get added in the
future.

Author: Jacob Champion
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/3d2a6f5d50e741117d6baf83eb67ebf1a8a35a11.camel@vmware.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9fd85570d179f10f93344d722005f7086b3c31ca

Modified Files
--------------
src/backend/libpq/Makefile           |   1 +
src/backend/libpq/auth-sasl.c        | 195 +++++++++++++++++++++++++++++++++++
src/backend/libpq/auth-scram.c       |  51 +++++----
src/backend/libpq/auth.c             | 167 ++----------------------------
src/include/libpq/auth.h             |   2 +
src/include/libpq/sasl.h             | 136 ++++++++++++++++++++++++
src/include/libpq/scram.h            |  13 +--
src/interfaces/libpq/fe-auth-sasl.h  | 130 +++++++++++++++++++++++
src/interfaces/libpq/fe-auth-scram.c |  40 ++++---
src/interfaces/libpq/fe-auth.c       |  18 +++-
src/interfaces/libpq/fe-auth.h       |  11 +-
src/interfaces/libpq/fe-connect.c    |   6 +-
src/interfaces/libpq/libpq-int.h     |   2 +
src/tools/pgindent/typedefs.list     |   2 +
14 files changed, 552 insertions(+), 222 deletions(-)



Message-ID: <E1m0woB-0001Y7-BR@gemulon.postgresql.org>
Permalink:  ../E1m0woB-0001Y7-BR@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1m0woB-0001Y7-BR@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Refactor SASL code with a generic interface for its mechanisms
  In-Reply-To: <E1m0woB-0001Y7-BR@gemulon.postgresql.org>
  References: <E1m0woB-0001Y7-BR@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox