Re: [PATCH] Prompt for password on Windows platforms

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Robert Kinberg <kinberg(at)tecore(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] Prompt for password on Windows platforms
Date: 2006-03-03 23:54:24
Message-ID: 200603032354.k23NsOv08190@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Updated patch applied. I found a use of /dev/tty in psql for command
history that I changed to stderr for Win32.

Thanks for the legwork in finding the cause of this bug. Backpatched to
8.1.X and 8.0.X.

---------------------------------------------------------------------------

Robert Kinberg wrote:
> The current version of psql, pg_dump, ... do not properly prompt the
> user for a password, when the backend database is setup for password
> authentication on a Windows platform. In investigating the code, I
> noticed that the file '/dev/tty' is opened to interact with the console.
> It appears as if on a Windows platform, the actual file /dev/tty is
> opened, instead of the console. I am supplying a patch to address this
> issue on the Windows platform.
>
> *** ./src/port/sprompt.c.orig Wed Feb 22 13:07:43 2006
> --- ./src/port/sprompt.c Wed Feb 22 13:08:14 2006
> ***************
> *** 40,47 ****
> {
> int length;
> char *destination;
> ! FILE *termin,
> ! *termout;
>
> #ifdef HAVE_TERMIOS_H
> struct termios t_orig,
> --- 40,47 ----
> {
> int length;
> char *destination;
> ! FILE *termin = NULL,
> ! *termout = NULL;
>
> #ifdef HAVE_TERMIOS_H
> struct termios t_orig,
> ***************
> *** 63,70 ****
> --- 63,72 ----
> * Do not try to collapse these into one "w+" mode file. Doesn't work
> on
> * some platforms (eg, HPUX 10.20).
> */
> + #ifndef WIN32
> termin = fopen("/dev/tty", "r");
> termout = fopen("/dev/tty", "w");
> + #endif
> if (!termin || !termout)
> {
> if (termin)
>
>
> Let me know what you think.
>
> Robert Kinberg
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

--
Bruce Momjian http://candle.pha.pa.us
SRA OSS, Inc. http://www.sraoss.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
unknown_filename text/plain 2.1 KB

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-03-03 23:59:28 Re: constant too large in port/gettimeofday
Previous Message Bruce Momjian 2006-03-03 23:11:55 Re: Native-win32 patch