From 8e3c7721da86a670b279bb24b0fe9ae82351628f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Tue, 2 Jul 2024 13:25:16 +0100
Subject: [PATCH 1/3] Remove unused variables in libq encryption negotiation
 test

The $node_conf parameter to test_matrix() was only ever used to set
the %params hash (removed in commit d39a49c1e4598048), but that hash
was itself never used for anything, so it (and the $server_config)
hash were always useless.
---
 .../libpq/t/005_negotiate_encryption.pl       | 24 +++++--------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/src/interfaces/libpq/t/005_negotiate_encryption.pl b/src/interfaces/libpq/t/005_negotiate_encryption.pl
index c3f70d31bc..251c405926 100644
--- a/src/interfaces/libpq/t/005_negotiate_encryption.pl
+++ b/src/interfaces/libpq/t/005_negotiate_encryption.pl
@@ -215,11 +215,6 @@ BEGIN
 my @all_sslmodes = ('disable', 'allow', 'prefer', 'require');
 my @all_sslnegotiations = ('postgres', 'direct');
 
-my $server_config = {
-	server_ssl => 0,
-	server_gss => 0,
-};
-
 ###
 ### Run tests with GSS and SSL disabled in the server
 ###
@@ -272,7 +267,7 @@ BEGIN
 };
 
 note("Running tests with SSL and GSS disabled in the server");
-test_matrix($node, $server_config,
+test_matrix($node,
 	['testuser'], \@all_gssencmodes, \@all_sslmodes, \@all_sslnegotiations,
 	parse_table($test_table));
 
@@ -311,19 +306,15 @@ BEGIN
 	# Enable SSL in the server
 	$node->adjust_conf('postgresql.conf', 'ssl', 'on');
 	$node->reload;
-	$server_config->{server_ssl} = 1;
 
 	note("Running tests with SSL enabled in server");
-	test_matrix(
-		$node, $server_config,
-		[ 'testuser', 'ssluser', 'nossluser' ], ['disable'],
-		\@all_sslmodes, \@all_sslnegotiations,
+	test_matrix($node, [ 'testuser', 'ssluser', 'nossluser' ],
+		['disable'], \@all_sslmodes, \@all_sslnegotiations,
 		parse_table($test_table));
 
 	# Disable SSL again
 	$node->adjust_conf('postgresql.conf', 'ssl', 'off');
 	$node->reload;
-	$server_config->{server_ssl} = 0;
 }
 
 ###
@@ -336,7 +327,6 @@ BEGIN
 
 	$krb->create_principal('gssuser', $gssuser_password);
 	$krb->create_ticket('gssuser', $gssuser_password);
-	$server_config->{server_gss} = 1;
 
 	$test_table = q{
 # USER      GSSENCMODE   SSLMODE      SSLNEGOTIATION EVENTS                       -> OUTCOME
@@ -400,7 +390,7 @@ BEGIN
 	}
 
 	note("Running tests with GSS enabled in server");
-	test_matrix($node, $server_config, [ 'testuser', 'gssuser', 'nogssuser' ],
+	test_matrix($node, [ 'testuser', 'gssuser', 'nogssuser' ],
 		\@all_gssencmodes, $sslmodes, $sslnegotiations,
 		parse_table($test_table));
 }
@@ -423,7 +413,6 @@ BEGIN
 	# Enable SSL
 	$node->adjust_conf('postgresql.conf', 'ssl', 'on');
 	$node->reload;
-	$server_config->{server_ssl} = 1;
 
 	$test_table = q{
 # USER      GSSENCMODE   SSLMODE      SSLNEGOTIATION EVENTS                       -> OUTCOME
@@ -510,7 +499,6 @@ BEGIN
 	note("Running tests with both GSS and SSL enabled in server");
 	test_matrix(
 		$node,
-		$server_config,
 		[ 'testuser', 'gssuser', 'ssluser', 'nogssuser', 'nossluser' ],
 		\@all_gssencmodes,
 		\@all_sslmodes,
@@ -546,8 +534,8 @@ sub test_matrix
 {
 	local $Test::Builder::Level = $Test::Builder::Level + 1;
 
-	my ($pg_node, $node_conf,
-		$test_users, $gssencmodes, $sslmodes, $sslnegotiations, %expected)
+	my ($pg_node, $test_users, $gssencmodes, $sslmodes, $sslnegotiations,
+		%expected)
 	  = @_;
 
 	foreach my $test_user (@{$test_users})
-- 
2.39.2

