Re: contrib/sslinfo cleanup and OpenSSL errorhandling - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: contrib/sslinfo cleanup and OpenSSL errorhandling
Date
Msg-id 20201030024714.GE1693@paquier.xyz
Whole thread Raw
In response to Re: contrib/sslinfo cleanup and OpenSSL errorhandling  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Thu, Oct 29, 2020 at 04:40:32PM -0700, Andres Freund wrote:
> There's quite a few copies of this code that look exactly the same,
> except for the be_tls_get_* call. Do you see a way to have fewer copies
> of the same code?

Each one of those code paths is working on a different sub-API aiming
at fetching a specific piece of TLS information, and the way each
sub-API does its lookup at MyProcPort is different.  One possible way
would be to move the checks on ssl_in_use into a macro for the
beginning part.  The end part could be improved by making
X509_NAME_field_to_text() and such return a text and not a Datum, and
move the null check + text-to-datum conversion into a separate macro.
I am not sure if this would be an improvement in terms of readability
though.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [patch] Fix checksum verification in base backups for zero page headers
Next
From: Fujii Masao
Date:
Subject: Re: Add statistics to pg_stat_wal view for wal related parameter tuning