Re: bug in permission handling?

From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martin Renters <martin(at)datafax(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: bug in permission handling?
Date: 2002-01-15 04:06:23
Message-ID: Pine.LNX.4.21.0201151505050.27718-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 15 Jan 2002, Gavin Sherry wrote:

> On Mon, 14 Jan 2002, Tom Lane wrote:
>
> > Martin Renters <martin(at)datafax(dot)com> writes:
> > > Should the permissions of a deleted user get assigned to a new user
> > > as in the example below?
> >
> > That can happen, since the default "usesysid" assignment is "max
> > existing usesysid + 1". If you delete the last user then their sysid
> > becomes a candidate for reassignment. This is not real good, but fixing
> > it isn't that high on the priority list (and is difficult to do unless
> > we take away the option of hand-assigned sysids ... otherwise we could
> > just have a sequence generator for sysids).
>
> Another slight bug with CreateUser() -- there does not appear to be any
> checking for potential overflow of sysid. The function scans pg_shadow to
> find the largest usrsysid. Once obtained:
>
> /* If no sysid given, use max existing id + 1 */
> if (!havesysid)
> sysid = max_id + 1;
>

Left this bit off:

template1=# create user def with sysid 2147483647;
CREATE USER
template1=# create user def2;
CREATE USER
template1=# create user def3;
ERROR: Cannot insert a duplicate key into unique index
pg_shadow_usesysid_index
template1=# select usesysid from pg_shadow where usename ~ 'def';
usesysid
-------------
2147483647
-2147483648
(2 rows)

template1=# select version();
version
---------------------------------------------------------------------
PostgreSQL 7.2b4 on i686-pc-linux-gnu, compiled by GCC egcs-2.91.66
(1 row)

template1=#

Gavin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2002-01-15 04:22:59 Re: Theory about XLogFlush startup failures
Previous Message Tom Lane 2002-01-15 03:55:55 Re: Theory about XLogFlush startup failures