diff options
| author | Tom Lane | 2023-05-19 21:24:48 +0000 |
|---|---|---|
| committer | Tom Lane | 2023-05-19 21:24:48 +0000 |
| commit | 0245f8db36f375326c2bae0c3420d3c77714e72d (patch) | |
| tree | 7ce91f23658a05ea24be4703fb06cdc6b56248f7 /src/test/authentication | |
| parent | df6b19fbbc20d830de91d9bea68715a39635b568 (diff) | |
Pre-beta mechanical code beautification.
Run pgindent, pgperltidy, and reformat-dat-files.
This set of diffs is a bit larger than typical. We've updated to
pg_bsd_indent 2.1.2, which properly indents variable declarations that
have multi-line initialization expressions (the continuation lines are
now indented one tab stop). We've also updated to perltidy version
20230309 and changed some of its settings, which reduces its desire to
add whitespace to lines to make assignments etc. line up. Going
forward, that should make for fewer random-seeming changes to existing
code.
Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql
Diffstat (limited to 'src/test/authentication')
| -rw-r--r-- | src/test/authentication/t/001_password.pl | 24 | ||||
| -rw-r--r-- | src/test/authentication/t/002_saslprep.pl | 20 | ||||
| -rw-r--r-- | src/test/authentication/t/003_peer.pl | 8 | ||||
| -rw-r--r-- | src/test/authentication/t/004_file_inclusion.pl | 16 |
4 files changed, 36 insertions, 32 deletions
diff --git a/src/test/authentication/t/001_password.pl b/src/test/authentication/t/001_password.pl index 0680f8b07c5..12552837a8e 100644 --- a/src/test/authentication/t/001_password.pl +++ b/src/test/authentication/t/001_password.pl @@ -23,9 +23,9 @@ if (!$use_unix_sockets) # and then execute a reload to refresh it. sub reset_pg_hba { - my $node = shift; - my $database = shift; - my $role = shift; + my $node = shift; + my $database = shift; + my $role = shift; my $hba_method = shift; unlink($node->data_dir . '/pg_hba.conf'); @@ -95,7 +95,8 @@ $node->safe_psql( RESET scram_iterations;" ); -my $res = $node->safe_psql('postgres', +my $res = $node->safe_psql( + 'postgres', "SELECT substr(rolpassword,1,19) FROM pg_authid WHERE rolname = 'scram_role_iter'"); @@ -106,8 +107,8 @@ is($res, 'SCRAM-SHA-256$1024:', 'scram_iterations in server side ROLE'); # as earlier version cause the session to time out. SKIP: { - skip "IO::Pty and IPC::Run >= 0.98 required", 1 unless - eval { require IO::Pty; IPC::Run->VERSION('0.98'); }; + skip "IO::Pty and IPC::Run >= 0.98 required", 1 + unless eval { require IO::Pty; IPC::Run->VERSION('0.98'); }; # Alter the password on the created role using \password in psql to ensure # that clientside password changes use the scram_iterations value when @@ -117,16 +118,19 @@ SKIP: $session->set_query_timer_restart(); $session->query("SET password_encryption='scram-sha-256';"); $session->query("SET scram_iterations=42;"); - $session->query_until(qr/Enter new password/, "\\password scram_role_iter\n"); + $session->query_until(qr/Enter new password/, + "\\password scram_role_iter\n"); $session->query_until(qr/Enter it again/, "pass\n"); $session->query_until(qr/postgres=# /, "pass\n"); $session->quit; - $res = $node->safe_psql('postgres', + $res = $node->safe_psql( + 'postgres', "SELECT substr(rolpassword,1,17) FROM pg_authid WHERE rolname = 'scram_role_iter'"); - is($res, 'SCRAM-SHA-256$42:', 'scram_iterations in psql \password command'); + is($res, 'SCRAM-SHA-256$42:', + 'scram_iterations in psql \password command'); } # Create a database to test regular expression. @@ -482,7 +486,7 @@ chmod 0600, $pgpassfile or die; reset_pg_hba($node, 'all', 'all', 'password'); test_conn($node, 'user=scram_role', 'password from pgpass', 0); -test_conn($node, 'user=md5_role', 'password from pgpass', 2); +test_conn($node, 'user=md5_role', 'password from pgpass', 2); append_to_file( $pgpassfile, qq! diff --git a/src/test/authentication/t/002_saslprep.pl b/src/test/authentication/t/002_saslprep.pl index c00f4e1b322..ef158311668 100644 --- a/src/test/authentication/t/002_saslprep.pl +++ b/src/test/authentication/t/002_saslprep.pl @@ -20,7 +20,7 @@ if (!$use_unix_sockets) # and then execute a reload to refresh it. sub reset_pg_hba { - my $node = shift; + my $node = shift; my $hba_method = shift; unlink($node->data_dir . '/pg_hba.conf'); @@ -34,10 +34,10 @@ sub test_login { local $Test::Builder::Level = $Test::Builder::Level + 1; - my $node = shift; - my $role = shift; - my $password = shift; - my $expected_res = shift; + my $node = shift; + my $role = shift; + my $password = shift; + my $expected_res = shift; my $status_string = 'failed'; $status_string = 'success' if ($expected_res eq 0); @@ -93,25 +93,25 @@ CREATE ROLE saslpreptest7_role LOGIN PASSWORD E'foo\\u0627\\u0031bar'; reset_pg_hba($node, 'scram-sha-256'); # Check that #1 and #5 are treated the same as just 'IX' -test_login($node, 'saslpreptest1_role', "I\xc2\xadX", 0); +test_login($node, 'saslpreptest1_role', "I\xc2\xadX", 0); test_login($node, 'saslpreptest1_role', "\xe2\x85\xa8", 0); # but different from lower case 'ix' test_login($node, 'saslpreptest1_role', "ix", 2); # Check #4 -test_login($node, 'saslpreptest4a_role', "a", 0); +test_login($node, 'saslpreptest4a_role', "a", 0); test_login($node, 'saslpreptest4a_role', "\xc2\xaa", 0); -test_login($node, 'saslpreptest4b_role', "a", 0); +test_login($node, 'saslpreptest4b_role', "a", 0); test_login($node, 'saslpreptest4b_role', "\xc2\xaa", 0); # Check #6 and #7 - In PostgreSQL, contrary to the spec, if the password # contains prohibited characters, we use it as is, without normalization. test_login($node, 'saslpreptest6_role', "foo\x07bar", 0); -test_login($node, 'saslpreptest6_role', "foobar", 2); +test_login($node, 'saslpreptest6_role', "foobar", 2); test_login($node, 'saslpreptest7_role', "foo\xd8\xa71bar", 0); test_login($node, 'saslpreptest7_role', "foo1\xd8\xa7bar", 2); -test_login($node, 'saslpreptest7_role', "foobar", 2); +test_login($node, 'saslpreptest7_role', "foobar", 2); done_testing(); diff --git a/src/test/authentication/t/003_peer.pl b/src/test/authentication/t/003_peer.pl index a6be651ea7f..3272e52cae8 100644 --- a/src/test/authentication/t/003_peer.pl +++ b/src/test/authentication/t/003_peer.pl @@ -20,7 +20,7 @@ if (!$use_unix_sockets) # and then execute a reload to refresh it. sub reset_pg_hba { - my $node = shift; + my $node = shift; my $hba_method = shift; unlink($node->data_dir . '/pg_hba.conf'); @@ -33,10 +33,10 @@ sub reset_pg_hba # and then execute a reload to refresh it. sub reset_pg_ident { - my $node = shift; - my $map_name = shift; + my $node = shift; + my $map_name = shift; my $system_user = shift; - my $pg_user = shift; + my $pg_user = shift; unlink($node->data_dir . '/pg_ident.conf'); $node->append_conf('pg_ident.conf', "$map_name $system_user $pg_user"); diff --git a/src/test/authentication/t/004_file_inclusion.pl b/src/test/authentication/t/004_file_inclusion.pl index 8cd2a8dae4a..55d28ad5864 100644 --- a/src/test/authentication/t/004_file_inclusion.pl +++ b/src/test/authentication/t/004_file_inclusion.pl @@ -37,9 +37,9 @@ my %line_counters = ('hba_rule' => 0, 'ident_rule' => 0); # is loaded by the backend. sub add_hba_line { - my $node = shift; + my $node = shift; my $filename = shift; - my $entry = shift; + my $entry = shift; my $globline; my $fileline; my @tokens; @@ -64,7 +64,7 @@ sub add_hba_line $globline = ++$line_counters{'hba_rule'}; # Generate the expected pg_hba_file_rules line - @tokens = split(/ /, $entry); + @tokens = split(/ /, $entry); $tokens[1] = '{' . $tokens[1] . '}'; # database $tokens[2] = '{' . $tokens[2] . '}'; # user_name @@ -95,9 +95,9 @@ sub add_hba_line # returns an entry to match with pg_ident_file_mappings. sub add_ident_line { - my $node = shift; + my $node = shift; my $filename = shift; - my $entry = shift; + my $entry = shift; my $globline; my $fileline; my @tokens; @@ -136,7 +136,7 @@ sub add_ident_line } # Locations for the entry points of the HBA and ident files. -my $hba_file = 'subdir1/pg_hba_custom.conf'; +my $hba_file = 'subdir1/pg_hba_custom.conf'; my $ident_file = 'subdir2/pg_ident_custom.conf'; my $node = PostgreSQL::Test::Cluster->new('primary'); @@ -147,7 +147,7 @@ my $data_dir = $node->data_dir; note "Generating HBA structure with include directives"; -my $hba_expected = ''; +my $hba_expected = ''; my $ident_expected = ''; # customise main auth file names @@ -230,7 +230,7 @@ mkdir("$data_dir/ident_pos"); $ident_expected .= add_ident_line($node, "$ident_file", "include ../pg_ident_pre.conf"); $ident_expected .= add_ident_line($node, 'pg_ident_pre.conf', "pre foo bar"); -$ident_expected .= add_ident_line($node, "$ident_file", "test a b"); +$ident_expected .= add_ident_line($node, "$ident_file", "test a b"); $ident_expected .= add_ident_line($node, "$ident_file", "include ../ident_pos/pg_ident_pos.conf"); $ident_expected .= |
