Re: [PATCH] Log details for client certificate failures

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Jacob Champion <jchampion(at)timescale(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Log details for client certificate failures
Date: 2022-07-14 20:12:33
Message-ID: 49b48719-d6cf-9e03-fab3-e4505cf9d585@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13.07.22 01:06, Jacob Champion wrote:
>> I had to read up on this "ex_data" API. Interesting. But I'm wondering
>> a bit about how the life cycle of these objects is managed. What
>> happens if the allocated error string is deallocated before its
>> containing object? Or vice versa?
>
> Yeah, I'm currently leaning heavily on the lack of any memory context
> switches here. And I end up leaking out a pointer to the stale stack
> of be_tls_open_server(), which is gross -- it works since there are no
> other clients, but that could probably come back to bite us.
>
> The ex_data API exposes optional callbacks for new/dup/free (I'm
> currently setting those to NULL), so we can run custom code whenever
> the SSL* is destroyed. If you'd rather the data have the same lifetime
> of the SSL* object, we can switch to malloc/strdup/free (or even
> OPENSSL_strdup() in later versions). But since we don't have any use
> for the ex_data outside of this function, maybe we should just clear
> it before we return, rather than carrying it around.

Concretely, I was thinking like the attached top-up patch.

The other way can surely be made to work somehow, but this seems much
simpler and with fewer questions about the details.

Attachment Content-Type Size
v5-0002-squash-Log-details-for-client-certificate-failure.patch text/plain 3.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2022-07-14 21:09:02 Re: [PATCH] Log details for client certificate failures
Previous Message Bruce Momjian 2022-07-14 20:07:30 Re: System catalog documentation chapter