[7.3devl] Using PGPASSWORDFILE with psql requires -U option? - Mailing list pgsql-hackers

From Gordon Runkle
Subject [7.3devl] Using PGPASSWORDFILE with psql requires -U option?
Date
Msg-id akmll6$2cs6$1@news.hub.org
Whole thread Raw
Responses Re: [7.3devl] Using PGPASSWORDFILE with psql requires -U
List 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


pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: RULE regression test failure
Next
From: Bruce Momjian
Date:
Subject: Re: tweaking MemSet() performance