Re: 2 forks for md5?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 2 forks for md5?
Date: 2005-09-22 22:36:36
Message-ID: 200509222236.j8MMaaM21070@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan wrote:
> >This seems reasonable behavior when prompting for a password from the
> >user, since that's going to take a lot of time anyway. I'm not sure
> >whether libpq should try to excavate a password from ~/.pgpass in
> >advance of being told by the server that one is needed.
> >
> >An ideal solution might be to read ~/.pgpass during the bit of code that
> >handles a password challenge from the server, rather than in the "outer
> >loop". Not having looked at the libpq code recently, I have no idea how
> >painful that would be to do.
> >
> >
>
> Actually, it looks to me like the cause is some code in psql/startup.c
> which keeps trying to make a connection while it gets
> PQnoPasswordSupplied. libpq seemed to work just fine, picking up pgpass
> before a connection was attempted.
>
> My only real concern is that when you turn on log_connections the traces
> are confusing - from the user's perspective there is only one
> connection, and there are two mentioned in the log, one of which doesn't
> have a correspondingly logged disconnect. Maybe worth a mention in the docs?

I turned on passwords and did see duplicate connections:

LOG: connection received: host=[local]
LOG: connection received: host=[local]
LOG: connection authorized: user=postgres database=test
LOG: disconnection: session time: 0:00:00.61 user=postgres database=test host=[local]

Basically psql first tries with no password, then when it fails asking
for a password, it prompts for one and connects. You will notice only
one "authorized:" message. I think that is the real "connection" line,
rather than the "recevied" lines. Not sure how we can improve this. We
could print an "authorization failed" message. Would that help, or just
be overkill?

--
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-09-22 22:42:52 Re: 2 forks for md5?
Previous Message Tom Lane 2005-09-22 22:29:11 Proposed patch to clean up signed-ness warnings