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

From Robert Kinberg
Subject [PATCH] Prompt for password on Windows platforms
Date
Msg-id 4617D1C9A5981841B2BF61010024710B05D0A5@exchhq01p.internal.tecore.com
Whole thread Raw
Responses Re: [PATCH] Prompt for password on Windows platforms  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [PATCH] Prompt for password on Windows platforms  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
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


pgsql-patches by date:

Previous
From: David Fetter
Date:
Subject: Re: Uninstall scripts for contrib
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Prompt for password on Windows platforms