From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | ljb <lbayuk(at)mindspring(dot)com> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: Shouldn't .pgpass work with anything which uses libpq? |
Date: | 2003-01-08 22:05:43 |
Message-ID: | 200301082205.h08M5h812125@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
OK, here is a patch I applied to 7.3.X and CVS head to fix the problem.
The basic issue is that PQsetdbLogin does the pgpass test and then calls
PQconnectDB. The fix is to do the pgpass test in PQconnectDB so both
PQsetdbLogin and PQconnectDB can use it.
However, your posting brings up an interesting issue. Our current code
makes no distinction between "" as a password, and a NULL password.
They are both equivalent to "I have supplied no password". If you
create a public user with an empty password, "", there is no way to log
in as that user, because "" is considered to be "no password".
I don't want to play with this in 7.3.X, but is it something we should
consider cleaning up for 7.4?
---------------------------------------------------------------------------
ljb wrote:
> (Using PostgreSQL-7.3.1)
>
> I noticed that the new ~/.pgpass password file works with psql but not with
> my pgtclsh scripts, and I'm wondering: shouldn't it work with anything
> built on top of libpq?
>
> Digging into it a bit, I think no conninfo-based connection method will use
> .pgpass, including libpq PQconnectDB() and libpgtcl "pg_connect -conninfo".
> I think it is happening because .pgpass is only read if the password
> argument to PQsetdbLogin() is NULL. But if no password is supplied in a
> conninfo string, then "DefaultPassword" is used - this is an empty string,
> not NULL. Am I right? Is this behavior wrong?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 1.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-01-08 22:42:26 | Re: MOVE LAST: why? |
Previous Message | Jeroen T. Vermeulen | 2003-01-08 17:30:29 | Re: libpqxx Large Objects |