From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix simple_prompt() to disable echo on Windows when stdin != ter |
Date: | 2018-05-23 23:04:51 |
Message-ID: | E1fLcoN-0004IV-Nz@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix simple_prompt() to disable echo on Windows when stdin != terminal.
If echo = false, simple_prompt() is supposed to prevent echoing the
input (for password input). However, the Windows implementation applied
the mode change to STD_INPUT_HANDLE. That would not have the desired
effect if stdin isn't actually the terminal, for instance if the user
is piping something into psql. Fix it to apply the mode change to
the correct input file, so that passwords do not echo in such cases.
In passing, shorten and de-uglify this code by using #elif rather than
an #if nest and removing some duplicated code.
Back-patch to all supported versions. To simplify that, also back-patch
the portions of commit 9daec77e1 that got rid of an unnecessary
malloc/free in the same area.
Matthew Stickney (cosmetic changes by me)
Discussion: https://postgr.es/m/502a1fff-862b-da52-1031-f68df6ed5a2d@gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/50485b3e201dda8498e799b769e624db20e86cff
Modified Files
--------------
src/port/sprompt.c | 40 ++++++++++++++++------------------------
1 file changed, 16 insertions(+), 24 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2018-05-24 02:06:41 | pgsql: doc: PG 11 rel notes: add PL/pgSQL composite DDL item |
Previous Message | Tom Lane | 2018-05-23 18:20:16 | pgsql: Remove configure's check for nonstandard "long long" printf modi |