postgresql/src
Tom Lane bbaf75ee0c 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
2018-05-23 19:04:34 -04:00
..
backend Widen COPY FROM's current-line-number counter from 32 to 64 bits. 2018-05-22 13:32:52 -04:00
bin Improve inefficient regexes in vacuumdb TAP test. 2018-05-08 20:17:43 -04:00
common Fix error message on short read of pg_control 2018-05-18 17:53:15 +02:00
fe_utils Empty search_path in Autovacuum and non-psql/pgbench clients. 2018-02-26 07:39:48 -08:00
include Support platforms where strtoll/strtoull are spelled __strtoll/__strtoull. 2018-05-19 14:22:18 -04:00
interfaces printf("%lf") is not portable, so omit the "l". 2018-05-20 11:40:54 -04:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:56 -04:00
pl Translation updates 2018-05-07 11:59:47 -04:00
port Fix simple_prompt() to disable echo on Windows when stdin != terminal. 2018-05-23 19:04:34 -04:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test Fix misprocessing of equivalence classes involving record_eq(). 2018-05-16 13:46:09 -04:00
timezone Update time zone data files to tzdata release 2018e. 2018-05-09 13:55:48 -04:00
tools Clear severity 5 perlcritic warnings from vcregress.pl 2018-05-06 07:39:37 -04:00
tutorial Update copyright for 2016 2016-01-02 13:33:40 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Install TAP test infrastructure so it's available for extension testing. 2016-09-23 15:50:00 -04:00
Makefile.global.in PL/Perl portability fix: absorb relevant -D switches from Perl. 2017-07-31 12:38:35 -04:00
Makefile.shlib Fix make rules that generate multiple output files. 2018-03-23 13:45:38 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00