postgresql/src
Tom Lane 50485b3e20 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 Fix incorrect ordering of operations in pg_resetwal and pg_rewind. 2018-05-23 10:59:55 -04:00
bin Fix incorrect ordering of operations in pg_resetwal and pg_rewind. 2018-05-23 10:59:55 -04:00
common Fix incorrect ordering of operations in pg_resetwal and pg_rewind. 2018-05-23 10:59:55 -04:00
fe_utils Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
include Remove configure's check for nonstandard "long long" printf modifiers. 2018-05-23 14:19:04 -04:00
interfaces Translation updates 2018-05-21 12:29:52 -04:00
makefiles Remove Windows module-list-dumping code. 2018-04-30 13:20:13 -04:00
pl Translation updates 2018-05-21 12:29:52 -04:00
port Fix simple_prompt() to disable echo on Windows when stdin != terminal. 2018-05-23 19:04:34 -04:00
template Force "restrict" not to be used when compiling with xlc. 2017-10-13 12:15:06 -07:00
test Improve spelling of new FINALFUNC_MODIFY aggregate attribute. 2018-05-21 11:41:42 -04:00
timezone Update time zone data files to tzdata release 2018e. 2018-05-09 13:56:22 -04:00
tools MSVC builds must use a separate stamp file for copying generated headers. 2018-05-18 11:53:18 -04:00
tutorial Update copyright for 2018 2018-01-02 23:30:12 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02: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 Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Un-break contrib install with llvm. 2018-04-28 14:45:39 -04:00
Makefile.shlib Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00