Re: BUG #9923: "reassign owned" does not change permissions grantor

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alexey Bashtanov <bashtanov(at)imap(dot)cc>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #9923: "reassign owned" does not change permissions grantor
Date: 2015-01-09 18:19:48
Message-ID: 20150109181948.GC26812@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Apr 9, 2014 at 11:35:09AM +0400, Alexey Bashtanov wrote:
> after a series of tests and source code reading I realized that
> 1) the bug is not fixed in last git repository version

Confirmed.

> 2) the bug could be reproduced on types and foreign servers, maybe
> also on foreign data wrappers, triggers, but not on any other
> objects

Triggers don't have acl lists, but all the others are accurate.

> 3) it does not matter if we assign owner using "reassign owned" or
> using "alter .. owner to ..."

Confirmed.

> 4) there is a problem on revoking such incorrect grants: a
> workaround is to reassign back to old owner, then revoke, than
> reassign once again
> 5) to fix the bug we need to perform aclnewowner call in
> AlterForeignServerOwner_internal and AlterTypeOwner (including the
> typtype == TYPTYPE_COMPOSITE case, cause we pass recursing=true to
> ATExecChangeOwner)
> and maybe in AlterForeignDataWrapperOwner_internal and
> AlterEventTriggerOwner_internal

I can confirm this bug report from April, and your analysis of the fixes
--- we were missing calls to aclnewowner() for types, foreign servers,
and foreign data wrappers, for both REASSIGN and ALTER OWNER TO.

With the attached SQL script you can see the ACL fields properly
changing to match the object owner (attached). Without the patch, only
the table's ACL changes.

The patch also changes the regression output --- I think that is because
the object ownership changes remove certain duplicates from the ACL
list.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachment Content-Type Size
acl.sql text/plain 2.2 KB
new text/plain 1.5 KB
acl.diff text/x-diff 23.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Karl O. Pinc 2015-01-09 18:31:46 Re: BUG #12469: pg_locks shows locks held by pids not found i n pg_stat_activity or ps
Previous Message Kevin Grittner 2015-01-09 18:07:35 Re: BUG #12469: pg_locks shows locks held by pids not found i n pg_stat_activity or ps