From: Tom Lane <tgl@sss.pgh.pa.us>
To: dmg@uvic.ca
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6728: revoke grant cascade behaviour
Date: Thu, 23 Aug 2012 15:45:46 -0400
Message-ID: <5077.1345751146@sss.pgh.pa.us> (raw)
In-Reply-To: <E1Sp1oX-0004oR-6M@wrigleys.postgresql.org>
References: <E1Sp1oX-0004oR-6M@wrigleys.postgresql.org>
dmg@uvic.ca writes:
> I am trying to understand how postgresql implements REVOKE GRANT ...
> CASCADE
> [ example snipped ]
> What I am surprised is that m keeps the proviledge (via b) but x and y have
> lost it. See below). is that the way it is supposed to be?
It is not. There is actually code in there that is supposed to deal
with this consideration, but it's got a trivial bug :-(. Will fix,
and add a regression test example too. Thanks for the report!
regards, tom lane
inline patch 1: src/backend/utils/adt/acl.c (+2/-2 lines) download inline-1.patchdiff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.cindex 77322a115f1f7b36e08541ae6ab5e3fd873aea5b..cf04c420d9808a46828783489536932cc3530f05 100644
*** a/src/backend/utils/adt/acl.c
--- b/src/backend/utils/adt/acl.c
*************** recursive_revoke(Acl *acl,
*** 1230,1240 ****
if (grantee == ownerId)
return acl;
! /* The grantee might still have the privileges via another grantor */
still_has = aclmask(acl, grantee, ownerId,
ACL_GRANT_OPTION_FOR(revoke_privs),
ACLMASK_ALL);
! revoke_privs &= ~still_has;
if (revoke_privs == ACL_NO_RIGHTS)
return acl;
--- 1230,1240 ----
if (grantee == ownerId)
return acl;
! /* The grantee might still have the grant options via another grantor */
still_has = aclmask(acl, grantee, ownerId,
ACL_GRANT_OPTION_FOR(revoke_privs),
ACLMASK_ALL);
! revoke_privs &= ~ACL_OPTION_TO_PRIVS(still_has);
if (revoke_privs == ACL_NO_RIGHTS)
return acl;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, dmg@uvic.ca
Subject: Re: BUG #6728: revoke grant cascade behaviour
In-Reply-To: <5077.1345751146@sss.pgh.pa.us>
References: <E1Sp1oX-0004oR-6M@wrigleys.postgresql.org> <5077.1345751146@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox