]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pg_receivewal, pg_recvlogical: allow canceling initial password prompt.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 21 Nov 2021 19:13:35 +0000 (14:13 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 21 Nov 2021 19:13:35 +0000 (14:13 -0500)
commitc2242d3640eadbe42556aad2f37eae393e84a4df
treed8e4c029ec3e87725dc16fae99f89c94da213a96
parentdff01e40496122a9a4b3fb5a47ed5d124d32aff9
pg_receivewal, pg_recvlogical: allow canceling initial password prompt.

Previously it was impossible to terminate these programs via control-C
while they were prompting for a password.  We can fix that trivially
for their initial password prompts, by moving setup of the SIGINT
handler from just before to just after their initial GetConnection()
calls.

This fix doesn't permit escaping out of later re-prompts, but those
should be exceedingly rare, since the user's password or the server's
authentication setup would have to have changed meanwhile.  We
considered applying a fix similar to commit 46d665bc2, but that
seemed more complicated than it'd be worth.  Moreover, this way is
back-patchable, which that wasn't.

The misbehavior exists in all supported versions, so back-patch to all.

Tom Lane and Nathan Bossart

Discussion: https://postgr.es/m/747443.1635536754@sss.pgh.pa.us
src/bin/pg_basebackup/pg_receivewal.c
src/bin/pg_basebackup/pg_recvlogical.c