0002-Make-pg_stat_ssl-reporting-backend-agnostic-v2.patch

application/octet-stream

Filename: 0002-Make-pg_stat_ssl-reporting-backend-agnostic-v2.patch
Type: application/octet-stream
Part: 0
Message: Re: Support for NSS as a libpq TLS backend

Patch

Format: format-patch
Series: patch v2-0002
Subject: Make pg_stat_ssl reporting backend agnostic v2
File+
src/backend/postmaster/pgstat.c 1 1
From 3642ad3ebcd959f6a1560516369b5a87ebcd214f Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <daniel@yesql.se>
Date: Thu, 25 Jun 2020 17:31:35 +0200
Subject: [PATCH 2/2] Make pg_stat_ssl reporting backend agnostic v2

Inspecting Port->ssl for an indication on whether the connection is
using TLS or not is tied to the fact that the current implementation
is using a variable named ssl. Making this a requirement for all TLS
backend implementations seems restricting since there in actual var
tracking the status, ssl_in_use. Switch to inspecting this variable
instead.
---
 src/backend/postmaster/pgstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index c022597bc0..edfa774ee4 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -2989,7 +2989,7 @@ pgstat_bestart(void)
 		MemSet(&lbeentry.st_clientaddr, 0, sizeof(lbeentry.st_clientaddr));
 
 #ifdef USE_SSL
-	if (MyProcPort && MyProcPort->ssl != NULL)
+	if (MyProcPort && MyProcPort->ssl_in_use)
 	{
 		lbeentry.st_ssl = true;
 		lsslstatus.ssl_bits = be_tls_get_cipher_bits(MyProcPort);
-- 
2.21.1 (Apple Git-122.3)