Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert
Date
Msg-id DB94E29B-DCEA-443B-A4F1-14C4E01F5066@yesql.se
Whole thread Raw
In response to Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> On 14 Apr 2023, at 00:52, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Daniel Gustafsson <daniel@yesql.se> writes:
>> The attached diff passes the tests on OpenSSL 1.0.1 through 3.1 as well as on
>> LibreSSL. Thoughts?
>
> 1. You can't assume that errno starts out zero, unless you zero it
> right before SSL_connect.

Maybe we should do that regardless of this?  We do for reading and writing but
not in open_client_SSL, and I can't off the top of my head think of a good
reason not to?

> 2. I wonder whether it's safe to assume that errno (a/k/a SOCK_ERRNO)
> can't be clobbered by SSL_get_verify_result.
>
> 3. It seems weird to refer to errno directly just a couple lines away
> from where we refer to it via SOCK_ERRNO.  Will this even compile
> on Windows?

Good points, it should of course be SOCK_ERRNO.  The attached saves off errno
and reinstates it to avoid clobbering.  Will test it on Windows in the morning
as well.

--
Daniel Gustafsson


Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Wrong results from Parallel Hash Full Join
Next
From: Michael Paquier
Date:
Subject: Re: User functions for building SCRAM secrets