pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Refactor client-side SSL certificate checking code
Date: Wed, 31 Jan 2018 03:57:01 +0000
Message-ID: <E1egjW9-0001Mq-OP@gemulon.postgresql.org> (raw)

Refactor client-side SSL certificate checking code

Separate the parts specific to the SSL library from the general logic.

The previous code structure was

open_client_SSL()
calls verify_peer_name_matches_certificate()
calls verify_peer_name_matches_certificate_name()
calls wildcard_certificate_match()

and was completely in fe-secure-openssl.c.  The new structure is

open_client_SSL() [openssl]
calls pq_verify_peer_name_matches_certificate() [generic]
calls pgtls_verify_peer_name_matches_certificate_guts() [openssl]
calls openssl_verify_peer_name_matches_certificate_name() [openssl]
calls pq_verify_peer_name_matches_certificate_name() [generic]
calls wildcard_certificate_match() [generic]

Move the generic functions into a new file fe-secure-common.c, so the
calls generally go fe-connect.c -> fe-secure.c -> fe-secure-${impl}.c ->
fe-secure-common.c, although there is a bit of back-and-forth between
the last two.

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>

Branch
------
master

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

Modified Files
--------------
src/interfaces/libpq/Makefile            |   2 +-
src/interfaces/libpq/fe-secure-common.c  | 204 ++++++++++++++++++++++++++++++
src/interfaces/libpq/fe-secure-common.h  |  26 ++++
src/interfaces/libpq/fe-secure-openssl.c | 210 ++++---------------------------
src/interfaces/libpq/libpq-int.h         |  13 ++
src/interfaces/libpq/nls.mk              |   2 +-
src/tools/msvc/Mkvcbuild.pm              |   1 +
7 files changed, 271 insertions(+), 187 deletions(-)



Message-ID: <E1egjW9-0001Mq-OP@gemulon.postgresql.org>
Permalink:  ../E1egjW9-0001Mq-OP@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1egjW9-0001Mq-OP@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: peter_e@gmx.net
  Subject: Re: pgsql: Refactor client-side SSL certificate checking code
  In-Reply-To: <E1egjW9-0001Mq-OP@gemulon.postgresql.org>
  References: <E1egjW9-0001Mq-OP@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