SET SESSION AUTHORIZATION (was Re: Real/effective user)

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: SET SESSION AUTHORIZATION (was Re: Real/effective user)
Date: 2001-04-21 15:43:02
Message-ID: Pine.LNX.4.30.0104211735070.758-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I proclaimed:

> Tom Lane writes:
>
> > 1. "real user" = what you originally authenticated to the postmaster.
> >
> > 2. "session user" = what you can SET if your real identity is a superuser.
> >
> > 3. "current user" = effective userid for permission checks.
>
> We could have a Boolean variable "authenticated user is superuser" which
> would serve as the permission to execute SET SESSION AUTHENTICATION, while
> we would not actually be making the identity of the real/authenticated
> user available (so as to not confuse things unnecessarily).

I have implemented this; it seems to do what we need:

$ ~/pg-install/bin/psql -U peter

peter=# set session authorization 'joeblow';
SET VARIABLE
peter=# create table foo (a int);
CREATE
peter=# \dt
List of relations
Name | Type | Owner
-------+-------+---------
foo | table | joeblow
test | table | peter
test2 | table | peter
(3 rows)

Libpq's PQuser() can no longer be trusted for up to date information, so
psql's prompt, if set up that way, may be wrong, but I'm not sure whether
this is worth worrying about.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-04-21 16:29:47 Re: setuid(geteuid());?
Previous Message Bruce Momjian 2001-04-21 15:07:56 Re: setuid(geteuid());?