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

From Tom Lane
Subject Re: [PATCH] (Windows) psql echoes password when reading from pipe
Date
Msg-id 14853.1527015354@sss.pgh.pa.us
Whole thread Raw
In response to [PATCH] (Windows) psql echoes password when reading from pipe  (Matthew Stickney <mtstickney@gmail.com>)
Responses Re: [PATCH] (Windows) psql echoes password when reading from pipe  (Matthew Stickney <mtstickney@gmail.com>)
List pgsql-hackers
Matthew Stickney <mtstickney@gmail.com> writes:
> 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.

Thanks for the report and patch!

I know zip about Windows coding, but I can't help comparing this:

-        t = GetStdHandle(STD_INPUT_HANDLE);
+        t = CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING,0, NULL); 

to the code a little bit above:

    termin = fopen("CONIN$", "r");

Is it possible to operate on "termin" instead of doing a second open
(which might fail, which we are failing to cope with :-()?

            regards, tom lane


pgsql-hackers by date:

Previous
From: Dmitry Dolgov
Date:
Subject: Re: Postgres, fsync, and OSs (specifically linux)
Next
From: Andres Freund
Date:
Subject: Re: Postgres, fsync, and OSs (specifically linux)