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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-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

Attachment Content-Type Size
move_getauthname.ctx.patch text/plain 2.5 KB

In response to

Responses

Browse pgsql-bugs by date

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

Browse pgsql-patches by date

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