Skip to content

Commit

Permalink
Fixed CORE-6489: User without ALTER ANY ROLE privilege can use COMMEN…
Browse files Browse the repository at this point in the history
…T ON ROLE
  • Loading branch information
AlexPeshkoff committed Mar 12, 2021
1 parent 85781bf commit 3f2e1ea
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/jrd/ini.epp
Expand Up @@ -471,17 +471,23 @@ void INI_format(const char* owner, const char* charset)
charset->name;
++charset)
{
add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, obj_charset, charset->name, length, buffer);
add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, obj_charset,
charset->name, length, buffer);
}

reqModObjSC.reset();
for (const IntlManager::CollationDefinition* collation = IntlManager::defaultCollations;
collation->name;
++collation)
{
add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, obj_collation, collation->name, length, buffer);
add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, obj_collation,
collation->name, length, buffer);
}

reqModObjSC.reset();
add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, obj_sql_role,
ADMIN_ROLE, length, buffer);

// Must be last!
acl = aclPublicStart;
memcpy(acl, PKG_PUBLIC_EXECUTE_ACL, sizeof(PKG_PUBLIC_EXECUTE_ACL));
Expand Down Expand Up @@ -1205,6 +1211,18 @@ static void add_security_to_sys_obj(thread_db* tdbb,
}
END_FOR
}
else if (obj_type == obj_sql_role)
{
FOR(REQUEST_HANDLE reqModObjSC) R IN RDB$ROLES
WITH R.RDB$ROLE_NAME EQ obj_name.c_str()
{
MODIFY R USING
R.RDB$SECURITY_CLASS.NULL = FALSE;
PAD(security_class.c_str(), R.RDB$SECURITY_CLASS);
END_MODIFY
}
END_FOR
}
else if (obj_type == obj_package_header)
{
FOR(REQUEST_HANDLE reqModObjSC) PKG IN RDB$PACKAGES
Expand Down

0 comments on commit 3f2e1ea

Please sign in to comment.