[PATCH] (Windows) psql echoes password when reading from pipe - Mailing list pgsql-hackers

From Matthew Stickney
Subject [PATCH] (Windows) psql echoes password when reading from pipe
Date
Msg-id 502a1fff-862b-da52-1031-f68df6ed5a2d@gmail.com
Whole thread Raw
Responses Re: [PATCH] (Windows) psql echoes password when reading from pipe  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
This is my first time submitting a patch here; apologies in advance if I 
flub the process.

On windows, if you pipe data to psql, the password prompt correctly 
reads from and writes to the console, but the password text is echoed to 
the console. This is because echoing is disabled on the handle for 
stdin, but as part of a pipeline stdin doesn't refer to the console. 
I've attached a patch that gets a handle to the console's input buffer 
by opening CONIN$ instead, which corrects the problem.

I think the change is straightforward enough to apply directly, but 
there's another concern that might bear discussion: SetConsoleMode can 
fail, and when it does prompt input will be echoed (i.e. it's 
fail-open). Is it worth check for and reporting for an error there? 
Given that this is meant to be used interactively, I think the risk of 
someone not noticing the echo is low.

-Matt Stickney


Attachment

pgsql-hackers by date:

Previous
From: Charles Cui
Date:
Subject: [GSoC] github repo and initial work
Next
From: Tal Glozman
Date:
Subject: PostgreSQL and Homomorphic Encryption