[PATCH] Prompt for password on Windows platforms

From: "Robert Kinberg" <kinberg(at)tecore(dot)com>
To: <pgsql-patches(at)postgresql(dot)org>
Subject: [PATCH] Prompt for password on Windows platforms
Date: 2006-02-22 18:27:15
Message-ID: 4617D1C9A5981841B2BF61010024710B05D0A5@exchhq01p.internal.tecore.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-02-22 19:01:36 Re: [PATCH] Prompt for password on Windows platforms
Previous Message Andrew Dunstan 2006-02-22 17:12:20 Re: windows / initdb oddness