Re: contrib/sslinfo cleanup and OpenSSL errorhandling

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: contrib/sslinfo cleanup and OpenSSL errorhandling
Date: 2020-10-30 02:47:14
Message-ID: 20201030024714.GE1693@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-10-30 02:50:59 Re: Add statistics to pg_stat_wal view for wal related parameter tuning
Previous Message Michael Paquier 2020-10-30 02:33:42 Re: [patch] Fix checksum verification in base backups for zero page headers