Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9RYp-0005Jl-UL for pgsql-bugs@arkaria.postgresql.org; Sat, 01 Feb 2014 03:48:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W9RYp-0005HE-Er for pgsql-bugs@arkaria.postgresql.org; Sat, 01 Feb 2014 03:48:03 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9RYo-0005H7-Ef for pgsql-bugs@postgresql.org; Sat, 01 Feb 2014 03:48:02 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9RYl-00052K-L3 for pgsql-bugs@postgresql.org; Sat, 01 Feb 2014 03:48:01 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1W9RYk-0004OT-Mj; Fri, 31 Jan 2014 22:47:58 -0500 Date: Fri, 31 Jan 2014 22:47:58 -0500 From: Bruce Momjian To: raghavendra.rao@enterprisedb.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8438: Usage of Pipe operator in Windows(CMD.exe) shows the password typed with any PG utility. Message-ID: <20140201034758.GG31141@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Fri, Sep 6, 2013 at 05:35:57AM +0000, raghavendra.rao@enterprisedb.com wrote: > I have PostgreSQL 9.2 instance on Windows 7 running in MD5 authentication > mode. Anytime I connect I need to pass the password for connection. When I > try to connect from command prompt using PIPE ('|") operator; and the > password I type is visible(shown) instead of hiding it. For example in > linux, any password typed when prompted will not show it just hides it. > Which seems not the same in windows. Please look at the example below: > > > 1. Go to command prompt (runas /user:postgres "cmd.exe") > > > 2. Pass the some command using pipe operator to Psql (or any utility). > > > c:\Program Files\PostgreSQL\9.2\bin>echo select version(); | psql -p 5433 > Password: postgres > > > version > ------------------------------------------------------------- > PostgreSQL 9.2.2, compiled by Visual C++ build 1600, 32-bit > (1 row) > > > If you see above output, the password I typed as "postgres" is clearly > visible. I didn't tried to reproduce on any other version of PG or Windows. > Below are my version details: > > > Operating System: Windows 7 64 bit > PostgreSQL: PostgreSQL 9.2.2 > > > For any further information required, I would be glad to share if its sent > to my email id: raghavendra.rao@enterprisedb.com. I checked on our code and this is what we use in simple_prompt() on Windows to turn off echo: /* get a new handle to turn echo off */ t_orig = (LPDWORD) malloc(sizeof(DWORD)); t = GetStdHandle(STD_INPUT_HANDLE); /* save the old configuration first */ GetConsoleMode(t, t_orig); /* set to the new mode */ SetConsoleMode(t, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT); I think the last line is turning off ENABLE_ECHO_INPUT: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686033%28v=vs.85%29.aspx Obviously it isn't working for you. Does anyone else see the psql typed password echoed on Windows? -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs