Re: SYSTEM_USER reserved word implementation

From: Jacob Champion <jchampion(at)timescale(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SYSTEM_USER reserved word implementation
Date: 2022-09-08 17:37:01
Message-ID: CAAWbhmjRi8bRyCJ3Eo+cDwqP4omXQsy=TGJXy-8WV+XLoCCcKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 7, 2022 at 6:17 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> >> + /* Initialize SystemUser now that MyClientConnectionInfo is restored. */
> >> + InitializeSystemUser(MyClientConnectionInfo.authn_id,
> >> + hba_authname(MyClientConnectionInfo.auth_method));
> >
> > It makes me a little nervous to call hba_authname(auth_method) without
> > checking to see that auth_method is actually valid (which is only true
> > if authn_id is not NULL).
>
> You have mentioned that a couple of months ago if I recall correctly,
> and we pass down an enum value.

Ah, sorry. Do you remember which thread?

I am probably misinterpreting you, but I don't see why auth_method's
being an enum helps. uaReject (and the "reject" string) is not a sane
value to be using in SYSTEM_USER, and the more call stacks away we get
from MyClientConnectionInfo, the easier it is to forget that that
value is junk. As long as the code doesn't get more complicated, I
suppose there's no real harm being done, but it'd be cleaner not to
access auth_method at all if authn_id is NULL. I won't die on that
hill, though.

> There is actually a second and much deeper issue
> here, in the shape of a collation problem.

Oh, none of that sounds fun. :/

--Jacob

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-09-08 17:53:56 Re: Switching XLog source from archive to streaming when primary available
Previous Message Peter Geoghegan 2022-09-08 17:31:04 Re: Instrumented pages/tuples frozen in autovacuum's server log out (and VACUUM VERBOSE)