Skip to content

Commit

Permalink
Remove grantor as dbo from RemoveRoleFromInitPriv
Browse files Browse the repository at this point in the history
Signed-off-by: Shard Gupta <[email protected]>
  • Loading branch information
shardgupta committed Nov 16, 2024
1 parent 3044084 commit e831a95
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/backend/catalog/aclchk.c
Original file line number Diff line number Diff line change
Expand Up @@ -5024,6 +5024,7 @@ RemoveRoleFromInitPriv(Oid roleid, Oid classid, Oid objid, int32 objsubid)
if (old_acl != NULL)
{
Oid sysadminOid;
Acl *temp_acl;
const char *babelfish_db_name;

/*
Expand All @@ -5035,18 +5036,24 @@ RemoveRoleFromInitPriv(Oid roleid, Oid classid, Oid objid, int32 objsubid)
objid == get_database_oid(babelfish_db_name, true) &&
is_member_of_role(GetUserId(), sysadminOid = (*bbf_get_sysadmin_oid_hook)()))
{
grantorId = sysadminOid;
temp_acl = merge_acl_with_grant(old_acl,
false, /* is_grant */
false, /* grant_option */
DROP_RESTRICT,
list_make1_oid(roleid),
ACLITEM_ALL_PRIV_BITS,
sysadminOid,
ownerId);
old_acl = temp_acl;
}
else
grantorId = ownerId;

new_acl = merge_acl_with_grant(old_acl,
false, /* is_grant */
false, /* grant_option */
DROP_RESTRICT,
list_make1_oid(roleid),
ACLITEM_ALL_PRIV_BITS,
grantorId,
ownerId,
ownerId);
}
else
Expand Down

0 comments on commit e831a95

Please sign in to comment.