Re: [PATCH] Prompt for password on Windows platforms - Mailing list pgsql-patches

From Magnus Hagander
Subject Re: [PATCH] Prompt for password on Windows platforms
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCEA0F80B@algol.sollentuna.se
Whole thread Raw
In response to [PATCH] Prompt for password on Windows platforms  ("Robert Kinberg" <kinberg@tecore.com>)
List pgsql-patches
> >>So yes, it looks like this patch will be needed. A very good catch,
> >>Robert! This one has been annoying me for a long time!
> >>
> >>Tom - if you're unsure the patch fixes the problem, I'll
> try to test
> >>it soonest. But the problem definitly exists!
> >>
> >>
> >
> >I have now tested the patch, and it does work. Didn't apply cleanly,
> >most likely because the mailer (either yours or mine) messed up -
> >probably with the tabs. Attached is a version as an attachment which
> >should survive this (win32_tty.patch).
> >
> >This patch fixes a longstanding issue. Anybody who has a
> \dev directory
> >on the drive that happens to be current when executing psql will get
> >broken password authentication without any error msg. I beleive this
> >bug is responsible for most, if not all, the reports of this kind of
> >issue we've seen on win32.
> >
> >The only reason we don't se eit all the time is that c:\dev isn't a
> >very common directory on win32. But I'm sure several
> packages doing "I
> >wanna look like unix" stuff creates one (cygwin, which
> breaks a lot of
> >other things, doesn't though - they stick thereis in the cygwin
> >directory. but there are others)
> >
> >
> >Now, this bug can in theory affect all platforms not just
> win32 - any
> >platform where /dev/tty is not a file, or when it doesn't
> exist but can
> >be created (in which case it will be created the first time you run
> >psql, and then it'll be used later). I've attached a second
> version of
> >the patch (alternate_tty.patch) which I think could help in
> this case.
> >But I haven't tested it on != win32.
> >(Specifically, it's bad that we open /dev/tty for writing even if we
> >failed it for reading (that will create a new file), and
> that we don't
> >check if it's a tty at all).
> >
> >
> >Since this bug is fairly bad for win32, please apply
> whichever version
> >of this patch you prefer to HEAD and also to both 8.0 and
> 8.1 branches.
> >
> >
> >
> >
>
> Maybe we should stat the file and check that it's actually a
> character special device.

Wouldn't isatty() perform that kind of check already?

//Magnus

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [PATCH] Prompt for password on Windows platforms
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Prompt for password on Windows platforms