diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-08-23 17:25:23 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-08-23 17:25:23 -0400 |
commit | ff122d3268d55ace4a2ebf5f4ee1528e8a80fa98 (patch) | |
tree | 1703df4a04732f853b5d972f8317dc5d3c742f45 /src/backend/utils/adt/acl.c | |
parent | 874d97c2a8211cf7daaa70ee531037e69a18f4ba (diff) | |
download | postgresql-ff122d3268d55ace4a2ebf5f4ee1528e8a80fa98.tar.gz postgresql-ff122d3268d55ace4a2ebf5f4ee1528e8a80fa98.zip |
Fix cascading privilege revoke to notice when privileges are still held.
If we revoke a grant option from some role X, but X still holds the option
via another grant, we should not recursively revoke the privilege from
role(s) Y that X had granted it to. This was supposedly fixed as one
aspect of commit 4b2dafcc0b1a579ef5daaa2728223006d1ff98e9, but I must not
have tested it, because in fact that code never worked: it forgot to shift
the grant-option bits back over when masking the bits being revoked.
Per bug #6728 from Daniel German. Back-patch to all active branches,
since this has been wrong since 8.0.
Diffstat (limited to 'src/backend/utils/adt/acl.c')
-rw-r--r-- | src/backend/utils/adt/acl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 4a3e241c415..31fa42185ed 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -1165,11 +1165,11 @@ recursive_revoke(Acl *acl, if (grantee == ownerId) return acl; - /* The grantee might still have the privileges via another grantor */ + /* The grantee might still have some grant options via another grantor */ still_has = aclmask(acl, grantee, ownerId, ACL_GRANT_OPTION_FOR(revoke_privs), ACLMASK_ALL); - revoke_privs &= ~still_has; + revoke_privs &= ~ACL_OPTION_TO_PRIVS(still_has); if (revoke_privs == ACL_NO_RIGHTS) return acl; |