6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/bugs/core_0216_test.py

50 lines
1.1 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-18 20:45:21 +01:00
"""
ID: issue-544
ISSUE: 544
TITLE: Too many grants lose privileges
DESCRIPTION:
Issuing more than 2000 grants on any one object causes
an internal buffer flow in generating the access
control list that actually enforces the rights.
JIRA: CORE-216
FBTEST: bugs.core_0216
2022-01-18 20:45:21 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
init_script = """create table T (PK integer);
2021-04-26 20:07:00 +02:00
create table LOG(PK integer);
"""
2022-01-18 20:45:21 +01:00
db = db_factory(page_size=4096, init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=2.5')
2022-01-18 20:45:21 +01:00
def test_1(act: Action):
with act.db.connect() as con:
2021-11-10 19:02:05 +01:00
c = con.cursor()
# Create 4000 triggers on table T
i = 1
cmd = """create trigger LOGT_%d for T after insert as
begin
insert into log (PK) values (new.pk);
end
2022-01-18 20:45:21 +01:00
"""
2021-11-10 19:02:05 +01:00
while i <= 4000:
c.execute(cmd % i)
i += 1
con.commit()
# Grants
i = 1
cmd = """GRANT INSERT ON LOG TO TRIGGER LOGT_%d"""
while i <= 4000:
c.execute(cmd % i)
i += 1
con.commit()
2021-04-26 20:07:00 +02:00