[7.3devl] Using PGPASSWORDFILE with psql requires -U option?

From: Gordon Runkle <gar(at)integrated-dynamics(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [7.3devl] Using PGPASSWORDFILE with psql requires -U option?
Date: 2002-08-30 02:33:39
Message-ID: akmll6$2cs6$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm using the current CVS (as of ~1930 EDT, 29AUG02) on RedHat's latest
beta (null). I find that I need to use the -U option when trying to use
psql and the new PGPASSWORDFILE variable.

Here's what I have in my ~/.pgpw file (pointed to by PGPASSWORDFILE):

localhost:*:az_audit:gar:test

This my Linux userid is 'gar', so it should work, and indeed the error
message in the server log is:

Aug 29 21:02:10 tb02 postgres[18440]: [1] LOG: connection received: host=127.0.0.1 port=1084
Aug 29 21:02:10 tb02 postgres[18440]: [2] FATAL: Password authentication failed for user "gar"

Which is odd, because psql clearly knows my userid is 'gar', and
transmits it to the backend correctly.

If I add the '-U gar', then all is well.

Stepping through psql with gdb, I see that in the case where I don't set
-U, the returned password (from is garbled:

(gdb) print conn->pgpass
$11 = 0x806d228 "testì¡\021B"

Whereas when I set '-U', the returned password is fine!

(gdb) print conn->pgpass
$15 = 0x806cf08 "test"

It appears that the problem is in PasswordFromFile() in fe_connect.c, but
I'm not sure, as gdb insists that 't' and 'ret' are not in the current
scope when I get to the end of the function. :-(

But the behaviour is consisten.

Thanks,

Gordon.
--
"Far and away the best prize that life has to offer
is the chance to work hard at work worth doing."
-- Theodore Roosevelt

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-08-30 03:07:03 Re: tweaking MemSet() performance
Previous Message Tom Lane 2002-08-30 02:09:45 Re: pgsql-server/src/include/port hpux.h