Re: contrib/sslinfo cleanup and OpenSSL errorhandling

Поиск
Список
Период
Сортировка
Искать
От
Andres Freund
Тема
Re: contrib/sslinfo cleanup and OpenSSL errorhandling
Дата
Msg-id
20201029234032.p3zdgvxwuc6svqxl@alap3.anarazel.de
Ответ на
Список
Дерево обсуждения
contrib/sslinfo cleanup and OpenSSL errorhandling Daniel Gustafsson <daniel@yesql.se>
Re: contrib/sslinfo cleanup and OpenSSL errorhandling Andres Freund <andres@anarazel.de>
Re: contrib/sslinfo cleanup and OpenSSL errorhandling Daniel Gustafsson <daniel@yesql.se>
Re: contrib/sslinfo cleanup and OpenSSL errorhandling Magnus Hagander <magnus@hagander.net>
Re: contrib/sslinfo cleanup and OpenSSL errorhandling Magnus Hagander <magnus@hagander.net>
Re: contrib/sslinfo cleanup and OpenSSL errorhandling Daniel Gustafsson <daniel@yesql.se>
Re: contrib/sslinfo cleanup and OpenSSL errorhandling Magnus Hagander <magnus@hagander.net>
Re: contrib/sslinfo cleanup and OpenSSL errorhandling Michael Paquier <michael@paquier.xyz>
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


В списке pgsql-hackers по дате отправления
От: Peter Geoghegan
Дата:
От: Peter Geoghegan
Дата:
FAQ