@@ -101,6 +101,32 @@ sub test_conn
101
101
WHERE rolname = 'scram_role_iter'" );
102
102
is($res , ' SCRAM-SHA-256$1024:' , ' scram_iterations in server side ROLE' );
103
103
104
+ # If we don't have IO::Pty, forget it, because IPC::Run depends on that
105
+ # to support pty connections
106
+ SKIP:
107
+ {
108
+ skip " IO::Pty required" , 1 unless eval { require IO::Pty; };
109
+
110
+ # Alter the password on the created role using \password in psql to ensure
111
+ # that clientside password changes use the scram_iterations value when
112
+ # calculating SCRAM secrets.
113
+ my $session = $node -> interactive_psql(' postgres' );
114
+
115
+ $session -> set_query_timer_restart();
116
+ $session -> query(" SET password_encryption='scram-sha-256';" );
117
+ $session -> query(" SET scram_iterations=42;" );
118
+ $session -> query_until(qr / Enter new password/ , " \\ password scram_role_iter\n " );
119
+ $session -> query_until(qr / Enter it again/ , " pass\n " );
120
+ $session -> query_until(qr / postgres=# / , " pass\n " );
121
+ $session -> quit;
122
+
123
+ $res = $node -> safe_psql(' postgres' ,
124
+ " SELECT substr(rolpassword,1,17)
125
+ FROM pg_authid
126
+ WHERE rolname = 'scram_role_iter'" );
127
+ is($res , ' SCRAM-SHA-256$42:' , ' scram_iterations in psql \password command' );
128
+ }
129
+
104
130
# Create a database to test regular expression.
105
131
$node -> safe_psql(' postgres' , " CREATE database regex_testdb;" );
106
132
0 commit comments