Re: contrib/sslinfo cleanup and OpenSSL errorhandling

From: Andres Freund <andres(at)anarazel(dot)de>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: contrib/sslinfo cleanup and OpenSSL errorhandling
Date: 2020-10-29 23:40:32
Message-ID: 20201029234032.p3zdgvxwuc6svqxl@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for extracting these.

On 2020-10-29 23:48:57 +0100, Daniel Gustafsson wrote:>
> /*
> @@ -54,9 +53,16 @@ PG_FUNCTION_INFO_V1(ssl_version);
> Datum
> ssl_version(PG_FUNCTION_ARGS)
> {
> - if (MyProcPort->ssl == NULL)
> + const char *version;
> +
> + if (!MyProcPort->ssl_in_use)
> + PG_RETURN_NULL();
> +
> + version = be_tls_get_version(MyProcPort);
> + if (version == NULL)
> PG_RETURN_NULL();
> - PG_RETURN_TEXT_P(cstring_to_text(SSL_get_version(MyProcPort->ssl)));
> +
> + PG_RETURN_TEXT_P(cstring_to_text(version));
> }

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?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-10-29 23:48:37 Re: Deleting older versions in unique indexes to avoid page splits
Previous Message Peter Geoghegan 2020-10-29 23:30:11 Re: Deleting older versions in unique indexes to avoid page splits