mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Disregard superuserness when checking to see if a role GRANT would
create circularity of role memberships. This is a minimum-impact fix for the problem reported by Florian Pflug. I thought about removing the superuser_arg test from is_member_of_role() altogether, as it seems redundant for many of the callers --- but not all, and it's way too late in the 8.1 cycle to be making large changes. Perhaps reconsider this later.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.163 2005/10/29 00:31:51 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.164 2005/11/04 17:25:15 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1214,9 +1214,10 @@ AddRoleMems(const char *rolename, Oid roleid,
|
||||
* Refuse creation of membership loops, including the trivial case
|
||||
* where a role is made a member of itself. We do this by checking to
|
||||
* see if the target role is already a member of the proposed member
|
||||
* role.
|
||||
* role. We have to ignore possible superuserness, however, else we
|
||||
* could never grant membership in a superuser-privileged role.
|
||||
*/
|
||||
if (is_member_of_role(roleid, memberid))
|
||||
if (is_member_of_role_nosuper(roleid, memberid))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
|
||||
(errmsg("role \"%s\" is a member of role \"%s\"",
|
||||
|
Reference in New Issue
Block a user