Skip site navigation (1) Skip section navigation (2)

BUG #2246: Only call pg_fe_getauthname if none given

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: BUG #2246: Only call pg_fe_getauthname if none given
Date: 2006-02-15 18:32:09
Message-ID: 20060215183209.GL4474@ns.snowman.net (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> Right offhand I like the idea of pushing it into connectOptions2 --- can
> you experiment with that?  Seems like there is no reason to call
> Kerberos if the user supplies the name to connect as.

Patch attached.  After looking through the code around this I discovered
that conninfo_parse is also called by PQconndefaults.  This patch
changes the 'default' returned for user to NULL (instead of whatever
pg_fe_getauthname returns).  This is probably better than not calling
Kerberos in pg_fe_getauthname and potentially returning the wrong thing
(if the username doesn't match the princ, a common situation), but it
might break existing applications.  Are those applications wrong to be
asking libpq to provide what it thinks the username is when asking for
the defaults?  I'd say probably yes, but then we don't provide another
way for them to get it either.

Patch tested w/ 'trust', 'ident', 'md5' and 'krb5' methods from psql.

	Enjoy,

		Stephen

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-02-15 18:43:18
Subject: Re: BUG #2260: PGCrypto Memory Problem
Previous:From: Tom LaneDate: 2006-02-15 18:29:20
Subject: Re: BUG #2259: never ending select from selects

pgsql-patches by date

Next:From: Tom LaneDate: 2006-02-15 19:19:29
Subject: Re: BUG #2246: Only call pg_fe_getauthname if none given
Previous:From: Simon RiggsDate: 2006-02-15 17:38:51
Subject: Re: add additional options to CREATE TABLE ... AS

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group